Skip to content

Commit ff15ddd

Browse files
authored
Remove wire turret whitelist (#3566)
* Remove turret models whitelist There is no reason to limit it to just that * Check for attachment * Don't rely on physobj
1 parent 017e692 commit ff15ddd

2 files changed

Lines changed: 4 additions & 15 deletions

File tree

lua/entities/gmod_wire_turret.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ function ENT:Initialize()
2727
self.Firing = false
2828
self.spreadvector = Vector()
2929
self.effectdata = EffectData()
30-
self.attachmentPos = phys:WorldToLocal(self:GetAttachment(1).Pos)
30+
31+
-- Not all entities have an 1 attachment
32+
local attachment = self:GetAttachment(1)
33+
self.attachmentPos = attachment and self:WorldToLocal(attachment.Pos) or vector_origin
3134

3235
self.Inputs = WireLib.CreateSpecialInputs(self,
3336
{ "Fire", "Force", "Damage", "NumBullets", "Spread", "Delay", "Sound", "Tracer" },

lua/wire/stools/turret.lua

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,20 +45,6 @@ if SERVER then
4545
end
4646
end
4747

48-
local ValidTurretModels = {
49-
["models/weapons/w_smg1.mdl"] = true,
50-
["models/weapons/w_smg_mp5.mdl"] = true,
51-
["models/weapons/w_smg_mac10.mdl"] = true,
52-
["models/weapons/w_rif_m4a1.mdl"] = true,
53-
["models/weapons/w_357.mdl"] = true,
54-
["models/weapons/w_shot_m3super90.mdl"] = true
55-
}
56-
57-
function TOOL:GetModel()
58-
local model = WireToolObj.GetModel(self)
59-
return ValidTurretModels[model] and model or "models/weapons/w_smg1.mdl"
60-
end
61-
6248
function TOOL.BuildCPanel( CPanel )
6349
WireToolHelpers.MakePresetControl(CPanel, "wire_turret")
6450

0 commit comments

Comments
 (0)