1 parent 796030c commit 672cb6eCopy full SHA for 672cb6e
1 file changed
lua/starfall/libs_sh/npc.lua
@@ -119,13 +119,19 @@ if SERVER then
119
local npc = unwrap(self)
120
checkpermission(instance, npc, "npcs.giveweapon")
121
122
+ local npcSpawnable = false
123
+ for _, v in ipairs(list.GetForEdit("NPCUsableWeapons")) do
124
+ if v.class == wep then npcSpawnable = true break end
125
+ end
126
+ if not npcSpawnable then SF.Throw("Weapon "..wep.." is not in npc useable weapons list!", 2) end
127
+
128
local weapon = npc:GetActiveWeapon()
129
if Ent_IsValid(weapon) then
- if (Ent_GetClass(weapon) == "weapon_" .. wep) then return end
130
+ if (Ent_GetClass(weapon) == wep) then return end
131
Ent_Remove(weapon)
132
end
133
- Npc_Give(npc, "ai_weapon_" .. wep)
134
+ Npc_Give(npc, wep)
135
136
137
--- Tell the npc to fight this
0 commit comments