aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhummusbird <hummusbirb@gmail.com>2022-01-12 17:49:56 +0000
committerGitHub <noreply@github.com>2022-01-12 14:49:56 -0300
commit398b9439edc2fa51c284f09fa9ea30cfb0403043 (patch)
tree91462106db45630f489fb6138325d3702cba3d1b
parentfc917867b288c5fbbc3ecf2b45542224d1f5c622 (diff)
downloadNorthstarMods-398b9439edc2fa51c284f09fa9ea30cfb0403043.tar.gz
NorthstarMods-398b9439edc2fa51c284f09fa9ea30cfb0403043.zip
Add tactical ability restriction (#97)
-rw-r--r--Northstar.Custom/mod.json111
-rw-r--r--Northstar.Custom/mod/scripts/vscripts/_disallowed_tacticals.gnut51
2 files changed, 114 insertions, 48 deletions
diff --git a/Northstar.Custom/mod.json b/Northstar.Custom/mod.json
index de71af58..ba88af7a 100644
--- a/Northstar.Custom/mod.json
+++ b/Northstar.Custom/mod.json
@@ -4,8 +4,15 @@
"Version": "1.1.0",
"LoadPriority": 1,
"RequiredOnClient": true,
-
+
"ConVars": [
+ { "Name": "ns_disallowed_tacticals",
+ "DefaultValue": ""
+ },
+ {
+ "Name": "ns_disallowed_tactical_replacement",
+ "DefaultValue": ""
+ },
{
"Name": "ns_disallowed_weapons",
"DefaultValue": ""
@@ -15,7 +22,7 @@
"DefaultValue": "mp_weapon_rspn101"
}
],
-
+
"Scripts": [
{
"Path": "sh_northstar_custom_precache.gnut",
@@ -23,7 +30,7 @@
"ClientCallback": {
"After": "NorthstarCustomPrecache"
},
-
+
"ServerCallback": {
"After": "NorthstarCustomPrecache"
}
@@ -35,12 +42,12 @@
"After": "NorthstarDevCommands_Init"
}
},
-
+
{
"Path": "weapons/mp_weapon_peacekraber.nut",
"RunOn": "( CLIENT || SERVER ) && MP"
},
-
+
{
"Path": "gamemodes/sh_gamemode_chamber.nut",
"RunOn": "( CLIENT || SERVER ) && MP",
@@ -79,14 +86,14 @@
"Path": "gamemodes/cl_gamemode_hidden.nut",
"RunOn": "CLIENT && MP"
},
-
+
{
"Path": "gamemodes/sh_gamemode_fw_custom.nut",
"RunOn": "( CLIENT || SERVER ) && MP",
"ClientCallback": {
"Before": "SHCreateGamemodeFW_Init"
},
-
+
"ServerCallback": {
"Before": "SHCreateGamemodeFW_Init"
}
@@ -99,14 +106,14 @@
"Path": "gamemodes/cl_gamemode_fw.nut",
"RunOn": "CLIENT && MP"
},
-
+
{
"Path": "gamemodes/sh_gamemode_gg.gnut",
"RunOn": "( CLIENT || SERVER ) && MP",
"ClientCallback": {
"Before": "Sh_GamemodeGG_Init"
},
-
+
"ServerCallback": {
"Before": "Sh_GamemodeGG_Init"
}
@@ -119,14 +126,14 @@
"Path": "gamemodes/cl_gamemode_gg.gnut",
"RunOn": "CLIENT && MP"
},
-
+
{
"Path": "gamemodes/sh_gamemode_tt.gnut",
"RunOn": "( CLIENT || SERVER ) && MP",
"ClientCallback": {
"Before": "Sh_GamemodeTT_Init"
- },
-
+ },
+
"ServerCallback": {
"Before": "Sh_GamemodeTT_Init"
}
@@ -139,14 +146,14 @@
"Path": "gamemodes/cl_gamemode_tt.gnut",
"RunOn": "CLIENT && MP"
},
-
+
{
"Path": "gamemodes/sh_gamemode_inf.gnut",
"RunOn": "( CLIENT || SERVER ) && MP",
"ClientCallback": {
"Before": "Sh_GamemodeInfection_Init"
},
-
+
"ServerCallback": {
"Before": "Sh_GamemodeInfection_Init"
}
@@ -159,7 +166,7 @@
"Path": "gamemodes/cl_gamemode_inf.gnut",
"RunOn": "CLIENT && MP"
},
-
+
{
"Path": "_droppod_spawn.gnut",
"RunOn": "SERVER && MP",
@@ -173,7 +180,7 @@
"ClientCallback": {
"Before": "Sh_GamemodeArena_Init"
},
-
+
"ServerCallback": {
"Before": "Sh_GamemodeArena_Init"
}
@@ -181,15 +188,15 @@
{
"Path": "gamemodes/sh_arena_loadouts.gnut",
"RunOn": "UI || MP",
-
+
"ClientCallback": {
"After": "InitialiseArenaLoadouts"
},
-
+
"ServerCallback": {
"After": "InitialiseArenaLoadouts"
},
-
+
"UICallback": {
"After": "InitialiseArenaLoadouts"
}
@@ -202,14 +209,14 @@
"Path": "gamemodes/cl_gamemode_arena.gnut",
"RunOn": "CLIENT && MP"
},
-
+
{
"Path": "gamemodes/sh_gamemode_kr.gnut",
"RunOn": "( CLIENT || SERVER ) && MP",
"ClientCallback": {
"Before": "Sh_GamemodeKR_Init"
},
-
+
"ServerCallback": {
"Before": "Sh_GamemodeKR_Init"
}
@@ -222,14 +229,14 @@
"Path": "gamemodes/cl_gamemode_kr.gnut",
"RunOn": "CLIENT && MP"
},
-
+
{
"Path": "gamemodes/sh_gamemode_fastball.gnut",
"RunOn": "( CLIENT || SERVER ) && MP",
"ClientCallback": {
"Before": "Sh_GamemodeFastball_Init"
},
-
+
"ServerCallback": {
"Before": "Sh_GamemodeFastball_Init"
}
@@ -246,14 +253,14 @@
"Path": "gamemodes/cl_gamemode_fastball.gnut",
"RunOn": "CLIENT && MP"
},
-
+
{
"Path": "gamemodes/sh_gamemode_hs.gnut",
"RunOn": "( CLIENT || SERVER ) && MP",
"ClientCallback": {
"Before": "Sh_GamemodeHideAndSeek_Init"
},
-
+
"ServerCallback": {
"Before": "Sh_GamemodeHideAndSeek_Init"
}
@@ -266,14 +273,14 @@
"Path": "gamemodes/cl_gamemode_hs.gnut",
"RunOn": "CLIENT && MP"
},
-
+
{
"Path": "gamemodes/sh_gamemode_ctf_comp.gnut",
"RunOn": "( CLIENT || SERVER ) && MP",
"ClientCallback": {
"Before": "ShGamemodeCTFComp_Init"
},
-
+
"ServerCallback": {
"Before": "ShGamemodeCTFComp_Init"
}
@@ -285,7 +292,7 @@
"ClientCallback": {
"Before": "Sh_GamemodeTFFA_Init"
},
-
+
"ServerCallback": {
"Before": "Sh_GamemodeTFFA_Init"
}
@@ -295,12 +302,12 @@
"Path": "gamemodes/_gamemode_tffa.gnut",
"RunOn": "SERVER && MP"
},
-
+
{
"Path": "gamemodes/cl_gamemode_tffa.gnut",
"RunOn": "CLIENT && MP"
},
-
+
{
"Path": "sh_3psequence_to_1p_hacks.gnut",
"RunOn": "( CLIENT || SERVER ) && MP",
@@ -308,49 +315,49 @@
"Before": "FirstPersonSequenceForce1P_Init",
"After": "FirstPersonSequenceForce1P_InitPlaylistVars"
},
-
+
"ServerCallback": {
"Before": "FirstPersonSequenceForce1P_Init",
"After": "FirstPersonSequenceForce1P_InitPlaylistVars"
}
},
-
+
{
"Path": "gamemodes/sh_riff_instagib.gnut",
"RunOn": "( CLIENT || SERVER ) && MP",
"ClientCallback": {
"After": "RiffInstagib_Init"
},
-
+
"ServerCallback": {
"After": "RiffInstagib_Init"
}
},
-
+
{
"Path": "sh_custom_air_accel.gnut",
"RunOn": "CLIENT || SERVER",
"ClientCallback": {
"After": "CustomAirAccelVars_Init"
},
-
+
"ServerCallback": {
"After": "CustomAirAccelVars_Init"
}
},
-
+
{
"Path": "sh_promode.gnut",
"RunOn": "MP",
"ClientCallback": {
"After": "Promode_Init"
},
-
+
"ServerCallback": {
"After": "Promode_Init"
}
},
-
+
{
"Path": "sh_bleedout_damage.gnut",
"RunOn": "( CLIENT || SERVER ) && MP",
@@ -358,37 +365,37 @@
"Before": "BleedoutDamage_PreInit",
"After": "BleedoutDamage_Init"
},
-
+
"ServerCallback": {
"Before": "BleedoutDamage_PreInit",
"After": "BleedoutDamage_Init"
}
},
-
+
{
"Path": "sh_custom_oob_timer.gnut",
"RunOn": "( CLIENT || SERVER ) && MP",
"ClientCallback": {
"After": "CustomOOBTimer_Init"
},
-
+
"ServerCallback": {
"After": "CustomOOBTimer_Init"
}
},
-
+
{
"Path": "rodeo/sh_classic_rodeo.gnut",
"RunOn": "( CLIENT || SERVER ) && MP",
"ClientCallback": {
"After": "ClassicRodeo_InitPlaylistVars"
},
-
+
"ServerCallback": {
"After": "ClassicRodeo_InitPlaylistVars"
}
},
-
+
{
"Path": "_disallowed_weapons.gnut",
"RunOn": "SERVER && MP",
@@ -396,20 +403,28 @@
"After": "DisallowedWeapons_Init"
}
},
-
+
+ {
+ "Path": "_disallowed_tacticals.gnut",
+ "RunOn": "SERVER && MP",
+ "ServerCallback": {
+ "After": "DisallowedTacticals_Init"
+ }
+ },
+
{
"Path": "sh_custom_pilot_collision.gnut",
"RunOn": "( CLIENT || SERVER ) && MP",
"ClientCallback": {
"After": "CustomPilotCollision_InitPlaylistVars"
},
-
+
"ServerCallback": {
"After": "CustomPilotCollision_InitPlaylistVars"
}
}
],
-
+
"Maps": [
{
"Name": "mp_skyway_v1",
@@ -417,7 +432,7 @@
"RPak": "sp_skyway_v1"
}
],
-
+
"Localisation": [
"resource/northstar_custom_%language%.txt"
]
diff --git a/Northstar.Custom/mod/scripts/vscripts/_disallowed_tacticals.gnut b/Northstar.Custom/mod/scripts/vscripts/_disallowed_tacticals.gnut
new file mode 100644
index 00000000..b4a41931
--- /dev/null
+++ b/Northstar.Custom/mod/scripts/vscripts/_disallowed_tacticals.gnut
@@ -0,0 +1,51 @@
+global function DisallowedTacticals_Init
+
+struct {
+ array<string> disallowedTacticals
+ string disallowedTacticalsStringLastVal
+ string disallowedTacticalReplacement
+} file
+
+void function DisallowedTacticals_Init()
+{
+ UpdateDisallowedTacticalList()
+ AddCallback_OnPlayerRespawned( ReplacePlayerTactical )
+ AddCallback_OnPlayerGetsNewPilotLoadout( ReplacePlayerTacticalForLoadoutChange )
+}
+
+void function UpdateDisallowedTacticalList()
+{
+ string cvar = GetConVarString( "ns_disallowed_tacticals" )
+ if ( file.disallowedTacticalsStringLastVal == cvar )
+ return
+
+ file.disallowedTacticals = split( cvar, "," )
+ foreach ( string tactical in file.disallowedTacticals )
+ StringReplace( tactical, " ", "" )
+
+ file.disallowedTacticalReplacement = GetConVarString( "ns_disallowed_tactical_replacement")
+}
+
+void function ReplacePlayerTactical( entity player )
+{
+ UpdateDisallowedTacticalList()
+ if ( file.disallowedTacticals.len() == 0 )
+ return
+ array<entity> offhand = player.GetOffhandWeapons()
+
+ if ( file.disallowedTacticals.contains( offhand[1].GetWeaponClassName() ) )
+ {
+ player.TakeOffhandWeapon( 1 )
+ if ( file.disallowedTacticalReplacement != ""){
+ player.GiveOffhandWeapon( file.disallowedTacticalReplacement, OFFHAND_SPECIAL )
+ SendHudMessage( player, "Restricted tactical was replaced", -1, 0.4, 255, 255, 255, 255, 0.15, 3.0, 0.5 )
+ }
+ else { SendHudMessage( player, "Restricted tactical was removed", -1, 0.4, 255, 255, 255, 255, 0.15, 3.0, 0.5 ) }
+ }
+
+}
+
+void function ReplacePlayerTacticalForLoadoutChange( entity player, PilotLoadoutDef loadout )
+{
+ ReplacePlayerTactical( player )
+} \ No newline at end of file