Skip to content
Merged
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
6 changes: 5 additions & 1 deletion lua/entities/gmod_contr_spawner/init.lua
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
--[[
Title: Adv. Dupe 2 Contraption Spawner

Desc: A mobile duplicator

Author: TB

Version: 1.0
]]

Check warning on line 9 in lua/entities/gmod_contr_spawner/init.lua

View workflow job for this annotation

GitHub Actions / lint

"Syntax inconsistency"

Inconsistent use of '/* */' and '--[[ ]]'

AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )
Expand Down Expand Up @@ -44,9 +44,9 @@
end
end

/*-----------------------------------------------------------------------*
* Sets options for this spawner
*-----------------------------------------------------------------------*/

Check warning on line 49 in lua/entities/gmod_contr_spawner/init.lua

View workflow job for this annotation

GitHub Actions / lint

"Syntax inconsistency"

Inconsistent use of '/* */' and '--[[ ]]'
function ENT:SetOptions(ply, delay, undo_delay, key, undo_key, disgrav, disdrag, addvel, hideprops )

self.delay = delay
Expand All @@ -66,7 +66,7 @@
self.AddVelocity = addvel
self.HideProps = hideprops

-- Store the player's current dupe name

Check warning on line 69 in lua/entities/gmod_contr_spawner/init.lua

View workflow job for this annotation

GitHub Actions / lint

"Syntax inconsistency"

Inconsistent use of '//' and '--'
self.DupeName = tostring(ply.AdvDupe2.Name)

self:ShowOutput()
Expand All @@ -81,12 +81,12 @@
local moveable = self:GetPhysicsObject():IsMoveable()
self:GetPhysicsObject():EnableMotion(false)
local EntTable, GhostEntity, Phys
local Offset = self.DupeAngle - self.EntAngle

Check warning on line 84 in lua/entities/gmod_contr_spawner/init.lua

View workflow job for this annotation

GitHub Actions / lint

"Unused variable"

Unused variable: Offset
for EntIndex,v in pairs(self.EntityTable)do
if(EntIndex!=self.HeadEnt)then
if(self.EntityTable[EntIndex].Class=="gmod_contr_spawner")then self.EntityTable[EntIndex] = nil continue end
EntTable = table.Copy(self.EntityTable[EntIndex])
if(EntTable.BuildDupeInfo && EntTable.BuildDupeInfo.PhysicsObjects)then

Check warning on line 89 in lua/entities/gmod_contr_spawner/init.lua

View workflow job for this annotation

GitHub Actions / lint

"Syntax inconsistency"

Inconsistent use of 'and' and '&&'
Phys = EntTable.BuildDupeInfo.PhysicsObjects[0]
else
if(!v.BuildDupeInfo)then v.BuildDupeInfo = {} end
Expand All @@ -104,7 +104,7 @@
GhostEntity = ents.Create( "gmod_ghost" )
end

// If there are too many entities we might not spawn..

Check warning on line 107 in lua/entities/gmod_contr_spawner/init.lua

View workflow job for this annotation

GitHub Actions / lint

"Syntax inconsistency"

Inconsistent use of '//' and '--'
if ( !GhostEntity || GhostEntity == NULL ) then return end

duplicator.DoGeneric( GhostEntity, EntTable )
Expand Down Expand Up @@ -141,7 +141,7 @@
self.ConstraintTable = ConstraintTable
if(!self.DupeAngle)then self.DupeAngle = self:GetAngles() end
if(!self.EntAngle)then self.EntAngle = EntityTable[HeadEnt].PhysicsObjects[0].Angle end
if(!self.Offset)then self.Offset = self.EntityTable[HeadEnt].PhysicsObjects[0].Pos end

Check warning on line 144 in lua/entities/gmod_contr_spawner/init.lua

View workflow job for this annotation

GitHub Actions / lint

"Syntax inconsistency"

Inconsistent use of 'not' and '!'

local headpos, headang = EntityTable[HeadEnt].PhysicsObjects[0].Pos, EntityTable[HeadEnt].PhysicsObjects[0].Angle
for k, v in pairs(EntityTable) do
Expand All @@ -152,8 +152,8 @@
end

function ENT:DoSpawn( ply )
-- Explicitly allow spawning if no player is provided, but an invalid player gets denied. This can happen when a player leaves the server.

Check warning on line 155 in lua/entities/gmod_contr_spawner/init.lua

View workflow job for this annotation

GitHub Actions / lint

"Syntax inconsistency"

Inconsistent use of '//' and '--'
if not (ply and ply:IsValid()) then return end

Check warning on line 156 in lua/entities/gmod_contr_spawner/init.lua

View workflow job for this annotation

GitHub Actions / lint

"Syntax inconsistency"

Inconsistent use of 'and' and '&&'

Check warning on line 156 in lua/entities/gmod_contr_spawner/init.lua

View workflow job for this annotation

GitHub Actions / lint

"Syntax inconsistency"

Inconsistent use of 'not' and '!'

for k, v in pairs(self.EntityTable) do
for o, p in pairs(v.PhysicsObjects) do
Expand Down Expand Up @@ -187,7 +187,11 @@
if(ent.SetForce)then ent.SetForce(ent, ent.force, ent.mul) end
if(self.AddVelocity==1)then
phys:SetVelocity( self:GetVelocity() )
phys:AddAngleVelocity( self:GetPhysicsObject():GetAngleVelocity() )
local self_phys = self:GetPhysicsObject()

if IsValid( self_phys ) then
phys:AddAngleVelocity( self_phys:GetAngleVelocity() )
end
end
end

Expand Down
Loading