|
18 | 18 | -- register("gmod_foo_sent", { |
19 | 19 | -- ["Model"] = {TYPE_STRING, "models/maxofs2d/button_05.mdl"}, |
20 | 20 | -- ["FooTable"] = { |
21 | | --- ["FooBool"] = {TYPE_BOOL, true}, ["FooNumber"] = {TYPE_NUMBER, 1} |
| 21 | +-- ["FooBool"] = {TYPE_BOOL, true}, ["FooNumber"] = {TYPE_NUMBER, 1} |
22 | 22 | -- } |
23 | 23 | -- }) |
24 | 24 | -- |
@@ -821,7 +821,41 @@ register("gmod_wire_gpulib_controller", { |
821 | 821 | }) |
822 | 822 |
|
823 | 823 | 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 | + |
824 | 857 | ["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."}, |
825 | 859 | }) |
826 | 860 |
|
827 | 861 | register("gmod_wire_input", { |
@@ -1202,7 +1236,7 @@ register("gmod_wire_value", { |
1202 | 1236 | end, |
1203 | 1237 |
|
1204 | 1238 | ["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\")))"}, |
1206 | 1240 | }) |
1207 | 1241 |
|
1208 | 1242 | register("gmod_wire_adv_emarker", { |
@@ -1271,3 +1305,15 @@ register("gmod_wire_gate", { |
1271 | 1305 | register("gmod_wire_freezer", { |
1272 | 1306 | ["Model"] = {TYPE_STRING, "models/jaanus/wiretool/wiretool_siren.mdl", "Path to model"}, |
1273 | 1307 | }) |
| 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