Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion lua/entities/gmod_wire_turret.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ function ENT:Initialize()
self.Firing = false
self.spreadvector = Vector()
self.effectdata = EffectData()
self.attachmentPos = phys:WorldToLocal(self:GetAttachment(1).Pos)

-- Not all entities have an 1 attachment
local attachment = self:GetAttachment(1)
self.attachmentPos = attachment and self:WorldToLocal(attachment.Pos) or vector_origin

self.Inputs = WireLib.CreateSpecialInputs(self,
{ "Fire", "Force", "Damage", "NumBullets", "Spread", "Delay", "Sound", "Tracer" },
Expand Down
14 changes: 0 additions & 14 deletions lua/wire/stools/turret.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,6 @@ if SERVER then
end
end

local ValidTurretModels = {
["models/weapons/w_smg1.mdl"] = true,
["models/weapons/w_smg_mp5.mdl"] = true,
["models/weapons/w_smg_mac10.mdl"] = true,
["models/weapons/w_rif_m4a1.mdl"] = true,
["models/weapons/w_357.mdl"] = true,
["models/weapons/w_shot_m3super90.mdl"] = true
}

function TOOL:GetModel()
local model = WireToolObj.GetModel(self)
return ValidTurretModels[model] and model or "models/weapons/w_smg1.mdl"
end

function TOOL.BuildCPanel( CPanel )
WireToolHelpers.MakePresetControl(CPanel, "wire_turret")

Expand Down
Loading