mirror of
https://github.com/roflmuffin/CounterStrikeSharp.git
synced 2025-12-08 00:46:34 -08:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a0fcb7817e | ||
|
|
cdb7a6ed17 | ||
|
|
38e29531c3 | ||
|
|
5f95969980 | ||
|
|
42dd270b78 | ||
|
|
b807c3eda8 | ||
|
|
3ede4c366c | ||
|
|
49cc91e373 | ||
|
|
8a795de9fa |
3
.github/dependabot.yaml
vendored
3
.github/dependabot.yaml
vendored
@@ -6,7 +6,8 @@ updates:
|
||||
allow:
|
||||
- dependency-name: "libraries/hl2sdk-cs2"
|
||||
- dependency-name: "libraries/metamod-source"
|
||||
- dependency-name: "libraries/Protobufs"
|
||||
schedule:
|
||||
interval: "daily"
|
||||
commit-message:
|
||||
prefix: "chore(deps)"
|
||||
prefix: "chore(deps)"
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "48 ? ? 55 53 56 57 41 ? 48 ? ? ? 48 ? ? ? ? ? ? 4C 89 68",
|
||||
"linux": "55 48 89 E5 41 56 41 55 41 54 53 48 89 FB 48 83 EC 30 E8 ? ? ? ?"
|
||||
"linux": "55 48 89 E5 41 56 41 55 41 54 53 48 89 FB 48 83 EC 40 E8"
|
||||
}
|
||||
},
|
||||
"CGameEventManager_Init": {
|
||||
|
||||
Submodule libraries/Protobufs updated: 686a0628e6...76e070dc65
Submodule libraries/hl2sdk-cs2 updated: 1f1d1580fd...fc4b98f1a7
@@ -116,9 +116,6 @@ namespace CounterStrikeSharp.API.Core
|
||||
|
||||
public readonly Dictionary<Delegate, CallbackSubscriber> Handlers =
|
||||
new Dictionary<Delegate, CallbackSubscriber>();
|
||||
|
||||
public readonly Dictionary<Delegate, CallbackSubscriber> CommandHandlers =
|
||||
new Dictionary<Delegate, CallbackSubscriber>();
|
||||
|
||||
public readonly Dictionary<Delegate, CallbackSubscriber> CommandListeners =
|
||||
new Dictionary<Delegate, CallbackSubscriber>();
|
||||
@@ -132,6 +129,8 @@ namespace CounterStrikeSharp.API.Core
|
||||
internal readonly Dictionary<Delegate, EntityIO.EntityOutputCallback> EntitySingleOutputHooks =
|
||||
new Dictionary<Delegate, EntityIO.EntityOutputCallback>();
|
||||
|
||||
public readonly List<CommandDefinition> CommandDefinitions = new List<CommandDefinition>();
|
||||
|
||||
public readonly List<Timer> Timers = new List<Timer>();
|
||||
|
||||
public delegate HookResult GameEventHandler<T>(T @event, GameEventInfo info) where T : GameEvent;
|
||||
@@ -193,11 +192,13 @@ namespace CounterStrikeSharp.API.Core
|
||||
public void AddCommand(string name, string description, CommandInfo.CommandCallback handler)
|
||||
{
|
||||
var definition = new CommandDefinition(name, description, handler);
|
||||
CommandDefinitions.Add(definition);
|
||||
CommandManager.RegisterCommand(definition);
|
||||
}
|
||||
|
||||
private void AddCommand(CommandDefinition definition)
|
||||
{
|
||||
CommandDefinitions.Add(definition);
|
||||
CommandManager.RegisterCommand(definition);
|
||||
}
|
||||
|
||||
@@ -229,14 +230,13 @@ namespace CounterStrikeSharp.API.Core
|
||||
/// <param name="handler">The callback function to be invoked when the command is executed.</param>
|
||||
public void RemoveCommand(string name, CommandInfo.CommandCallback handler)
|
||||
{
|
||||
if (CommandHandlers.ContainsKey(handler))
|
||||
var definition = CommandDefinitions.FirstOrDefault(
|
||||
definition => definition.Name == name && definition.Callback == handler);
|
||||
|
||||
if (definition != null)
|
||||
{
|
||||
var subscriber = CommandHandlers[handler];
|
||||
|
||||
NativeAPI.RemoveCommand(name, subscriber.GetInputArgument());
|
||||
|
||||
FunctionReference.Remove(subscriber.GetReferenceIdentifier());
|
||||
CommandHandlers.Remove(handler);
|
||||
CommandDefinitions.Remove(definition);
|
||||
CommandManager.RemoveCommand(definition);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -621,11 +621,6 @@ namespace CounterStrikeSharp.API.Core
|
||||
{
|
||||
subscriber.Dispose();
|
||||
}
|
||||
|
||||
foreach (var subscriber in CommandHandlers.Values)
|
||||
{
|
||||
subscriber.Dispose();
|
||||
}
|
||||
|
||||
foreach (var subscriber in CommandListeners.Values)
|
||||
{
|
||||
@@ -642,6 +637,11 @@ namespace CounterStrikeSharp.API.Core
|
||||
subscriber.Dispose();
|
||||
}
|
||||
|
||||
foreach (var definition in CommandDefinitions)
|
||||
{
|
||||
CommandManager.RemoveCommand(definition);
|
||||
}
|
||||
|
||||
foreach (var timer in Timers)
|
||||
{
|
||||
timer.Kill();
|
||||
@@ -650,4 +650,4 @@ namespace CounterStrikeSharp.API.Core
|
||||
_disposed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,5 +122,7 @@ public enum NetworkDisconnectionReason
|
||||
NETWORK_DISCONNECT_KICKED_IDLE = 158,
|
||||
NETWORK_DISCONNECT_KICKED_SUICIDE = 159,
|
||||
NETWORK_DISCONNECT_KICKED_NOSTEAMLOGIN = 160,
|
||||
NETWORK_DISCONNECT_KICKED_NOSTEAMTICKET = 161
|
||||
NETWORK_DISCONNECT_KICKED_NOSTEAMTICKET = 161,
|
||||
NETWORK_DISCONNECT_KICKED_INPUTAUTOMATION = 162,
|
||||
NETWORK_DISCONNECT_KICKED_VACNETABNORMALBEHAVIOR = 163
|
||||
}
|
||||
|
||||
@@ -46,7 +46,10 @@ static IGameEvent *CreateEvent(ScriptContext &script_context) {
|
||||
bool force = script_context.GetArgument<bool>(1);
|
||||
|
||||
auto pEvent = globals::gameEventManager->CreateEvent(name, force);
|
||||
managed_game_events.push_back(pEvent);
|
||||
|
||||
if (pEvent != nullptr) {
|
||||
managed_game_events.push_back(pEvent);
|
||||
}
|
||||
|
||||
return pEvent;
|
||||
}
|
||||
@@ -301,4 +304,4 @@ REGISTER_NATIVES(events, {
|
||||
ScriptEngine::RegisterNativeHandler("LOAD_EVENTS_FROM_FILE", LoadEventsFromFile);
|
||||
})
|
||||
|
||||
} // namespace counterstrikesharp
|
||||
} // namespace counterstrikesharp
|
||||
|
||||
Reference in New Issue
Block a user