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 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:Help("As long as the NPC has a compatible skeleton, support will be provided for modded NPCs on a best-effort basis.") 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) pnl:Help("A list of NPC classes, seperated by spaces or line breaks. Can only be set by a superadmin or server operator.") end local function PopulateRagdollSBXToolMenu(pnl) pnl:NumSlider("Stumble time", "zcnpci_stumble_time", 0, 10, 3) pnl:ControlHelp("How long the ragdoll should try to stumble for.") pnl:NumSlider("Wound grab chance", "zcnpci_woundgrab_chance", 0, 1, 3) pnl:ControlHelp("The chance the ragdoll will grab it's wound when shot.") pnl:NumSlider("Wound grab time", "zcnpci_woundgrab_time", 0, 10, 3) pnl:ControlHelp("How long the ragdoll should hold its wound.") 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.") 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.") end local function PopulatePerformanceSBXToolMenu(pnl) 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(" ") 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.") pnl:CheckBox("Always activate on player kill", "zcnpci_always_active_on_player_kill") 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.") pnl:NumSlider("Corpse time between loops", "zcnpci_corpse_loop_time", 1, 66, 0) pnl:ControlHelp("How long should we wait in between checks?") 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") 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.") pnl:CheckBox("Treat crippled NPCs as dead", "zcnpci_treat_crippled_as_dead") 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.") pnl:CheckBox("Treat near-death NPCs as dead", "zcnpci_treat_near_death_as_dead") pnl:ControlHelp("If on, bodies near death (severe blood loss, comas, etc.) will be clearable.") end 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 if engine.ActiveGamemode() == "sandbox" then hook.Add("AddToolMenuCategories", "ZCNPCICategory", function() spawnmenu.AddToolCategory("Utilities", "zcnpci", "Z-City NPCi") end) hook.Add("PopulateToolMenu", "ZCNPCIMenuSettings", function() spawnmenu.AddToolMenuOption("Utilities", "zcnpci", "ModdedNPCSettings", "Custom NPCs", "", "", function(pnl) pnl:ClearControls() PopulateCustomNPCSBXToolMenu(pnl) end) spawnmenu.AddToolMenuOption("Utilities", "zcnpci", "PerformanceSettings", "Performance", "", "", function(pnl) pnl:ClearControls() PopulatePerformanceSBXToolMenu(pnl) end) spawnmenu.AddToolMenuOption("Utilities", "zcnpci", "RagdollSettings", "Ragdoll", "", "", function(pnl) pnl:ClearControls() PopulateRagdollSBXToolMenu(pnl) end) spawnmenu.AddToolMenuOption("Utilities", "zcnpci", "AISettings", "AI", "", "", function(pnl) pnl:ClearControls() PopulateAISBXToolMenu(pnl) end) spawnmenu.AddToolMenuOption("Utilities", "zcnpci", "MainSettings", "Main", "", "", function(pnl) pnl:ClearControls() PopulateMainSBXToolMenu(pnl) end) end) end