Skip to content
Open
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
10 changes: 5 additions & 5 deletions lua/entities/gmod_wire_thruster.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
function ENT:Think()
BaseClass.Think(self)

self.ShouldDraw = GetConVarNumber("cl_drawthrusterseffects")

Check warning on line 53 in lua/entities/gmod_wire_thruster.lua

View workflow job for this annotation

GitHub Actions / lint

"Deprecated"

Deprecated: Use ConVar objects instead

if self.ShouldDraw == 0 or not self:IsOn() then return end

Expand Down Expand Up @@ -122,7 +122,7 @@
end

if self.neteffect then
self.effectforce = self.ThrustOffset:Length() * self.force * self.mul * 50
self.effectforce = self.ThrustOffset:Length() * self.force * self.mul
self.updateeffect = true
end

Expand All @@ -134,13 +134,13 @@
end

function ENT:CalcForce(phys)
local ThrusterWorldForce = phys:LocalToWorldVector( self.ThrustOffset ) * (self.force * self.mul * -50)
local ThrusterWorldForce = phys:LocalToWorldVector( self.ThrustOffset ) * (self.force * -self.mul)

-- Calculate the velocity
local ForceLinear, ForceAngular = phys:CalculateVelocityOffset(ThrusterWorldForce, phys:LocalToWorld( self.ThrustOffset ))

self.ForceLinear = phys:WorldToLocalVector(WireLib.clampForce(ForceLinear))
self.ForceAngular = phys:WorldToLocalVector(WireLib.clampForce(ForceAngular))
self.ForceLinear = WireLib.clampForce(ForceLinear)
self.ForceAngular = WireLib.clampForce(ForceAngular)
end

function ENT:SetDatEffect(uwater, owater, uweffect, oweffect)
Expand Down Expand Up @@ -180,10 +180,10 @@
self.owater = owater
self.uwater = uwater

if (not soundname) then soundname = "" end

Check warning on line 183 in lua/entities/gmod_wire_thruster.lua

View workflow job for this annotation

GitHub Actions / lint

"Syntax inconsistency"

Inconsistent use of 'single quoted strings' and 'double quoted strings'

-- Preventing client crashes
local BlockedChars = '["?]'

Check warning on line 186 in lua/entities/gmod_wire_thruster.lua

View workflow job for this annotation

GitHub Actions / lint

"Syntax inconsistency"

Inconsistent use of 'single quoted strings' and 'double quoted strings'
if ( string.find(soundname, BlockedChars) ) then
self:StopSound( self.SoundName )
soundname = ""
Expand All @@ -200,7 +200,7 @@

function ENT:TriggerInput(iname, value)
if (iname == "A") then
if ( (self.bidir) and (math.abs(value) > 0.01) and (math.abs(value) > self.force_min) ) or ( (value > 0.01) and (value > self.force_min) ) then

Check warning on line 203 in lua/entities/gmod_wire_thruster.lua

View workflow job for this annotation

GitHub Actions / lint

"Unnecessary parentheses"

Unnecessary parentheses
self:Switch(true, math.min(value, self.force_max))
else
self:Switch(false, 0)
Expand Down Expand Up @@ -241,7 +241,7 @@

self:CalcForce(phys)

return self.ForceAngular, self.ForceLinear, SIM_LOCAL_ACCELERATION
return self.ForceAngular, self.ForceLinear, SIM_GLOBAL_ACCELERATION
end

function ENT:Switch( on, mul )
Expand All @@ -252,7 +252,7 @@


if (on) then
if (changed) and (self.soundname and self.soundname ~= "") then

Check warning on line 255 in lua/entities/gmod_wire_thruster.lua

View workflow job for this annotation

GitHub Actions / lint

"Unnecessary parentheses"

Unnecessary parentheses
self:StopSound( self.soundname )
self:EmitSound( self.soundname )
end
Expand Down
2 changes: 1 addition & 1 deletion lua/entities/gmod_wire_vectorthruster.lua
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
function ENT:Think()
BaseClass.Think(self)

self.ShouldDraw = GetConVarNumber("cl_drawthrusterseffects")

Check warning on line 74 in lua/entities/gmod_wire_vectorthruster.lua

View workflow job for this annotation

GitHub Actions / lint

"Deprecated"

Deprecated: Use ConVar objects instead

if self.ShouldDraw == 0 or not self:IsOn() then return end

Expand Down Expand Up @@ -165,7 +165,7 @@
if ThrustLen>0 then
local ThrustNormal = ThrusterWorldForce/ThrustLen
self:SetNormal( -ThrustNormal )
self.ForceLinear, self.ForceAngular = phys:CalculateVelocityOffset( ThrustNormal * ( math.min( self.force * self.mul, self.force_max ) * 50 ), phys:LocalToWorld( self.ThrustOffset ) )
self.ForceLinear, self.ForceAngular = phys:CalculateVelocityOffset( ThrustNormal * ( math.min( self.force * self.mul, self.force_max ) ), phys:LocalToWorld( self.ThrustOffset ) )

self.ForceLinear = WireLib.clampForce(self.ForceLinear)
self.ForceAngular = WireLib.clampForce(self.ForceAngular)
Expand Down
Loading