@@ -2,6 +2,7 @@ ENT.Type = "anim"
2
2
ENT .PrintName = " Crafting Table"
3
3
ENT .Author = " OPGman"
4
4
ENT .Spawnable = true
5
+ ENT .AdminOnly = true
5
6
ENT .Category = " Universal Crafting System"
6
7
7
8
function ENT :SetupDataTables ()
@@ -19,5 +20,54 @@ function ENT:GetData()
19
20
return CraftingTable [typ ]
20
21
end
21
22
23
+ properties .Add ( " ucschangetype" , {
24
+ MenuLabel = " Change Type" ,
25
+ Order = 1600 ,
26
+ PrependSpacer = true ,
27
+ MenuIcon = " icon16/brick_edit.png" ,
28
+ Filter = function ( self , ent , ply )
29
+ local allowed = {
30
+ [" ucs_table" ] = true ,
31
+ [" ucs_mineable" ] = true
32
+ }
33
+ return IsValid ( ent ) and allowed [ent :GetClass ()] and ply :IsAdmin ()
34
+ end ,
35
+ MenuOpen = function ( self , option , ent , tr )
36
+ local sub = option :AddSubMenu ()
37
+ local tbl = ent :GetClass () == " ucs_table" and CraftingTable or MineableEntity
38
+ for k ,v in pairs ( tbl ) do
39
+ local opt = sub :AddOption ( v .Name or " Invalid Type" , function ()
40
+ self :SetType ( ent , k )
41
+ end )
42
+ end
43
+ end ,
44
+ Action = function () end ,
45
+ SetType = function ( self , ent , typ )
46
+ self :MsgStart ()
47
+ net .WriteEntity ( ent )
48
+ net .WriteString ( typ )
49
+ self :MsgEnd ()
50
+ end ,
51
+ Receive = function ( self , len , ply )
52
+ if !ply :IsAdmin () then return end
53
+ local ent = net .ReadEntity ()
54
+ local typ = net .ReadString ()
55
+ local pos = ent :GetPos ()
56
+ local ang = ent :GetAngles ()
57
+ local class = ent :GetClass ()
58
+ ent :Remove ()
59
+
60
+ local e = ents .Create ( class )
61
+ e :SetPos ( pos )
62
+ e :SetAngles ( ang )
63
+ if class == " ucs_table" then
64
+ e :SetTableType ( typ )
65
+ else
66
+ e :SetMineableType ( typ )
67
+ end
68
+ e :Spawn ()
69
+ end
70
+ } )
71
+
22
72
local version = " 2.0"
23
73
print ( " Universal Crafting System v" .. version .. " by OPGman successfully loaded.\n " )
0 commit comments