internal static void WriteCoordPost(int val) { float *flValue = (float *)&val; switch (writeCoordCount) { case 0: coord.x = *flValue; break; case 1: coord.y = *flValue; break; default: coord.z = *flValue; break; } if (writeCoordCount >= 2) { #if DEBUG messageInformation.Arguments.Add(new MessageArgument(typeof(Vector3f), coord)); #endif writeCoordCount = 0; } else { writeCoordCount++; } // TODO: get an idea of what is past with this function, floats maybe? MetaModEngine.SetResult(MetaResult.Handled); }
internal static void MessageBeginPost(MessageDestination destination, int messageType, IntPtr floatValue, IntPtr playerEntity) { if (firstMessage) { // there is no event which intercepts between // the registering part and the first message (weaponlist in cstrike case) // so we need to initialize the game mode before the first message so we can // intercept this valuable information switch (Server.GameDirectory) { case "cstrike": CounterStrike.CounterStrike.Init(); break; } firstMessage = false; } #if DEBUG messageInformation = new MessageInformation(destination, messageType, floatValue, playerEntity); messageInformation.CallTimeBegin = DateTime.Now; #endif message_header = new MessageHeader(destination, messageType, floatValue, playerEntity); message_elements = new List <object>(); MetaModEngine.SetResult(MetaResult.Handled); }
internal static void WriteEntityPost(int entity) { #if DEBUG messageInformation.Arguments.Add(new MessageArgument(typeof(Entity), new Entity(new IntPtr(entity)))); #endif message_elements.Add(entity); MetaModEngine.SetResult(MetaResult.Handled); }
internal static void WriteStringPost(string val) { #if DEBUG messageInformation.Arguments.Add(new MessageArgument(typeof(string), (string)val)); #endif message_elements.Add(val); MetaModEngine.SetResult(MetaResult.Handled); }
internal static void WriteCharPost(int val) { #if DEBUG messageInformation.Arguments.Add(new MessageArgument(typeof(char), (char)val)); #endif message_elements.Add((char)val); MetaModEngine.SetResult(MetaResult.Handled); }
internal static void Spawn(IntPtr pent) { MetaModEngine.SetResult(MetaResult.Handled); if (spawnInitialized) { return; } spawnInitialized = true; // TODO: call precache method for plugins }
internal static void RegisterUserMessagePost(string name, int size) { #pragma warning disable 219 int id = Message.Register(name, size); #pragma warning restore 219 #if DEBUG Console.WriteLine("Registering: {0} {1}", name, id); #endif MetaModEngine.SetResult(MetaResult.Handled); }
internal static void MessageEndPost() { #if DEBUG messageInformation.CallTimeEnd = DateTime.Now; Console.WriteLine(messageInformation); #endif Message.Invoke(message_header, message_elements); MetaModEngine.SetResult(MetaResult.Handled); }
internal static void ServerActivatePost(IntPtr pEdictList, int edictCount, int clientMax) { #if DEBUG Console.WriteLine(" -- MONO: ServerActivate"); #endif Server.SetMaxPlayers(clientMax); // Load plugins here PluginManager.LoadPlugins(); RubyPluginManager.LoadPlugins(); PluginManager.ShowPlugins(); MetaModEngine.SetResult(MetaResult.Handled); }
internal static void StartFramePost() { // Check for the unauth players, if they have // already authed or not // TODO: hook some function in the engine in order // to avoid constant cpu usage foreach (Player player in Player.pendingAuthPlayers) { if (!player.PendingAuth) { Player.pendingAuthPlayers.Remove(player); Player.OnAuthorize(player); } } TaskManager.WorkFrame(); Loop.Default.RunAsync(); MetaModEngine.SetResult(MetaResult.Handled); }
internal static int GetEntityAPI2Post(ref EntityAPI functionTable, ref int interfaceVersion) { #if DEBUG Console.WriteLine(" -- MONO: GetEntityAPI2Post"); #endif functionTable = new EntityAPI(); functionTable.Spawn = Spawn; functionTable.Use = UsePost; functionTable.ClientConnect = Player.OnConnect; functionTable.ClientDisconnect = Player.OnDisconnect; functionTable.ServerActivate = ServerActivatePost; functionTable.StartFrame = StartFramePost; functionTable.ClientCommand = Player.OnCommand; functionTable.PutInServer = Player.OnPutInServer; Server.Init(); SharpMod.Init(); MetaModEngine.SetResult(MetaResult.Handled); return(0); }
public static void RemoveEntityPost(IntPtr entity) { Entity.RemoveEntity(entity); MetaModEngine.SetResult(MetaResult.Handled); }
internal static void WriteAnglePost(int val) { // TODO: get an idea of what is past with this function Console.WriteLine("WriteAnglePost"); MetaModEngine.SetResult(MetaResult.Handled); }
internal static void UsePost(IntPtr pentUsed, IntPtr pentOther) { // TODO: do something in here MetaModEngine.SetResult(MetaResult.Handled); }