diff --git a/lua/entities/gmod_wire_materializer.lua b/lua/entities/gmod_wire_materializer.lua index bf22685a0c..6eb58923a0 100644 --- a/lua/entities/gmod_wire_materializer.lua +++ b/lua/entities/gmod_wire_materializer.lua @@ -50,4 +50,4 @@ function ENT:ShowOutput(value) self:SetOverlayText("Material: " .. value) end -duplicator.RegisterEntityClass("gmod_wire_materializer", WireLib.MakeWireEnt, "Data", "Material") +duplicator.RegisterEntityClass("gmod_wire_materializer", WireLib.MakeWireEnt, "Data", "Material", "Range") diff --git a/lua/entities/gmod_wire_painter.lua b/lua/entities/gmod_wire_painter.lua index 99964a27b1..622b536b49 100644 --- a/lua/entities/gmod_wire_painter.lua +++ b/lua/entities/gmod_wire_painter.lua @@ -40,4 +40,4 @@ function ENT:ShowOutput(value) self:SetOverlayText("Decal: " .. value) end -duplicator.RegisterEntityClass("gmod_wire_painter", WireLib.MakeWireEnt, "Data", "Decal") +duplicator.RegisterEntityClass("gmod_wire_painter", WireLib.MakeWireEnt, "Data", "Decal", "Range") diff --git a/lua/wire/server/sents_registry.lua b/lua/wire/server/sents_registry.lua index f59104a79b..3306eab2d5 100644 --- a/lua/wire/server/sents_registry.lua +++ b/lua/wire/server/sents_registry.lua @@ -18,7 +18,7 @@ -- register("gmod_foo_sent", { -- ["Model"] = {TYPE_STRING, "models/maxofs2d/button_05.mdl"}, -- ["FooTable"] = { --- ["FooBool"] = {TYPE_BOOL, true}, ["FooNumber"] = {TYPE_NUMBER, 1} +-- ["FooBool"] = {TYPE_BOOL, true}, ["FooNumber"] = {TYPE_NUMBER, 1} -- } -- }) -- @@ -821,7 +821,41 @@ register("gmod_wire_gpulib_controller", { }) register("gmod_wire_clutch", { + _preFactory = function(ply, self) + -- Check if Pairs is a table of {Ent1, Ent2} pairs + if not istable(self.Pairs) then return "'Pairs' must be a table!" end + for k, v in ipairs(self.Pairs) do + if #v ~= 2 then + return ("'Pairs' entry #%d must be an array of 2 entries!"):format(k) + end + if not istable(v) or not IsValid(v[1]) or not IsValid(v[2]) then + return ("'Pairs' entry #%d must be an array of valid entities!"):format(k) + end + if v[1] == v[2] then + return ("'Pairs' entry #%d: Ent1 and Ent2 must be different entities!"):format(k) + end + if v[1]:IsPlayer() or v[2]:IsPlayer() then + return ("'Pairs' entry #%d: Entities cannot be players!"):format(k) + end + if v[1]:IsNPC() or v[2]:IsNPC() then + return ("'Pairs' entry #%d: Entities cannot be NPCs!"):format(k) + end + if GetOwner(v[1]) ~= ply or GetOwner(v[2]) ~= ply then + return ("'Pairs' entry #%d: You do not own entities!"):format(k) + end + end + end, + _postFactory = function(ply, self, enttbl) + PrintMessage(HUD_PRINTCONSOLE, type(self) .. ", " .. type(enttbl)) + PrintMessage(HUD_PRINTCONSOLE, tostring(self)) + PrintMessage(HUD_PRINTCONSOLE, tostring(enttbl)) + for _, v in ipairs(enttbl.Pairs) do + self:AddClutch(v[1], v[2]) + end + end, + ["Model"] = {TYPE_STRING, "models/jaanus/wiretool/wiretool_siren.mdl", "Path to model"}, + ["Pairs"] = {TYPE_TABLE, {}, "A table of arrays/tables, where each holds exactly 2 valid, non-player, non-NPC entities."}, }) register("gmod_wire_input", { @@ -1202,7 +1236,7 @@ register("gmod_wire_value", { end, ["Model"] = {TYPE_STRING, "models/kobilica/value.mdl", "Path to model"}, - ["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\")))"}, + ["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\")))"}, }) register("gmod_wire_adv_emarker", { @@ -1271,3 +1305,15 @@ register("gmod_wire_gate", { register("gmod_wire_freezer", { ["Model"] = {TYPE_STRING, "models/jaanus/wiretool/wiretool_siren.mdl", "Path to model"}, }) + +register("gmod_wire_painter", { + ["Model"] = {TYPE_STRING, "models/jaanus/wiretool/wiretool_siren.mdl", "Path to model"}, + ["Decal"] = {TYPE_STRING, "Blood", "Decal name to use for painting"}, + ["Range"] = {TYPE_NUMBER, 2048, "Length of the paint beam"}, +}) + +register("gmod_wire_materializer", { + ["Model"] = {TYPE_STRING, "models/jaanus/wiretool/wiretool_siren.mdl", "Path to model"}, + ["Material"] = {TYPE_STRING, "debug/env_cubemap_model", "Default material"}, + ["Range"] = {TYPE_NUMBER, 2048, "Length of the materializer beam"}, +})