Skip to content

Commit 87ebb51

Browse files
Update sents_registry.lua (#3453)
* Update sents_registry.lua * change spaces to tabs, add painter/materializer * Add range duplicator param to painter/materializer * Add new lines, capitalize Range * Newlines --------- Co-authored-by: Astralcircle <[email protected]>
1 parent 2714230 commit 87ebb51

File tree

3 files changed

+50
-4
lines changed

3 files changed

+50
-4
lines changed

lua/entities/gmod_wire_materializer.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,4 @@ function ENT:ShowOutput(value)
5050
self:SetOverlayText("Material: " .. value)
5151
end
5252

53-
duplicator.RegisterEntityClass("gmod_wire_materializer", WireLib.MakeWireEnt, "Data", "Material")
53+
duplicator.RegisterEntityClass("gmod_wire_materializer", WireLib.MakeWireEnt, "Data", "Material", "Range")

lua/entities/gmod_wire_painter.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@ function ENT:ShowOutput(value)
4040
self:SetOverlayText("Decal: " .. value)
4141
end
4242

43-
duplicator.RegisterEntityClass("gmod_wire_painter", WireLib.MakeWireEnt, "Data", "Decal")
43+
duplicator.RegisterEntityClass("gmod_wire_painter", WireLib.MakeWireEnt, "Data", "Decal", "Range")

lua/wire/server/sents_registry.lua

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
-- register("gmod_foo_sent", {
1919
-- ["Model"] = {TYPE_STRING, "models/maxofs2d/button_05.mdl"},
2020
-- ["FooTable"] = {
21-
-- ["FooBool"] = {TYPE_BOOL, true}, ["FooNumber"] = {TYPE_NUMBER, 1}
21+
-- ["FooBool"] = {TYPE_BOOL, true}, ["FooNumber"] = {TYPE_NUMBER, 1}
2222
-- }
2323
-- })
2424
--
@@ -821,7 +821,41 @@ register("gmod_wire_gpulib_controller", {
821821
})
822822

823823
register("gmod_wire_clutch", {
824+
_preFactory = function(ply, self)
825+
-- Check if Pairs is a table of {Ent1, Ent2} pairs
826+
if not istable(self.Pairs) then return "'Pairs' must be a table!" end
827+
for k, v in ipairs(self.Pairs) do
828+
if #v ~= 2 then
829+
return ("'Pairs' entry #%d must be an array of 2 entries!"):format(k)
830+
end
831+
if not istable(v) or not IsValid(v[1]) or not IsValid(v[2]) then
832+
return ("'Pairs' entry #%d must be an array of valid entities!"):format(k)
833+
end
834+
if v[1] == v[2] then
835+
return ("'Pairs' entry #%d: Ent1 and Ent2 must be different entities!"):format(k)
836+
end
837+
if v[1]:IsPlayer() or v[2]:IsPlayer() then
838+
return ("'Pairs' entry #%d: Entities cannot be players!"):format(k)
839+
end
840+
if v[1]:IsNPC() or v[2]:IsNPC() then
841+
return ("'Pairs' entry #%d: Entities cannot be NPCs!"):format(k)
842+
end
843+
if GetOwner(v[1]) ~= ply or GetOwner(v[2]) ~= ply then
844+
return ("'Pairs' entry #%d: You do not own entities!"):format(k)
845+
end
846+
end
847+
end,
848+
_postFactory = function(ply, self, enttbl)
849+
PrintMessage(HUD_PRINTCONSOLE, type(self) .. ", " .. type(enttbl))
850+
PrintMessage(HUD_PRINTCONSOLE, tostring(self))
851+
PrintMessage(HUD_PRINTCONSOLE, tostring(enttbl))
852+
for _, v in ipairs(enttbl.Pairs) do
853+
self:AddClutch(v[1], v[2])
854+
end
855+
end,
856+
824857
["Model"] = {TYPE_STRING, "models/jaanus/wiretool/wiretool_siren.mdl", "Path to model"},
858+
["Pairs"] = {TYPE_TABLE, {}, "A table of arrays/tables, where each holds exactly 2 valid, non-player, non-NPC entities."},
825859
})
826860

827861
register("gmod_wire_input", {
@@ -1202,7 +1236,7 @@ register("gmod_wire_value", {
12021236
end,
12031237

12041238
["Model"] = {TYPE_STRING, "models/kobilica/value.mdl", "Path to model"},
1205-
["value"] = {TYPE_TABLE, {}, "Values to be stored. Can either be direct value (type will be auto found), array of direct values (types will be auto found), or sequential table of arrays with arr[1]==type, arr[2]==value. (Ex. - \"value\" = table(\n array(\"VECTOR\", vec(25)), array(\"string\", \"foo\")))"},
1239+
["value"] = {TYPE_TABLE, {}, "Values to be stored. Can either be direct value (type will be auto found), array of direct values (types will be auto found), or sequential table of arrays with arr[1]==type, arr[2]==value. (Ex. - \"value\" = table(\n array(\"VECTOR\", vec(25)), array(\"string\", \"foo\")))"},
12061240
})
12071241

12081242
register("gmod_wire_adv_emarker", {
@@ -1271,3 +1305,15 @@ register("gmod_wire_gate", {
12711305
register("gmod_wire_freezer", {
12721306
["Model"] = {TYPE_STRING, "models/jaanus/wiretool/wiretool_siren.mdl", "Path to model"},
12731307
})
1308+
1309+
register("gmod_wire_painter", {
1310+
["Model"] = {TYPE_STRING, "models/jaanus/wiretool/wiretool_siren.mdl", "Path to model"},
1311+
["Decal"] = {TYPE_STRING, "Blood", "Decal name to use for painting"},
1312+
["Range"] = {TYPE_NUMBER, 2048, "Length of the paint beam"},
1313+
})
1314+
1315+
register("gmod_wire_materializer", {
1316+
["Model"] = {TYPE_STRING, "models/jaanus/wiretool/wiretool_siren.mdl", "Path to model"},
1317+
["Material"] = {TYPE_STRING, "debug/env_cubemap_model", "Default material"},
1318+
["Range"] = {TYPE_NUMBER, 2048, "Length of the materializer beam"},
1319+
})

0 commit comments

Comments
 (0)