Skip to content

Commit

Permalink
Changed some namespace names to pascal case
Browse files Browse the repository at this point in the history
  • Loading branch information
TwistedTail committed Jul 15, 2024
1 parent e140a60 commit c1ab687
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 20 deletions.
12 changes: 6 additions & 6 deletions lua/cfw/classes/contraption_sv.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- Contraptions are an object to refer to a collection of connected entities

CFW.contraptions = {}
CFW.classes.contraption = {}
CFW.Contraptions = {}
CFW.Classes.Contraption = {}

function CFW.createContraption()
local con = {
Expand All @@ -10,7 +10,7 @@ function CFW.createContraption()
color = ColorRand(50, 255)
}

setmetatable(con, CFW.classes.contraption)
setmetatable(con, CFW.Classes.Contraption)

con:Init()

Expand All @@ -26,12 +26,12 @@ do -- Contraption getters and setters
end

do -- Class def
local CLASS = CFW.classes.contraption
local CLASS = CFW.Classes.Contraption

CLASS.__index = CLASS

function CLASS:Init()
CFW.contraptions[self] = true
CFW.Contraptions[self] = true
hook.Run("cfw.contraption.created", self)
end

Expand Down Expand Up @@ -72,7 +72,7 @@ do -- Class def
hook.Run("cfw.contraption.removed", self)
end

CFW.contraptions[self] = nil
CFW.Contraptions[self] = nil
end

function CLASS:Defuse()
Expand Down
16 changes: 8 additions & 8 deletions lua/cfw/classes/family_sv.lua
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
-- Families are collections of parented entities, you know, parents... children...

CFW.classes.family = {}
CFW.families = {}
CFW.Classes.Family = {}
CFW.Families = {}

function CFW.classes.family.create(ancestor)
function CFW.Classes.Family.create(ancestor)
local fam = {
count = 0,
ents = {},
ancestor = ancestor,
color = ColorRand()
}

setmetatable(fam, CFW.classes.family)
setmetatable(fam, CFW.Classes.Family)

fam:Init()
fam:Add(ancestor)
Expand All @@ -20,10 +20,10 @@ function CFW.classes.family.create(ancestor)
end

do -- Class def
local CLASS = CFW.classes.family; CLASS.__index = CLASS
local CLASS = CFW.Classes.Family; CLASS.__index = CLASS

function CLASS:Init()
CFW.families[self] = true
CFW.Families[self] = true

hook.Run("cfw.family.created", self)
end
Expand All @@ -37,7 +37,7 @@ do -- Class def

hook.Run("cfw.family.deleted", self)

CFW.families[self] = nil
CFW.Families[self] = nil
end

function CLASS:Add(entity)
Expand Down Expand Up @@ -102,7 +102,7 @@ do
end

if not newFamily and next(self:GetChildren()) then
CFW.classes.family.create(self)
CFW.Classes.Family.create(self)
end
end

Expand Down
6 changes: 3 additions & 3 deletions lua/cfw/classes/link_sv.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
-- These are used to keep track of the number of connections between two entities
-- In graph theory these are edges

CFW.classes.link = {}
CFW.Classes.Link = {}

function CFW.createLink(a, b)
local indexA, indexB = a:EntIndex(), b:EntIndex()
Expand All @@ -22,13 +22,13 @@ function CFW.createLink(a, b)
a._links[indexB] = link
b._links[indexA] = link

setmetatable(link, CFW.classes.link)
setmetatable(link, CFW.Classes.Link)

return link:Init()
end

do -- Class def
local CLASS = CFW.classes.link
local CLASS = CFW.Classes.Link

CLASS.__index = CLASS -- why?

Expand Down
2 changes: 1 addition & 1 deletion lua/cfw/core/parenting_sv.lua
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ hook.Add("Initialize", "CFW", function()
if newParent._family then
self:SetFamily(newParent._family)
else
CFW.classes.family.create(newParent)
CFW.Classes.Family.create(newParent)
end
else
self:SetFamily(nil)
Expand Down
2 changes: 1 addition & 1 deletion lua/cfw/extensions/position_sv.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local CLASS = CFW.classes.contraption
local CLASS = CFW.Classes.Contraption
local VEC_0 = Vector(0, 0, 0)
local HUGE = math.huge

Expand Down
2 changes: 1 addition & 1 deletion lua/entities/gmod_wire_expression2/core/custom/cfw.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
E2Lib.RegisterExtension("contraption", true, "Enables interaction with Contraption Framework")

local function isValidContraption(c)
return CFW.contraptions[c] or false
return CFW.Contraptions[c] or false
end

do -- Datatype and operator
Expand Down

0 comments on commit c1ab687

Please sign in to comment.