2026-06-01 22:58:51 +00:00
local function PopulateAISBXToolMenu ( pnl )
pnl : CheckBox ( " Allow NPCs to target downed NPCs " , " zcnpci_npc_targeting_enabled " )
pnl : ControlHelp ( " If enabled, NPCs target downed hostile NPCs. " )
pnl : CheckBox ( " NPCs should target head " , " zcnpci_target_should_follow_head " )
pnl : ControlHelp ( " Should NPCs target the player's head? This can result in more effective targeting. " )
pnl : CheckBox ( " NPCs shouldn't target unconscious NPCs " , " zcnpci_no_unconscious_targeting " )
pnl : CheckBox ( " NPCs shouldn't target unconscious players " , " zcnpci_no_unconscious_targeting_players " )
pnl : ControlHelp ( " This may or may not work. " )
end
2026-05-28 14:07:20 +00:00
local function PopulateCustomNPCSBXToolMenu ( pnl )
local modded_npc_whitelist = CreateConVar ( " zcnpci_modded_npc_whitelist " , " NPC-classes-here! " , bit.bor ( FCVAR_ARCHIVE , FCVAR_REPLICATED ) )
pnl : Help ( " ZCNPCi has support for both modded NPCs, as well as base-game humanoid NPCs that Z-City never added. There is no guarantee that modded NPCs will work, but ones with similar skeletal structure to other base-game humanoid NPCs will generally work better. " )
pnl : CheckBox ( " Allow base-game extended NPCs " , " zcnpci_allow_extended_base_npcs " )
pnl : ControlHelp ( " Enable or disables applying custom health system to most other base-game humanoid NPCs, such as Kleiner. " )
pnl : CheckBox ( " Allow modded NPCs " , " zcnpci_allow_modded_npcs " )
pnl : ControlHelp ( " Enable or disables applying custom health system to modded NPCs. " )
pnl : CheckBox ( " Auto enable for all humanoid NPCs " , " zcnpci_auto_enable_humanoid_npcs " )
pnl : ControlHelp ( " If enabled, NPCs will automatically have the health system applied to them if they have a standard humanoid skeleton. " )
pnl : Help ( " List of enabled modded NPC classes " )
local text = vgui.Create ( " DTextEntry " )
text : SetMultiline ( true )
text : SetTall ( 200 )
text : SetValue ( modded_npc_whitelist : GetString ( ) )
text.OnChange = function ( self )
RunConsoleCommand ( " zcnpci_set_modded_npc_whitelist " , text : GetValue ( ) )
end
pnl : AddItem ( text )
2026-06-01 22:58:51 +00:00
pnl : Help ( " A list of NPC classes, seperated by spaces or line breaks. Can only be set by a superadmin or server operator. " )
2026-05-28 14:07:20 +00:00
end
2026-05-26 22:38:42 +00:00
2026-05-28 14:07:20 +00:00
local function PopulateRagdollSBXToolMenu ( pnl )
2026-05-25 16:33:03 +00:00
pnl : NumSlider ( " Stumble time " , " zcnpci_stumble_time " , 0 , 10 , 3 )
2026-05-25 18:17:06 +00:00
pnl : ControlHelp ( " How long the ragdoll should try to stumble for. " )
2026-05-25 04:57:41 +00:00
2026-05-25 16:33:03 +00:00
pnl : NumSlider ( " Wound grab chance " , " zcnpci_woundgrab_chance " , 0 , 1 , 3 )
2026-05-25 04:57:41 +00:00
pnl : ControlHelp ( " The chance the ragdoll will grab it's wound when shot. " )
2026-05-25 16:33:03 +00:00
pnl : NumSlider ( " Wound grab time " , " zcnpci_woundgrab_time " , 0 , 10 , 3 )
2026-05-25 04:57:41 +00:00
pnl : ControlHelp ( " How long the ragdoll should hold its wound. " )
2026-05-30 19:02:58 +00:00
pnl : CheckBox ( " Allow getting up " , " zcnpci_unfake_enabled " )
pnl : ControlHelp ( " If enabled, NPCs will get back up if able. " )
pnl : NumSlider ( " Get up time " , " zcnpci_unfake_time " , 0 , 5 , 3 )
pnl : ControlHelp ( " How long the getting up animation lasts. Setting to 0 will disable the getting up animation. " )
2026-05-25 04:57:41 +00:00
2026-05-25 18:17:06 +00:00
pnl : NumSlider ( " Minimum down time " , " zcnpci_down_time " , 0 , 20 , 3 )
pnl : ControlHelp ( " The minimum amount of time the ragdoll should be down before trying to get back up. " )
2026-05-26 22:38:42 +00:00
end
2026-05-25 18:17:06 +00:00
2026-05-26 22:38:42 +00:00
local function PopulatePerformanceSBXToolMenu ( pnl )
2026-05-28 17:08:14 +00:00
pnl : NumSlider ( " NPC ticks per second " , " zcnpci_tps " , 1 , 66 , 0 )
pnl : ControlHelp ( " How many times NPCs should be processed per second. Will make them more responsive at the cost of performance. " )
pnl : Help ( " " )
pnl : Help ( " " )
2026-05-27 16:13:26 +00:00
pnl : NumSlider ( " Activation range " , " zcnpci_active_range " , 0 , 32768 , 0 )
pnl : ControlHelp ( " How close the ragdoll has to be to a player to live when downed by direct damage. Enemies downed by other causes are unaffected. " )
2026-05-25 04:57:41 +00:00
2026-05-25 16:33:03 +00:00
pnl : CheckBox ( " Always activate on player kill " , " zcnpci_always_active_on_player_kill " )
2026-05-26 22:38:42 +00:00
pnl : ControlHelp ( " If on, all player-damaged ragdolls will be activated regardless of other factors. " )
pnl : Help ( " " )
pnl : Help ( " " )
pnl : CheckBox ( " Enable automatic corpse removal " , " zcnpci_enable_corpse_removal " )
pnl : ControlHelp ( " Enable or disable the removal of dead corpses. " )
2026-05-28 17:08:14 +00:00
pnl : NumSlider ( " Corpse time between loops " , " zcnpci_corpse_loop_time " , 1 , 66 , 0 )
pnl : ControlHelp ( " How long should we wait in between checks? " )
2026-05-26 22:38:42 +00:00
pnl : NumSlider ( " Max corpses " , " zcnpci_max_corpses " , - 1 , 64 , 0 )
pnl : ControlHelp ( " The maximum amount of dead corpses that are allowed before one is removed. Set to -1 to disable " )
pnl : NumSlider ( " Max time " , " zcnpci_max_corpse_time " , - 1 , 600 , 2 )
pnl : ControlHelp ( " The maximum amount of time before a corpse is removed. Set to -1 to disable " )
pnl : NumSlider ( " Max distance between player " , " zcnpci_max_corpse_distance " , - 1 , 32768 , 2 )
pnl : ControlHelp ( " If the corpse is further than this distance, it will be removed. Set to -1 to disable " )
2026-05-27 16:13:26 +00:00
pnl : NumSlider ( " Min distance between player " , " zcnpci_min_corpse_distance " , 0 , 32768 , 2 )
pnl : ControlHelp ( " If the corpse is closer than this distance, it will never be cleared. " )
2026-05-27 03:21:18 +00:00
pnl : CheckBox ( " Treat crippled NPCs as dead " , " zcnpci_treat_crippled_as_dead " )
2026-05-27 16:13:26 +00:00
pnl : ControlHelp ( " If on, bodies with amputations or both legs broken will be clearable. " )
pnl : CheckBox ( " Treat unconscious NPCs as dead " , " zcnpci_treat_unconscious_as_dead " )
pnl : ControlHelp ( " If on, bodies that are unconscious will be clearable. " )
2026-05-27 03:21:18 +00:00
pnl : CheckBox ( " Treat near-death NPCs as dead " , " zcnpci_treat_near_death_as_dead " )
2026-05-27 16:13:26 +00:00
pnl : ControlHelp ( " If on, bodies near death (severe blood loss, comas, etc.) will be clearable. " )
2026-05-25 04:57:41 +00:00
end
2026-05-28 14:07:20 +00:00
local function PopulateMainSBXToolMenu ( pnl )
pnl : CheckBox ( " Enabled " , " zcnpci_enabled " )
pnl : ControlHelp ( " Enable or disable the addon. " )
pnl : Help ( " This addon was developed by ToasterPanic. " )
pnl : Help ( " It is based on Kazarei's Euphoria, which in turn is a fork of Fedhoria by Rama. Their work powers the ragdoll movement. " )
end
2026-05-25 04:57:41 +00:00
if engine.ActiveGamemode ( ) == " sandbox " then
2026-05-25 16:33:03 +00:00
hook.Add ( " AddToolMenuCategories " , " ZCNPCICategory " , function ( )
spawnmenu.AddToolCategory ( " Utilities " , " zcnpci " , " Z-City NPCi " )
2026-05-25 04:57:41 +00:00
end )
2026-05-25 16:33:03 +00:00
hook.Add ( " PopulateToolMenu " , " ZCNPCIMenuSettings " , function ( )
2026-05-28 14:07:20 +00:00
spawnmenu.AddToolMenuOption ( " Utilities " , " zcnpci " , " ModdedNPCSettings " , " Custom NPCs " , " " , " " , function ( pnl )
2026-05-25 04:57:41 +00:00
pnl : ClearControls ( )
2026-05-28 14:07:20 +00:00
PopulateCustomNPCSBXToolMenu ( pnl )
2026-05-25 04:57:41 +00:00
end )
2026-05-26 22:38:42 +00:00
spawnmenu.AddToolMenuOption ( " Utilities " , " zcnpci " , " PerformanceSettings " , " Performance " , " " , " " , function ( pnl )
pnl : ClearControls ( )
PopulatePerformanceSBXToolMenu ( pnl )
end )
2026-05-28 14:07:20 +00:00
spawnmenu.AddToolMenuOption ( " Utilities " , " zcnpci " , " RagdollSettings " , " Ragdoll " , " " , " " , function ( pnl )
pnl : ClearControls ( )
PopulateRagdollSBXToolMenu ( pnl )
end )
2026-06-01 22:58:51 +00:00
spawnmenu.AddToolMenuOption ( " Utilities " , " zcnpci " , " AISettings " , " AI " , " " , " " , function ( pnl )
pnl : ClearControls ( )
PopulateAISBXToolMenu ( pnl )
end )
2026-05-28 14:07:20 +00:00
spawnmenu.AddToolMenuOption ( " Utilities " , " zcnpci " , " MainSettings " , " Main " , " " , " " , function ( pnl )
pnl : ClearControls ( )
PopulateMainSBXToolMenu ( pnl )
end )
2026-05-25 04:57:41 +00:00
end )
end