Compare commits
1 Commits
main
...
work/onspa
Author | SHA1 | Date | |
---|---|---|---|
32966fac0e |
@ -5,28 +5,57 @@ local originalListSet = list.Set
|
|||||||
function list.Set(listType, class, npc)
|
function list.Set(listType, class, npc)
|
||||||
if listType == "NPC" then
|
if listType == "NPC" then
|
||||||
if npc["Class"] == "npc_combine_s" and npc["Category"] ~= "#spawnmenu.category.combine" then
|
if npc["Class"] == "npc_combine_s" and npc["Category"] ~= "#spawnmenu.category.combine" then
|
||||||
npc["Class"] = citizenEnemy["Class"]
|
if !npc["KeyValues"] then
|
||||||
npc["KeyValues"] = {
|
npc["KeyValues"] = {}
|
||||||
Hostile = 1,
|
end
|
||||||
SquadName = "overwatch",
|
npc["KeyValues"]["SquadName"] = "m_EnemyRebel"
|
||||||
citizentype = 4
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
originalListSet(listType, class, npc)
|
originalListSet(listType, class, npc)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Second stage. idk if one of these necessary
|
hook.Add("OnEntityCreated", "ForceReplaceCombine", function(ent)
|
||||||
timer.Simple(0, function ()
|
timer.Simple(0, function()
|
||||||
for class, npc in pairs(npcs) do
|
if !SERVER then return end
|
||||||
if npc["Class"] == "npc_combine_s" and npc["Category"] ~= "#spawnmenu.category.combine" then
|
if not IsValid(ent) then return end
|
||||||
npc["Class"] = citizenEnemy["Class"]
|
|
||||||
npc["KeyValues"] = {
|
if ent:GetClass() == "npc_citizen" then
|
||||||
Hostile = 1,
|
|
||||||
SquadName = "overwatch",
|
|
||||||
citizentype = 4
|
|
||||||
}
|
|
||||||
originalListSet("NPC", class, npc)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if ent:GetKeyValues()["squadname"] == "m_EnemyRebel" then
|
||||||
|
local pos = ent:GetPos()
|
||||||
|
local ang = ent:GetAngles()
|
||||||
|
local mdl = ent:GetModel()
|
||||||
|
local weps = ent:GetWeapons()
|
||||||
|
local health = ent:GetMaxHealth()
|
||||||
|
local keyValues = ent:GetKeyValues()
|
||||||
|
|
||||||
|
ent:Remove()
|
||||||
|
|
||||||
|
local npc = ents.Create("npc_citizen")
|
||||||
|
if not IsValid(npc) then return end
|
||||||
|
|
||||||
|
for key, value in pairs(keyValues) do
|
||||||
|
npc:SetKeyValue(key, tostring(value))
|
||||||
|
-- if value ~= "" then
|
||||||
|
-- end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
npc:SetHealth(health)
|
||||||
|
npc:SetMaxHealth(health)
|
||||||
|
|
||||||
|
npc:SetKeyValue("hostile", 1)
|
||||||
|
npc:SetKeyValue("squadname", "overwatch")
|
||||||
|
npc:SetKeyValue("citizentype", 4)
|
||||||
|
|
||||||
|
for _, wep in ipairs(weps) do
|
||||||
|
npc:Give(wep:GetClass())
|
||||||
|
end
|
||||||
|
|
||||||
|
npc:SetPos(pos)
|
||||||
|
npc:SetAngles(ang)
|
||||||
|
npc:SetModel(mdl)
|
||||||
|
npc:Spawn()
|
||||||
|
end
|
||||||
|
end)
|
||||||
end)
|
end)
|
Loading…
x
Reference in New Issue
Block a user