Add files via upload
parent
c67da18d14
commit
f87554fdb2
|
@ -0,0 +1,16 @@
|
|||
minetest.register_craftitem("vexcazer:item", {
|
||||
description = "Item",
|
||||
inventory_image = "vexcazer_controler.png",
|
||||
groups = {not_in_creative_inventory=1}})
|
||||
minetest.register_node("vexcazer:block", {
|
||||
description = "Block",
|
||||
tiles = {"default_cloud.png^[colorize:#19ffd6FF"},
|
||||
groups = {not_in_creative_inventory=1}})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "vexcazer:mod",
|
||||
recipe = {{"vexcazer:mod"},},replacements = {{"vexcazer:mod", "vexcazer:controler"}}})
|
||||
minetest.register_craft({
|
||||
output = "vexcazer:admin",
|
||||
recipe = {{"vexcazer:admin"},},replacements = {{"vexcazer:admin", "vexcazer:controler"}}})
|
||||
|
|
@ -0,0 +1,295 @@
|
|||
vexcazer.bot_use=function(itemstack, user, pos,dir,input)
|
||||
local plus=1
|
||||
local minus=-1
|
||||
local param=0
|
||||
dir = minetest.dir_to_facedir(dir)
|
||||
if dir==1 then param=minetest.get_node({x=pos.x-1,y=pos.y,z=pos.z}).param2 end
|
||||
if dir==3 then param=minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z}).param2 end
|
||||
if dir==0 then param=minetest.get_node({x=pos.x,y=pos.y,z=pos.z-1}).param2 end
|
||||
if dir==2 then param=minetest.get_node({x=pos.x,y=pos.y,z=pos.z+1}).param2 end
|
||||
local node={name=input.lazer,param2=param}
|
||||
local p=pos
|
||||
minetest.sound_play("vexcazer_lazer", {pos=p, gain=1.0, max_hear_distance=5})
|
||||
for i=1,input.max_amount,1 do
|
||||
vexcazer.lazer_damage(p,input)
|
||||
if vexcazer.place({pos=p,node=node},input)==true then
|
||||
if dir==1 then p.x=p.x+plus end
|
||||
if dir==3 then p.x=p.x+minus end
|
||||
if dir==0 then p.z=p.z+plus end
|
||||
if dir==2 then p.z=p.z+minus end
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
return itemstack
|
||||
end
|
||||
|
||||
vexcazer.registry_mode({
|
||||
wear_on_use=1,
|
||||
wear_on_place=3,
|
||||
name="PlaceDig xz",
|
||||
info="Both using the stack and count on left\n\nUSE with blocks = place blocks\nUSE with blocks on a wall = place blocks backwards\nUSE without blocks = shoot lazer\nPLACE blocks or items = dig\nUSE with blocks, and a block\nis backside the pointed = use same rotation",
|
||||
info_admin="\nAdmin/mod info, works in other modes\nPLACE when the left stack is empty = lazerwave",
|
||||
info_mod="\nAdmin/mod info, works in other modes\nPLACE when the left stack is empty = lazerwave",
|
||||
|
||||
on_place=function(itemstack, user, pointed_thing,input)
|
||||
if pointed_thing.type~="node" then return itemstack end
|
||||
local pos=pointed_thing.under
|
||||
local dir = minetest.dir_to_facedir(user:get_look_dir())
|
||||
local count=user:get_inventory():get_stack("main", input.index-1):get_count()
|
||||
if count==0 then return false end
|
||||
minetest.sound_play("vexcazer_dig", {pos = user:getpos(), gain = 1.0, max_hear_distance = 5,})
|
||||
for i=1,input.max_amount,1 do
|
||||
if count>0 then
|
||||
if vexcazer.dig(pos,input)==false then
|
||||
return itemstack
|
||||
end
|
||||
count=count-1
|
||||
else
|
||||
return itemstack
|
||||
end
|
||||
if dir==1 then pos.x=pos.x+1 end
|
||||
if dir==3 then pos.x=pos.x-1 end
|
||||
if dir==0 then pos.z=pos.z+1 end
|
||||
if dir==2 then pos.z=pos.z-1 end
|
||||
end
|
||||
return itemstack
|
||||
end,
|
||||
|
||||
on_use = function(itemstack, user, pointed_thing,input)
|
||||
if pointed_thing.type~="node" then return itemstack end
|
||||
local pos=pointed_thing.above
|
||||
local plus=1
|
||||
local minus=-1
|
||||
local dir = minetest.dir_to_facedir(user:get_look_dir())
|
||||
|
||||
local n=minetest.registered_nodes[minetest.get_node(pointed_thing.under).name]
|
||||
|
||||
if n and n.buildable_to then
|
||||
pos=pointed_thing.under
|
||||
end
|
||||
if pointed_thing.above.y==pointed_thing.under.y then
|
||||
plus=-1 minus=1
|
||||
end
|
||||
local param=0
|
||||
local lazer=false
|
||||
if dir==1 then param=minetest.get_node({x=pos.x-1,y=pos.y,z=pos.z}).param2 end
|
||||
if dir==3 then param=minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z}).param2 end
|
||||
if dir==0 then param=minetest.get_node({x=pos.x,y=pos.y,z=pos.z-1}).param2 end
|
||||
if dir==2 then param=minetest.get_node({x=pos.x,y=pos.y,z=pos.z+1}).param2 end
|
||||
local name=user:get_inventory():get_stack("main", input.index-1):get_name()
|
||||
local count=user:get_inventory():get_stack("main", input.index-1):get_count()
|
||||
local node={name=name,param2=param}
|
||||
local lazercount=0
|
||||
if minetest.registered_nodes[name]==nil then
|
||||
node.name=input.lazer
|
||||
count=input.max_amount
|
||||
lazer=true
|
||||
minetest.sound_play("vexcazer_lazer", {pos =user:getpos(), gain = 1.0, max_hear_distance = 5,})
|
||||
else
|
||||
minetest.sound_play("vexcazer_place", {pos =user:getpos(), gain = 1.0, max_hear_distance = 5,})
|
||||
end
|
||||
for i=1,input.max_amount,1 do
|
||||
if lazer then
|
||||
vexcazer.lazer_damage(pos,input)
|
||||
end
|
||||
if count<=0 then return false end
|
||||
if vexcazer.place({pos=pos,node=node},input)==true then
|
||||
count=count-1
|
||||
if dir==1 then pos.x=pos.x+plus end
|
||||
if dir==3 then pos.x=pos.x+minus end
|
||||
if dir==0 then pos.z=pos.z+plus end
|
||||
if dir==2 then pos.z=pos.z+minus end
|
||||
else
|
||||
if lazer then minetest.chat_send_player(input.user:get_player_name(),"<vexcazer> " ..lazercount) end
|
||||
return false
|
||||
end
|
||||
lazercount=lazercount+1
|
||||
end
|
||||
if lazer then minetest.chat_send_player(input.user:get_player_name(),"<vexcazer> " ..lazercount) end
|
||||
return itemstack
|
||||
end
|
||||
})
|
||||
|
||||
local replace=function(itemstack, user, pointed_thing,input)
|
||||
if pointed_thing.type~="node" then return itemstack end
|
||||
local pos=pointed_thing.under
|
||||
local stack=user:get_inventory():get_stack("main", input.index-1):get_name()
|
||||
local stack_count=user:get_inventory():get_stack("main",input.index-1):get_count()
|
||||
local replace=user:get_inventory():get_stack("main", input.index+1):get_name()
|
||||
local replace_count=user:get_inventory():get_stack("main", input.index+1):get_count()
|
||||
local dir = minetest.dir_to_facedir(user:get_look_dir())
|
||||
local lazer=false
|
||||
local invert=false
|
||||
|
||||
if minetest.registered_nodes[stack]==nil then
|
||||
stack="air"
|
||||
stack_count=input.max_amount
|
||||
end
|
||||
if minetest.registered_nodes[replace]==nil then
|
||||
replace=input.lazer
|
||||
replace_count=input.max_amount
|
||||
lazer=true
|
||||
minetest.sound_play("vexcazer_lazer", {pos = user:getpos(), gain = 1.0, max_hear_distance = 5,})
|
||||
end
|
||||
|
||||
|
||||
|
||||
if input.on_place then
|
||||
invert=true
|
||||
if lazer==false then minetest.sound_play("vexcazer_dig", {pos = user:getpos(), gain = 1.0, max_hear_distance =5,}) end
|
||||
else
|
||||
if lazer==false then minetest.sound_play("vexcazer_place", {pos = user:getpos(), gain = 1.0, max_hear_distance =5,}) end
|
||||
end
|
||||
if ((replace_count<stack_count and replace_count<input.max_amount)) and input.admin==false then
|
||||
minetest.chat_send_player(input.user:get_player_name(),"You need more to repalce with (or empty slot = air)")
|
||||
return false
|
||||
end
|
||||
for i=1,input.max_amount,1 do
|
||||
if stack_count<=0 then return false end
|
||||
if lazer then
|
||||
vexcazer.lazer_damage(pos,input)
|
||||
end
|
||||
if vexcazer.replace({pos=pos, stack=stack,replace=replace,invert=invert},input)==true then
|
||||
stack_count=stack_count-1
|
||||
if dir==1 then pos.x=pos.x+1 end
|
||||
if dir==3 then pos.x=pos.x-1 end
|
||||
if dir==0 then pos.z=pos.z+1 end
|
||||
if dir==2 then pos.z=pos.z-1 end
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
vexcazer.registry_mode({
|
||||
wear_on_use=1,
|
||||
wear_on_place=2,
|
||||
name="Replace xz",
|
||||
info="USE using the stack and count on left and right\nPLACE using the stack and count on left\n\nUSE replace the left stack with the right\nPLACE dig evyerthing without the left stack",
|
||||
on_use=replace,
|
||||
on_place=replace
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
vexcazer.registry_mode({
|
||||
wear_on_use=1,
|
||||
wear_on_place=2,
|
||||
name="PlaceDig y",
|
||||
info="Both using the stack and count on left\n\nUSE with blocks = place upwards\nUSE with block on a celling = place downwards\nPLACE with blocks or items = dig downwards\nPLACE with blocks or items on a celling = dig upwards",
|
||||
|
||||
on_place=function(itemstack, user, pointed_thing,input)
|
||||
if pointed_thing.type~="node" then return itemstack end
|
||||
local pos=pointed_thing.under
|
||||
minetest.sound_play("diplazer_dig", {pos = input.user:getpos(), gain = 1.0, max_hear_distance = 5,})
|
||||
local stack_count=user:get_inventory():get_stack("main",input.index-1):get_count()
|
||||
local plus=-1
|
||||
if pointed_thing.above.y<pointed_thing.under.y then
|
||||
plus=1
|
||||
end
|
||||
minetest.sound_play("vexcazer_dig", {pos = user:getpos(), gain = 1.0, max_hear_distance =5,})
|
||||
for i=1,input.max_amount,1 do
|
||||
if stack_count<=0 then return false end
|
||||
if vexcazer.dig(pos,input)==true then
|
||||
stack_count=stack_count-1
|
||||
pos.y=pos.y+plus
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
return true
|
||||
end,
|
||||
|
||||
|
||||
on_use = function(itemstack, user, pointed_thing,input)
|
||||
if pointed_thing.type~="node" then return itemstack end
|
||||
local pos=pointed_thing.above
|
||||
if minetest.registered_nodes[minetest.get_node(pointed_thing.under).name].walkable==false and minetest.get_node(pointed_thing.under).name~="air" then
|
||||
pos=pointed_thing.under
|
||||
end
|
||||
local stack=user:get_inventory():get_stack("main", input.index-1):get_name()
|
||||
local stack_count=user:get_inventory():get_stack("main",input.index-1):get_count()
|
||||
local plus=1
|
||||
local lazer=false
|
||||
local lazercount=0
|
||||
if minetest.registered_nodes[stack]==nil then
|
||||
stack=input.lazer
|
||||
stack_count=input.max_amount
|
||||
lazer=true
|
||||
minetest.sound_play("vexcazer_lazer", {pos =user:getpos(), gain = 1.0, max_hear_distance = 5,})
|
||||
else
|
||||
minetest.sound_play("vexcazer_place", {pos = user:getpos(), gain = 1.0, max_hear_distance =5,})
|
||||
end
|
||||
if pointed_thing.under.y>pointed_thing.above.y then
|
||||
plus=-1
|
||||
end
|
||||
for i=1,input.max_amount,1 do
|
||||
if stack_count<=0 then return false end
|
||||
if lazer then
|
||||
vexcazer.lazer_damage(pos,input)
|
||||
end
|
||||
if vexcazer.place({pos=pos,node={name=stack}},input)==true then
|
||||
stack_count=stack_count-1
|
||||
pos.y=pos.y+plus
|
||||
else
|
||||
if lazer then minetest.chat_send_player(input.user:get_player_name(),"<vexcazer> " ..lazercount) end
|
||||
return false
|
||||
end
|
||||
lazercount=lazercount+1
|
||||
end
|
||||
if lazer then minetest.chat_send_player(input.user:get_player_name(),"<vexcazer> " ..lazercount) end
|
||||
return true
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
|
||||
vexcazer.registry_mode({
|
||||
wear_on_use=1,
|
||||
name="Autoswith",
|
||||
info="USE using all stacks and counts on\nthe hotbar until it hits a tool: from left to right",
|
||||
on_use = function(itemstack, user, pointed_thing,input)
|
||||
if pointed_thing.type~="node" then return itemstack end
|
||||
local pos=pointed_thing.above
|
||||
local max_amount=input.max_amount
|
||||
local dir = minetest.dir_to_facedir(user:get_look_dir())
|
||||
local plus=1
|
||||
local minus=-1
|
||||
minetest.sound_play("vexcazer_place", {pos = user:getpos(), gain = 1.0, max_hear_distance =5,})
|
||||
if minetest.registered_nodes[minetest.get_node(pointed_thing.under).name].walkable==false and minetest.get_node(pointed_thing.under).name~="air" then
|
||||
pos=pointed_thing.under
|
||||
end
|
||||
if pointed_thing.under.y==pointed_thing.above.y then
|
||||
plus=-1
|
||||
minus=1
|
||||
end
|
||||
for i=1,8,1 do
|
||||
if max_amount<=0 then return false end
|
||||
local stack=user:get_inventory():get_stack("main", i):get_name()
|
||||
local stack_count=user:get_inventory():get_stack("main",i):get_count()
|
||||
if stack=="" and i>1 then
|
||||
stack=input.lazer
|
||||
stack_count=1
|
||||
elseif (i==1 and stack=="") or (stack~="" and minetest.registered_nodes[stack]==nil) then
|
||||
|
||||
return false
|
||||
end
|
||||
for i=1,stack_count,1 do
|
||||
if max_amount<=0 then return false end
|
||||
if vexcazer.place({pos=pos,node={name=stack}},input)==true then
|
||||
if dir==1 then pos.x=pos.x+plus end
|
||||
if dir==3 then pos.x=pos.x+minus end
|
||||
if dir==0 then pos.z=pos.z+plus end
|
||||
if dir==2 then pos.z=pos.z+minus end
|
||||
else
|
||||
max_amount=0
|
||||
stack_count=0
|
||||
end
|
||||
max_amount=max_amount-1
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
})
|
|
@ -0,0 +1 @@
|
|||
default
|
|
@ -0,0 +1,506 @@
|
|||
vexcazer={enable_default=false,gui="",auto_ad_mod=false,max_amount={default=10,mod=15,admin=30},wear_use=65535/1000,range={default=10,mod=15,admin=15},registry_modes={},creative=minetest.setting_get("creative_mode"),pvp=minetest.setting_getbool("enable_pvp")}
|
||||
|
||||
--if minetest.PLAYER_MAX_HP_DEFAULT then
|
||||
-- minetest.PLAYER_MAX_HP_DEFAULT=100
|
||||
-- minetest.PLAYER_MAX_breath_DEFAULT=51
|
||||
--end
|
||||
|
||||
--minetest.register_on_joinplayer(function(player)
|
||||
-- player:set_properties({hp_max=20,breath_max=11})
|
||||
-- player:set_hp(20)
|
||||
-- player:set_breath(11)
|
||||
--end)
|
||||
|
||||
minetest.register_chatcommand("vexcazer", {
|
||||
params = "",
|
||||
description = "Vexcazer info",
|
||||
func = function(name, param)
|
||||
local version="8"
|
||||
local info={version=version,modes=0,functions=0,text=""}
|
||||
for i, func in pairs(vexcazer.registry_modes) do
|
||||
info.modes=i
|
||||
if func.on_place then info.functions=info.functions+1 end
|
||||
if func.on_use then info.functions=info.functions+1 end
|
||||
end
|
||||
minetest.chat_send_player(name, "<Vexcazer> Version: ".. info.version .." Modes: " .. info.modes .. " Functions: ".. info.functions)
|
||||
end
|
||||
})
|
||||
|
||||
vexcazer.registry_mode=function(a)
|
||||
a.name= a.name or "Mode"
|
||||
a.info= a.info or ""
|
||||
a.info_mod= a.info_mod or ""
|
||||
a.info_admin= a.info_admin or ""
|
||||
a.info_default= a.info_default or ""
|
||||
a.hide_mode_mod= a.hide_mode_mod or false
|
||||
a.hide_mode_admin= a.hide_mode_admin or false
|
||||
a.hide_mode_default= a.hide_mode_default or false
|
||||
a.wear_on_use= a.wear_on_use or 0
|
||||
a.wear_on_place= a.wear_on_place or 0
|
||||
a.disallow_damage_on_use= a.disallow_damage_on_use or false
|
||||
table.insert(vexcazer.registry_modes,a)
|
||||
end
|
||||
|
||||
vexcazer.use=function(itemstack, user, pointed_thing,input)
|
||||
|
||||
if user:get_luaentity() then
|
||||
local dir=user:get_look_dir()
|
||||
local pos=user:getpos()
|
||||
pos={x=pos.x+(dir.x)*2,y=pos.y+(dir.y)*2,z=pos.z+(dir.z)*2}
|
||||
vexcazer.bot_use(itemstack, user, pos,dir,input)
|
||||
return itemstack
|
||||
end
|
||||
|
||||
if (input.mod and minetest.check_player_privs(input.user_name, {vexcazer=true})==false) or (input.admin and minetest.check_player_privs(input.user_name, {vexcazer_ad=true})==false) then
|
||||
local tool=user:get_inventory():get_stack("main", input.index):get_name()
|
||||
itemstack:replace(nil)
|
||||
for i, player in pairs(minetest.get_connected_players()) do
|
||||
local p_n=player:get_player_name()
|
||||
if minetest.check_player_privs(p_n, {vexcazer=true})==true
|
||||
or minetest.check_player_privs(p_n, {vexcazer_ad=true})==true then
|
||||
minetest.chat_send_player(p_n,"<vexcazer> " .. input.user_name .." tryed to use an unallowed tool (" .. tool ..") ...removed from the inventory")
|
||||
end
|
||||
end
|
||||
minetest.chat_send_player(input.user_name,"<vexcazer:> You are unallowed to use this tool")
|
||||
return itemstack
|
||||
end
|
||||
|
||||
if input.admin then
|
||||
user:set_properties({hp_max=100,breath_max=51})
|
||||
user:set_hp(100)
|
||||
user:set_breath(51)
|
||||
end
|
||||
|
||||
--if input.mod then
|
||||
-- user:set_properties({hp_max=50,breath_max=51})
|
||||
--end
|
||||
|
||||
if pointed_thing.type=="object" and not (pointed_thing.ref:get_luaentity() or pointed_thing.ref:is_player()) then
|
||||
pointed_thing.ref:set_hp(0)
|
||||
pointed_thing.ref:punch(pointed_thing.ref,1,{full_punch_interval=1,damage_groups={fleshy=9999}})
|
||||
return itemstack
|
||||
end
|
||||
|
||||
if pointed_thing.type=="node" and (minetest.get_node(pointed_thing.under)==nil or minetest.get_node(pointed_thing.above)==nil) then return itemstack end
|
||||
|
||||
if pointed_thing.type=="node" and (not minetest.registered_nodes[minetest.get_node(pointed_thing.under).name]) then
|
||||
minetest.set_node(pointed_thing.under, {name="air"})
|
||||
return itemstack
|
||||
end
|
||||
|
||||
local key=user:get_player_control()
|
||||
input.itemstack=itemstack
|
||||
|
||||
|
||||
input.mode=vexcazer.set_mode({user=user,add=1,index=input.index,get_mode=true})
|
||||
if input.mode==0 then key.sneak=true end
|
||||
if key.aux1 then
|
||||
vexcazer.form_update(user,input.index)
|
||||
return itemstack
|
||||
elseif key.sneak and input.on_use then
|
||||
return vexcazer.set_mode({user=user,add=1,index=input.index},itemstack)
|
||||
elseif key.sneak and input.on_place then
|
||||
return vexcazer.set_mode({user=user,add=-1,index=input.index},itemstack)
|
||||
end
|
||||
|
||||
if input.on_place and input.default==false and pointed_thing.type=="node"
|
||||
and user:get_inventory():get_stack("main", input.index-1):get_name()==""
|
||||
and not (vexcazer.registry_modes[input.mode] and vexcazer.registry_modes[input.mode].disallow_damage_on_use) then
|
||||
vexcazer.lazer_damage(pointed_thing.above,input,5)
|
||||
minetest.sound_play("vexcazer_lazer", {pos=pointed_thing.above, gain = 1.0, max_hear_distance = 7,})
|
||||
end
|
||||
|
||||
if pointed_thing.type=="object" and not (input.on_use and vexcazer.registry_modes[input.mode] and vexcazer.registry_modes[input.mode].disallow_damage_on_use) then
|
||||
local ob=pointed_thing.ref
|
||||
if ob:is_player() then
|
||||
local is_mod=minetest.check_player_privs(ob:get_player_name(), {vexcazer=true})==true
|
||||
local is_admin=minetest.check_player_privs(ob:get_player_name(), {vexcazer_ad=true})==true
|
||||
if not(ob:is_player() and ((vexcazer.pvp==false and input.default) or (ob:get_player_name()==input.user_name))
|
||||
or (input.default and (is_mod or is_admin))) then
|
||||
if input.mod or input.default then
|
||||
if input.mod then ob:set_hp(ob:get_hp()-10) end
|
||||
ob:punch(user,1,{full_punch_interval=1,damage_groups={fleshy=10}})
|
||||
else
|
||||
ob:set_hp(0)
|
||||
ob:punch(user,1,{full_punch_interval=1,damage_groups={fleshy=9999}})
|
||||
end
|
||||
minetest.sound_play("vexcazer_lazer", {pos =ob:getpos(), gain = 1.0, max_hear_distance = 7,})
|
||||
end
|
||||
else
|
||||
if input.mod or input.default then
|
||||
ob:punch(ob,1,{full_punch_interval=1,damage_groups={fleshy=10}})
|
||||
minetest.sound_play("vexcazer_lazer", {pos =ob:getpos(), gain = 1.0, max_hear_distance = 7,})
|
||||
else
|
||||
minetest.sound_play("vexcazer_lazer", {pos =ob:getpos(), gain = 1.0, max_hear_distance = 10,})
|
||||
ob:set_hp(0)
|
||||
ob:punch(ob,1,{full_punch_interval=1,damage_groups={fleshy=9999}})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if vexcazer.auto_ad_mod==true and (vexcazer.creative=="true" or minetest.check_player_privs(input.user_name, {give=true})==true or minetest.check_player_privs(input.user_name, {creative=true})==true) then
|
||||
input.creative=true
|
||||
else
|
||||
input.creative=false
|
||||
end
|
||||
|
||||
if key.LMB and key.RMB and (input.admin or input.mod) then
|
||||
local pos=user:getpos()
|
||||
pointed_thing.under={x=pos.x,y=pos.y-1,z=pos.z}
|
||||
pointed_thing.above={x=pos.x,y=pos.y-0.5,z=pos.z}
|
||||
pointed_thing.type="node"
|
||||
end
|
||||
|
||||
if input.on_use and vexcazer.registry_modes[input.mode] and vexcazer.registry_modes[input.mode].on_use then
|
||||
if not vexcazer.wear(itemstack,input,vexcazer.registry_modes[input.mode].wear_on_use) then return itemstack end
|
||||
input.mode_name=vexcazer.registry_modes[input.mode].name
|
||||
return vexcazer.registry_modes[input.mode].on_use(itemstack, user, pointed_thing,input)
|
||||
elseif input.on_place and vexcazer.registry_modes[input.mode] and vexcazer.registry_modes[input.mode].on_place then
|
||||
if not vexcazer.wear(itemstack,input,vexcazer.registry_modes[input.mode].wear_on_place) then return itemstack end
|
||||
input.mode_name=vexcazer.registry_modes[input.mode].name
|
||||
return vexcazer.registry_modes[input.mode].on_place(itemstack, user, pointed_thing,input)
|
||||
else
|
||||
input.set=1
|
||||
vexcazer.set_mode(input,itemstack)
|
||||
end
|
||||
return itemstack
|
||||
end
|
||||
|
||||
|
||||
vexcazer.set_mode=function(input,itstack) -- {user,add,set,index}
|
||||
if input.index==nil then return false end
|
||||
local itemstack=input.user:get_inventory():get_stack("main", input.index)
|
||||
local item=itemstack:to_table()
|
||||
local meta=minetest.deserialize(item.metadata)
|
||||
if input.get_mode and meta~=nil then
|
||||
return meta.mode
|
||||
elseif input.get_mode and meta==nil then
|
||||
return 0
|
||||
end
|
||||
local wear=itemstack:get_wear()
|
||||
|
||||
if meta==nil then
|
||||
meta={mode=0}
|
||||
vexcazer.new_user(input.user,input.index)
|
||||
end
|
||||
local mode=(meta.mode)
|
||||
|
||||
if input.set then
|
||||
mode=input.set
|
||||
else
|
||||
mode=mode+input.add
|
||||
end
|
||||
|
||||
if vexcazer.registry_modes[mode]==nil and input.add<=0 then
|
||||
mode=#vexcazer.registry_modes
|
||||
end
|
||||
if vexcazer.registry_modes[mode]==nil then mode=1 end
|
||||
meta.mode=mode
|
||||
item.metadata=minetest.serialize(meta)
|
||||
item.meta=minetest.serialize(meta)
|
||||
item.wear=wear
|
||||
minetest.sound_play("vexcazer_mode", {pos=input.user:getpos(), gain = 2.0, max_hear_distance = 3,})
|
||||
minetest.chat_send_player(input.user:get_player_name(),"Mode" .. mode ..": " .. vexcazer.registry_modes[mode].name)
|
||||
if itstack then
|
||||
itstack:replace(item)
|
||||
return itemstack
|
||||
else
|
||||
input.user:get_inventory():set_stack("main", input.index,item)
|
||||
end
|
||||
end
|
||||
|
||||
vexcazer.save=function(input,string,value,global)
|
||||
local item=input.itemstack:to_table()
|
||||
local meta = minetest.deserialize(item["metadata"])
|
||||
if meta==nil then meta={} end
|
||||
meta[input.mode_name .."."..string]=value
|
||||
item.metadata=minetest.serialize(meta)
|
||||
item.meta=minetest.serialize(meta)
|
||||
if global then
|
||||
input.user:get_inventory():set_stack("main", input.index,item)
|
||||
else
|
||||
input.itemstack:replace(item)
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
vexcazer.load=function(input,string)
|
||||
local item=input.itemstack:to_table()
|
||||
local meta = minetest.deserialize(item["metadata"])
|
||||
if meta==nil then return nil end
|
||||
return meta[input.mode_name .."."..string]
|
||||
end
|
||||
|
||||
vexcazer.form_update=function(user,index,info)
|
||||
|
||||
local name=user:get_player_name()
|
||||
local pre=""
|
||||
if info==nil then info="" end
|
||||
|
||||
local gui="" ..
|
||||
"size[12,8]" ..
|
||||
"background[-0.2,-0.2;12.4,8.6;gui_formbg.png]"..
|
||||
"background[-0.2,-0.2;5.4,8.6;gui_hb_bg.png]"..
|
||||
"field[5,0;0,0;index;;" .. index.."]"
|
||||
|
||||
local inv = user:get_inventory()
|
||||
for i=1,3,1 do
|
||||
inv:set_stack(name.."_vexcazer_inv",i,nil)
|
||||
end
|
||||
local item1=inv:get_stack("main",index-1):get_name()
|
||||
local item2=inv:get_stack("main",index+1):get_name()
|
||||
local item1c=inv:get_stack("main",index-1):get_count()
|
||||
local item2c=inv:get_stack("main",index+1):get_count()
|
||||
local tool=inv:get_stack("main",index):get_name()
|
||||
local vex={default=false,mod=false,admin=false}
|
||||
|
||||
if tool=="vexcazer:default" then
|
||||
vex.default=true
|
||||
if item1c>vexcazer.max_amount.default then item1c=vexcazer.max_amount.default end
|
||||
if item2c>vexcazer.max_amount.default then item2c=vexcazer.max_amount.default end
|
||||
elseif tool=="vexcazer:mod" then
|
||||
vex.mod=true
|
||||
if item1c>vexcazer.max_amount.mod then item1c=vexcazer.max_amount.mod end
|
||||
if item2c>vexcazer.max_amount.mod then item2c=vexcazer.max_amount.mod end
|
||||
elseif tool=="vexcazer:admin" then
|
||||
vex.admin=true
|
||||
if item1c>vexcazer.max_amount.admin then item1c=vexcazer.max_amount.admin end
|
||||
if item2c>vexcazer.max_amount.admin then item2c=vexcazer.max_amount.admin end
|
||||
end
|
||||
|
||||
if vex.admin or vex.mod then
|
||||
pre="\nPLACE+USE = use even if you pointing at nothing"
|
||||
end
|
||||
|
||||
|
||||
if item1c==0 then item1c="" end
|
||||
if item2c==0 then item2c="" end
|
||||
if info=="" then info=item1 .." " .. item1c .. "\n" .. item2 .." " .. item2c .. "\n\nIf you have a kayboard:\nSNEAK+USE = change modes frontwards\nSNEAK+PLACE = Change modes backwards\nRUN/AUX1+USE = Open this gui" .. pre .."\n\nThe controler is also a powerbank\nPut it in a power generator --> top slot to load it,\nput it under to load a vexcazer" end
|
||||
|
||||
if item1~="" and minetest.registered_nodes[item1] then
|
||||
item1="vexcazer:block ".. item1c
|
||||
elseif item1~="" and minetest.registered_nodes[item1]==nil then
|
||||
item1="vexcazer:item ".. item1c
|
||||
end
|
||||
if item2~="" and minetest.registered_nodes[item2] then
|
||||
item2="vexcazer:block ".. item2c
|
||||
elseif item2~="" and minetest.registered_nodes[item2]==nil then
|
||||
item2="vexcazer:item " ..item2c
|
||||
end
|
||||
|
||||
gui=gui .."item_image_button[7,0;1,1;".. item1 ..";name1;]"
|
||||
.."item_image_button[8,0;1,1;".. tool..";name2;]"
|
||||
.."item_image_button[9,0;1,1;" .. item2 ..";name3;]"
|
||||
|
||||
gui=gui .. "label[5.1,2;" .. info .."]"
|
||||
|
||||
local mb_posx=-0.1
|
||||
local mb_posy=-0.2
|
||||
|
||||
for i, func in pairs(vexcazer.registry_modes) do
|
||||
|
||||
if not (vex.default and func.hide_mode_default)
|
||||
and not (vex.mod and func.hide_mode_mod)
|
||||
and not (vex.admin and func.hide_mode_admin) then
|
||||
gui=gui .."button_exit[" ..mb_posx .."," .. mb_posy.. "; 2.5,1;m" .. i .."; ".. func.name.. " " .. i .. "]"
|
||||
gui=gui .."button_exit[" ..(mb_posx+2.2) .."," .. mb_posy.. "; 0.6,1;m" .. i .."info;?]"
|
||||
|
||||
mb_posx=mb_posx+2.6
|
||||
if mb_posx>=5 then
|
||||
mb_posy=mb_posy+0.6
|
||||
mb_posx=-0.1
|
||||
end
|
||||
end
|
||||
end
|
||||
minetest.after((0.1), function(gui)
|
||||
return minetest.show_formspec(name, "vexcazer_gui",gui)
|
||||
end, gui)
|
||||
end
|
||||
|
||||
minetest.register_on_player_receive_fields(function(player, form, pressed)
|
||||
if form=="vexcazer_gui" then
|
||||
local index=tonumber(pressed.index)
|
||||
for i=1,20,1 do
|
||||
if pressed["m" .. i]~=nil then
|
||||
return vexcazer.set_mode({index=index,user=player,add=0,set=i})
|
||||
end
|
||||
if pressed["m" .. i .."info"]~=nil then
|
||||
local moinf=""
|
||||
local adinf=""
|
||||
local deinf=""
|
||||
local item=player:get_inventory():get_stack("main",index):get_name()
|
||||
if item=="vexcazer:mod" and vexcazer.registry_modes[i].info_mod~="" then moinf="\n" .. vexcazer.registry_modes[i].info_mod
|
||||
elseif item=="vexcazer:admin" and vexcazer.registry_modes[i].info_admin~="" then adinf="\n" ..vexcazer.registry_modes[i].info_admin
|
||||
elseif item=="vexcazer:default" and vexcazer.registry_modes[i].info_default~="" then deinf="\n" ..vexcazer.registry_modes[i].info_default end
|
||||
return vexcazer.form_update(player,index,vexcazer.registry_modes[i].info .. deinf.. moinf .. adinf)
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
vexcazer.dig=function(pos,input,nolazer)-- pos,input
|
||||
if pos==nil then return false end
|
||||
if minetest.is_protected(pos,input.user_name) then
|
||||
minetest.chat_send_player(input.user_name, pos.x .."," .. pos.y .."," .. pos.z ..", is protected.")
|
||||
return true
|
||||
end
|
||||
local node=minetest.get_node(pos)
|
||||
local def=minetest.registered_nodes[node.name]
|
||||
if node.name=="air" or node.name=="ignore" then return true end
|
||||
if input.default and def~=nil and (def.drop=="" or def.unbreakable) then return false end
|
||||
if input.admin==false then
|
||||
minetest.node_dig(pos,node,input.user)
|
||||
if minetest.registered_nodes[minetest.get_node(pos).name].walkable==false then
|
||||
if nolazer then
|
||||
minetest.set_node(pos, {name="air"})
|
||||
else
|
||||
minetest.set_node(pos, {name=input.lazer})
|
||||
end
|
||||
end
|
||||
else
|
||||
if nolazer then
|
||||
minetest.set_node(pos, {name="air"})
|
||||
else
|
||||
minetest.set_node(pos, {name=input.lazer})
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
vexcazer.place=function(use,input)--{pos,node={name=name}},input
|
||||
if minetest.is_protected(use.pos, input.user:get_player_name()) then
|
||||
minetest.chat_send_player(input.user_name, use.pos.x .."," .. use.pos.y .."," .. use.pos.z ..", is protected.")
|
||||
return false
|
||||
end
|
||||
local fn = minetest.registered_nodes[minetest.get_node(use.pos).name]
|
||||
|
||||
|
||||
if fn~=nil and input.default and fn.drop=="" and fn.name:find("maptools:",1)~=nil then return false end
|
||||
if fn==nil then return false end
|
||||
|
||||
if fn.walkable==false then
|
||||
minetest.set_node(use.pos, use.node)
|
||||
if not (input.admin or input.creative) then
|
||||
input.user:get_inventory():remove_item("main", use.node.name)
|
||||
return true
|
||||
end
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
vexcazer.replace=function(use,input)--{pos,stack,replace,invert},input
|
||||
if minetest.is_protected(use.pos, input.user:get_player_name()) then
|
||||
minetest.chat_send_player(input.user_name, use.pos.x .."," .. use.pos.y .."," .. use.pos.z ..", is protected.")
|
||||
return false
|
||||
end
|
||||
local def=minetest.get_node(use.pos)
|
||||
|
||||
if use.invert==nil then use.invert=false end
|
||||
if input.default and def~=nil and (def.drop=="" or def.unbreakable) then return false end
|
||||
if (use.invert==false and def.name==use.stack) or (use.invert and def.name~=use.stack) then
|
||||
if input.admin==false then
|
||||
minetest.node_dig(use.pos,{name=def.name},input.user)
|
||||
if not input.creative then input.user:get_inventory():remove_item("main", use.replace) end
|
||||
end
|
||||
minetest.set_node(use.pos, {name=use.replace})
|
||||
|
||||
return true
|
||||
else
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
vexcazer.lazer_damage=function(pos,input,size)--pos,input,size
|
||||
if minetest.is_protected(pos, input.user_name) then
|
||||
return false
|
||||
end
|
||||
if size==nil then size=1 end
|
||||
local user=input.user
|
||||
for i, ob in pairs(minetest.get_objects_inside_radius(pos, size)) do
|
||||
if not (ob:is_player() and ((vexcazer.pvp==false and input.default)
|
||||
or (ob:get_player_name()==input.user_name))) then
|
||||
if type(user)=="table" then user=ob end
|
||||
if input.mod or input.default then
|
||||
ob:punch(user,1,{full_punch_interval=1,damage_groups={fleshy=10}})
|
||||
else
|
||||
ob:set_hp(0)
|
||||
ob:punch(ob,1,{full_punch_interval=1,damage_groups={fleshy=9999}})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
vexcazer.round=function(a)
|
||||
return math.floor(a+ 0.5)
|
||||
end
|
||||
|
||||
vexcazer.new_user=function(user,index)
|
||||
local inv=user:get_inventory()
|
||||
local name=user:get_player_name()
|
||||
local have_controler=false
|
||||
for i=0,32,1 do
|
||||
if inv:get_stack("main",i):get_name()=="vexcazer:controler" then
|
||||
have_controler=true
|
||||
break
|
||||
end
|
||||
end
|
||||
if not have_controler then
|
||||
inv:add_item("main", ItemStack("vexcazer:controler 1 65534"))
|
||||
minetest.chat_send_player(name,"<vexcazer> Use the controler to change modes or open the gui on the tool")
|
||||
end
|
||||
|
||||
minetest.chat_send_player(name,"<vexcazer> You can craft the tool with mese-crystal / fragments to reload")
|
||||
|
||||
|
||||
if vexcazer.auto_ad_mod==false then return end
|
||||
|
||||
|
||||
if inv:get_stack("main",index):get_name()=="vexcazer:default" then
|
||||
if minetest.check_player_privs(name, {vexcazer_ad=true})==true then
|
||||
for i=0,32,1 do
|
||||
if inv:get_stack("main",i):get_name()=="vexcazer:admin" then
|
||||
return
|
||||
end
|
||||
end
|
||||
inv:add_item("main", "vexcazer:admin")
|
||||
if minetest.get_modpath("vexcazer_adpick")~=nil then inv:add_item("main","vexcazer_adpick:pick") end
|
||||
minetest.chat_send_player(name,"<vexcazer> vexcazer for admins added to your inventory")
|
||||
elseif minetest.check_player_privs(name, {vexcazer=true})==true then
|
||||
for i=0,32,1 do
|
||||
if inv:get_stack("main",i):get_name()=="vexcazer:mod" then
|
||||
return
|
||||
end
|
||||
end
|
||||
inv:add_item("main","vexcazer:mod")
|
||||
if minetest.get_modpath("vexcazer_adpick")~=nil then inv:add_item("main","vexcazer_adpick:pick") end
|
||||
minetest.chat_send_player(name,"<vexcazer> vexcazer for moderators added to your inventory")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
vexcazer.wear=function(itemstack,input,wear)
|
||||
if input.default and input.creative==false then
|
||||
local use=itemstack:get_wear()+(vexcazer.wear_use*wear)
|
||||
if use>=65536 then
|
||||
minetest.chat_send_player(input.user_name,"<vexcazer> The power is end, and I need to be reloaded")
|
||||
return false
|
||||
elseif use<0 then
|
||||
use=1
|
||||
end
|
||||
itemstack:set_wear(use-1)
|
||||
end
|
||||
return itemstack
|
||||
end
|
||||
|
||||
dofile(minetest.get_modpath("vexcazer") .. "/stuff.lua")
|
||||
dofile(minetest.get_modpath("vexcazer") .. "/default_modes.lua")
|
||||
dofile(minetest.get_modpath("vexcazer") .. "/craft.lua")
|
||||
|
||||
minetest.register_alias("vex_ad", "vexcazer:admin")
|
||||
minetest.register_alias("vex_mod", "vexcazer:mod")
|
||||
minetest.register_alias("vex_def", "vexcazer:default")
|
||||
minetest.register_alias("vex_con", "vexcazer:controler")
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,196 @@
|
|||
minetest.register_privilege("vexcazer", {
|
||||
description = "Can use moderator vexcazer",
|
||||
give_to_singleplayer= false,
|
||||
})
|
||||
minetest.register_privilege("vexcazer_ad", {
|
||||
description = "Can use admin vexcazer",
|
||||
give_to_singleplayer= false,
|
||||
})
|
||||
|
||||
--minetest.register_abm({
|
||||
-- nodenames = {"group:vex_lazer" },
|
||||
-- interval = 1,
|
||||
-- chance = 2,
|
||||
-- action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
-- minetest.set_node(pos, {name="air"})
|
||||
-- end,
|
||||
--})
|
||||
|
||||
local colors={"FFFFFFFA","FF0000FA","ff009cFA"}
|
||||
local colora={{255,255,255} ,{255,0,0} ,{255,0,170}}
|
||||
for i=1,3,1 do
|
||||
minetest.register_node("vexcazer:lazer" ..i, {
|
||||
description = "Lazer",
|
||||
drawtype="glasslike",
|
||||
alpha=50,
|
||||
tiles = {"gui_hb_bg.png^[colorize:#" .. colors[i]},
|
||||
drop="",
|
||||
light_source = default.LIGHT_MAX - 1,
|
||||
paramtype = "light",
|
||||
walkable=false,
|
||||
sunlight_propagates = true,
|
||||
liquid_viscosity = 1,
|
||||
--pointable=false,
|
||||
buildable_to = true,
|
||||
groups = {not_in_creative_inventory=1,vex_lazer=1},
|
||||
post_effect_color = {a = 255, r=colora[i][1], g=colora[i][2], b=colora[i][3]},
|
||||
on_punch = function(pos, node, player, pointed_thing)
|
||||
minetest.get_node_timer(pos):start(1)
|
||||
end,
|
||||
on_timer=function(pos, elapsed)
|
||||
minetest.remove_node(pos)
|
||||
end,
|
||||
on_construct = function(pos)
|
||||
minetest.get_node_timer(pos):start(1)
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
minetest.register_tool("vexcazer:default", {
|
||||
description = "Vexcazer",
|
||||
range = vexcazer.range.default,
|
||||
inventory_image = "vexcazer_rifle_default.png",
|
||||
groups = {not_in_creative_inventory=1},
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
if not vexcazer.enable_default then
|
||||
itemstack:replace(nil)
|
||||
minetest.chat_send_player(user:get_player_name(),"<vexcazer> The tool is disabled")
|
||||
minetest.sound_play("vexcazer_error", {pos = user:getpos(), gain = 1.0, max_hear_distance = 15})
|
||||
return itemstack
|
||||
end
|
||||
vexcazer.use(itemstack, user, pointed_thing,{
|
||||
default=true,
|
||||
mod=false,
|
||||
admin=false,
|
||||
max_amount=vexcazer.max_amount.default,
|
||||
on_use=true,
|
||||
on_place=false,
|
||||
user=user,
|
||||
user_name=user:get_player_name(),
|
||||
index=user:get_wield_index(),
|
||||
lazer="vexcazer:lazer1"
|
||||
})
|
||||
return itemstack
|
||||
end,
|
||||
on_place=function(itemstack, user, pointed_thing)
|
||||
if not vexcazer.enable_default then
|
||||
itemstack:replace(nil)
|
||||
minetest.chat_send_player(user:get_player_name(),"<vexcazer> The tool is disabled")
|
||||
minetest.sound_play("vexcazer_error", {pos = user:getpos(), gain = 1.0, max_hear_distance = 15})
|
||||
return itemstack
|
||||
end
|
||||
vexcazer.use(itemstack, user, pointed_thing,{
|
||||
default=true,
|
||||
mod=false,
|
||||
admin=false,
|
||||
max_amount=vexcazer.max_amount.default,
|
||||
on_use=false,
|
||||
on_place=true,
|
||||
user=user,
|
||||
user_name=user:get_player_name(),
|
||||
index=user:get_wield_index(),
|
||||
lazer="vexcazer:lazer1"
|
||||
})
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_tool("vexcazer:mod", {
|
||||
description = "Vexcazer mod",
|
||||
range = vexcazer.range.mod,
|
||||
inventory_image = "vexcazer_rifle_mod.png",
|
||||
groups = {not_in_creative_inventory=1},
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
vexcazer.use(itemstack, user, pointed_thing,{
|
||||
default=false,
|
||||
mod=true,
|
||||
admin=false,
|
||||
max_amount=vexcazer.max_amount.mod,
|
||||
on_use=true,
|
||||
on_place=false,
|
||||
user=user,
|
||||
user_name=user:get_player_name(),
|
||||
index=user:get_wield_index(),
|
||||
lazer="vexcazer:lazer2"
|
||||
})
|
||||
return itemstack
|
||||
end,
|
||||
on_place=function(itemstack, user, pointed_thing)
|
||||
vexcazer.use(itemstack, user, pointed_thing,{
|
||||
default=false,
|
||||
mod=true,
|
||||
admin=false,
|
||||
max_amount=vexcazer.max_amount.mod,
|
||||
on_use=false,
|
||||
on_place=true,
|
||||
user=user,
|
||||
user_name=user:get_player_name(),
|
||||
index=user:get_wield_index(),
|
||||
lazer="vexcazer:lazer2"
|
||||
})
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_tool("vexcazer:admin", {
|
||||
description = "Vexcazer admin",
|
||||
range = vexcazer.range.admin,
|
||||
inventory_image = "vexcazer_rifle_admin.png",
|
||||
groups = {not_in_creative_inventory=1},
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
vexcazer.use(itemstack, user, pointed_thing,{
|
||||
default=false,
|
||||
mod=false,
|
||||
admin=true,
|
||||
max_amount=vexcazer.max_amount.admin,
|
||||
on_use=true,
|
||||
on_place=false,
|
||||
user=user,
|
||||
user_name=user:get_player_name(),
|
||||
index=user:get_wield_index(),
|
||||
lazer="vexcazer:lazer3"
|
||||
})
|
||||
return itemstack
|
||||
end,
|
||||
on_place=function(itemstack, user, pointed_thing)
|
||||
vexcazer.use(itemstack, user, pointed_thing,{
|
||||
default=false,
|
||||
mod=false,
|
||||
admin=true,
|
||||
max_amount=vexcazer.max_amount.admin,
|
||||
on_use=false,
|
||||
on_place=true,
|
||||
user=user,
|
||||
user_name=user:get_player_name(),
|
||||
index=user:get_wield_index(),
|
||||
lazer="vexcazer:lazer3"
|
||||
})
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_tool("vexcazer:controler", {
|
||||
description = "Vexcazer controler",
|
||||
range = 10,
|
||||
inventory_image = "vexcazer_controler.png",
|
||||
on_place = function(itemstack, user, pointed_thing)
|
||||
for i=1,8,1 do
|
||||
local stack=user:get_inventory():get_stack("main", i):get_name()
|
||||
if string.find(stack,"r:default",7) or string.find(stack,"r:mod",7) or string.find(stack,"r:admin",8) then
|
||||
vexcazer.form_update(user,i)
|
||||
return itemstack
|
||||
end
|
||||
end
|
||||
return itemstack
|
||||
end,
|
||||
on_use=function(itemstack, user, pointed_thing)
|
||||
for i=1,8,1 do
|
||||
local stack=user:get_inventory():get_stack("main", i):get_name()
|
||||
if string.find(stack,"r:default",7) or string.find(stack,"r:mod",7) or string.find(stack,"r:admin",8) then
|
||||
vexcazer.set_mode({user=user,add=1,index=i})
|
||||
return itemstack
|
||||
end
|
||||
end
|
||||
return itemstack
|
||||
end,
|
||||
})
|
Binary file not shown.
After Width: | Height: | Size: 253 B |
Binary file not shown.
After Width: | Height: | Size: 532 B |
Binary file not shown.
After Width: | Height: | Size: 531 B |
Binary file not shown.
After Width: | Height: | Size: 499 B |
Loading…
Reference in New Issue