Skip to content
This repository has been archived by the owner on Jun 23, 2023. It is now read-only.

Commit

Permalink
Slight concealment fix. Stupidity with chat logging
Browse files Browse the repository at this point in the history
  • Loading branch information
rexxar-tc committed Feb 10, 2016
1 parent 3cd2e6e commit f11d8ce
Show file tree
Hide file tree
Showing 7 changed files with 1,831 additions and 11 deletions.
Binary file added .vs/EssentialsPlugin/EssentialsPlugin.scgdat
Binary file not shown.
6 changes: 3 additions & 3 deletions EssentialsPlugin/AssemblyFileVersion.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
//116
//166
//
// This code was generated by a tool. Any changes made manually will be lost
// the next time this code is regenerated.
//

using System.Reflection;

[assembly: AssemblyFileVersion("1.13.5.116")]
[assembly: AssemblyVersion("1.13.5.116")]
[assembly: AssemblyFileVersion("1.13.5.166")]
[assembly: AssemblyVersion("1.13.5.166")]
4 changes: 2 additions & 2 deletions EssentialsPlugin/EntityManagers/EntityManagement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ public class EntityManagement

public static void ProcessConcealment( bool force = false )
{
//let's not enter the game thread if we don't have to. The poor thing is taxed enough as it is
ProcessConceal.ForceReveal = RevealQueue.Any( );
if ( !MedbayQueue.Any( ) && !RevealQueue.Any( ) && !ConcealQueue.Any( ) )
return;
//let's not enter the game thread if we don't have to. The poor thing is taxed enough as it is
ProcessConceal.ForceReveal = ((force && RevealQueue.Any( )) ? true : false);
//if we are sent the force flag but there's nothing in reveal queue, set the flag back to false
string forceString = (force ? "force reveal" : "concealment");
//just so our debug messages can be pretty
Expand Down
20 changes: 14 additions & 6 deletions EssentialsPlugin/Essentials.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1194,14 +1194,19 @@ private void DoInit( string path )
MyAPIGateway.Entities.OnEntityAdd += OnEntityAdd;
MyAPIGateway.Entities.OnEntityRemove += OnEntityRemove;

//MyAPIGateway.Multiplayer.RegisterMessageHandler( 9003, ReceiveDataMessage );
MyAPIGateway.Multiplayer.RegisterMessageHandler( 9003, ReceiveDataMessage );

Protection.Init( );
ProcessReservedSlots.Init( );

Log.Info( "Plugin '{0}' initialized. (Version: {1} ID: {2})", Name, Version, Id );
}

private void ReceiveDataMessage( byte[] data )
{

}

#endregion

#region Processing Loop
Expand Down Expand Up @@ -1349,11 +1354,14 @@ public void OnMessageReceived( )
/// </summary>
/// <param name="obj"></param>
public void OnChatReceived( ChatManager.ChatEvent obj )
{
if ( obj.Message[ 0 ] != '/' )
return;

HandleChatMessage( obj.SourceUserId, obj.Message );
{
if ( obj.Message[0] != '/' )
{
ChatHistory.AddChat( obj );
return;
}

HandleChatMessage( obj.SourceUserId, obj.Message );
}

public void HandleChatMessage( ulong steamId, string message )
Expand Down
1 change: 1 addition & 0 deletions EssentialsPlugin/EssentialsPlugin.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@
<Compile Include="UtilityClasses\SerializeableDictionary.cs" />
<Compile Include="UtilityClasses\UIEditors.cs" />
<Compile Include="Utility\Backup.cs" />
<Compile Include="Utility\ChatHistory.cs" />
<Compile Include="Utility\Docking.cs" />
<Compile Include="Utility\DockingItem.cs" />
<Compile Include="Utility\Protection.cs" />
Expand Down
27 changes: 27 additions & 0 deletions EssentialsPlugin/Utility/ChatHistory.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
namespace EssentialsPlugin.Utility
{
using System;
using System.Reflection;
using Sandbox.Game.Multiplayer;
using Sandbox.Game.World;
using SEModAPIExtensions.API;

public static class ChatHistory
{
/// <summary>
/// Adds incoming chat event into all players' global chat history.
/// </summary>
/// <param name="obj"></param>
public static void AddChat( ChatManager.ChatEvent obj )
{
Assembly assembly = typeof( Sync ).Assembly;
Type syncCharacter = assembly.GetType( "MySyncCharacter" );
MethodInfo globalMessageInfo = syncCharacter.GetMethod( "SendNewGlobalMessage",
BindingFlags.Public | BindingFlags.Instance );
globalMessageInfo = globalMessageInfo.MakeGenericMethod( typeof( MyPlayer.PlayerId ), typeof( string ) );
MyPlayer.PlayerId id = new MyPlayer.PlayerId( obj.SourceUserId );
object classInstance = Activator.CreateInstance( syncCharacter );
globalMessageInfo.Invoke( classInstance, new object[ ] { new MyPlayer.PlayerId( obj.SourceUserId ), obj.Message } );
}
}
}
Loading

0 comments on commit f11d8ce

Please sign in to comment.