Skip to content
This repository was archived by the owner on Feb 19, 2024. It is now read-only.

Minor fixes and code cleanup #4

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Minor fixes and code cleanup #4

wants to merge 2 commits into from

Conversation

unknao
Copy link
Contributor

@unknao unknao commented Dec 29, 2023

I split the code into 3 seperate files so it wouldn't be so disgusting to look at, also changed the janky network pingpong shit to use NetworkVar() and (hopefully) made the wheel spin speed not depend on the framerate.

local tag = "prop_vehicle_crawler"

--FastDL
local function add_resource_dir(dir)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

think there is a problem here, maybe invisible char?

if IsValid(self.Trails[i]) then SafeRemoveEntity(self.Trails[i]) end

self.Trails[i] = util.SpriteTrail(self, i, self.EnergyColor, true, 32, 0, 0.1, 0.015625, "trails/laser.vmt")
if CPPI then
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does CPPI come from ?
Also SetOwner is in vanilla gmod so you want to call that regardless of CPPI

@@ -0,0 +1,209 @@
include("shared.lua")
local tag = "prop_vehicle_crawler"
local Ride_Height = 33
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for constants should be CAPITAL_SNAKE_CASE

self.Wheel:SetAngles(self:LocalToWorldAngles(Angle(self.vel_increment, 0, 0)))

--Wheel suspension
local Terrain_Distance = util.TraceHull({
Copy link
Owner

@Earu Earu Dec 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you using snake_case or PascalCase here? Please use snake_case consistently

mask = MASK_SOLID,
collisiongroup = COLLISION_GROUP_WEAPON
})
self.Wheel:SetPos(self:LocalToWorld(WHEEL_OFFSET + Vector(0, 0, Ride_Height_Visual- Terrain_Distance.Fraction * Ride_Height_Visual)))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some spaces missing between operators, put the files through a formatter / linter of some kind

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants