From 59df0969a282b72bff574695845e86e198272850 Mon Sep 17 00:00:00 2001 From: BobTheBob <32057864+BobTheBob9@users.noreply.github.com> Date: Thu, 14 Apr 2022 00:37:27 +0100 Subject: move devcommands to northstar.customservers (#300) --- Northstar.Custom/mod.json | 15 +---- .../scripts/vscripts/_northstar_devcommands.gnut | 38 ------------ Northstar.CustomServers/mod.json | 7 +++ .../scripts/vscripts/_northstar_cheatcommands.nut | 69 ++++++++++++++++++++++ 4 files changed, 77 insertions(+), 52 deletions(-) delete mode 100644 Northstar.Custom/mod/scripts/vscripts/_northstar_devcommands.gnut create mode 100644 Northstar.CustomServers/mod/scripts/vscripts/_northstar_cheatcommands.nut diff --git a/Northstar.Custom/mod.json b/Northstar.Custom/mod.json index 77fc2a62..c2b29fea 100644 --- a/Northstar.Custom/mod.json +++ b/Northstar.Custom/mod.json @@ -37,13 +37,6 @@ "After": "NorthstarCustomPrecache" } }, - { - "Path": "_northstar_devcommands.gnut", - "RunOn": "SERVER && MP", - "ServerCallback": { - "After": "NorthstarDevCommands_Init" - } - }, { "Path": "weapons/mp_weapon_peacekraber.nut", "RunOn": "( CLIENT || SERVER ) && MP" @@ -416,13 +409,7 @@ } } ], - "Maps": [ - { - "Name": "mp_skyway_v1", - "VPK": "englishclient_mp_skyway_v1", - "RPak": "sp_skyway_v1" - } - ], + "Localisation": [ "resource/northstar_custom_%language%.txt" ] diff --git a/Northstar.Custom/mod/scripts/vscripts/_northstar_devcommands.gnut b/Northstar.Custom/mod/scripts/vscripts/_northstar_devcommands.gnut deleted file mode 100644 index 850855a0..00000000 --- a/Northstar.Custom/mod/scripts/vscripts/_northstar_devcommands.gnut +++ /dev/null @@ -1,38 +0,0 @@ -untyped -global function NorthstarDevCommands_Init - -void function NorthstarDevCommands_Init() -{ - AddClientCommandCallback( "noclip", ClientCommandCallbackToggleNoclip ) - AddClientCommandCallback( "kill", ClientCommandCallbackKill ) - AddClientCommandCallback( "explode", ClientCommandCallbackExplode ) -} - -bool function ClientCommandCallbackToggleNoclip( entity player, array args ) -{ - if ( GetConVarInt( "sv_cheats" ) != 1 ) - return true - - if ( player.IsNoclipping() ) - player.SetPhysics( MOVETYPE_WALK ) - else - player.SetPhysics( MOVETYPE_NOCLIP ) - - return true -} - -bool function ClientCommandCallbackKill( entity player, array args ) -{ - if ( IsAlive( player ) ) - player.Die() - - return true -} - -bool function ClientCommandCallbackExplode( entity player, array args ) -{ - if ( IsAlive( player ) ) - player.Die( null, null, { scriptType = DF_GIB } ) - - return true -} diff --git a/Northstar.CustomServers/mod.json b/Northstar.CustomServers/mod.json index 4ad212c4..89bacc36 100644 --- a/Northstar.CustomServers/mod.json +++ b/Northstar.CustomServers/mod.json @@ -59,6 +59,13 @@ "Before": "NSSetupChathooksServer" } }, + { + "Path": "_northstar_cheatcommands.nut", + "RunOn": "SERVER", + "ServerCallback": { + "After": "NorthstarCheatCommands_Init" + } + }, { "Path": "_chat.gnut", "RunOn": "SERVER" diff --git a/Northstar.CustomServers/mod/scripts/vscripts/_northstar_cheatcommands.nut b/Northstar.CustomServers/mod/scripts/vscripts/_northstar_cheatcommands.nut new file mode 100644 index 00000000..619bfcaf --- /dev/null +++ b/Northstar.CustomServers/mod/scripts/vscripts/_northstar_cheatcommands.nut @@ -0,0 +1,69 @@ +untyped +global function NorthstarCheatCommands_Init + +void function NorthstarCheatCommands_Init() +{ + AddClientCommandCallback( "noclip", ClientCommandCallbackToggleNoclip ) + AddClientCommandCallback( "notarget", ClientCommandCallbackToggleNotarget ) + AddClientCommandCallback( "demigod", ClientCommandCallbackToggleDemigod ) + AddClientCommandCallback( "kill", ClientCommandCallbackKill ) + AddClientCommandCallback( "explode", ClientCommandCallbackExplode ) +} + +bool function ClientCommandCallbackToggleNoclip( entity player, array args ) +{ + if ( !GetConVarBool( "sv_cheats" ) ) + return true + + print( player + " TOGGLED NOCLIP" ) + + if ( player.IsNoclipping() ) + player.SetPhysics( MOVETYPE_WALK ) + else + player.SetPhysics( MOVETYPE_NOCLIP ) + + return true +} + +bool function ClientCommandCallbackToggleNotarget( entity player, array args ) +{ + if ( !GetConVarBool( "sv_cheats" ) ) + return true + + print( player + " TOGGLED NOTARGET" ) + + player.SetNoTarget( !player.GetNoTarget() ) + player.SetNoTargetSmartAmmo( player.GetNoTarget() ) + return true +} + +bool function ClientCommandCallbackToggleDemigod( entity player, array args ) +{ + if ( !GetConVarBool( "sv_cheats" ) ) + return true + + print( player + " TOGGLED DEMIGOD" ) + + if ( IsDemigod( player ) ) + DisableDemigod( player ) + else + EnableDemigod( player ) + + return true +} + +bool function ClientCommandCallbackKill( entity player, array args ) +{ + if ( IsAlive( player ) ) + player.Die() + + return true +} + +bool function ClientCommandCallbackExplode( entity player, array args ) +{ + if ( IsAlive( player ) ) + player.Die( null, null, { scriptType = DF_GIB } ) + + return true +} -- cgit v1.2.3