Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local component = require("component")
- local os = require("os")
- local computer = require("computer")
- local event = require("event")
- local term = require("term")
- local c = component.chat_box
- local g = component.gpu
- local d = component.debug
- local n=5
- local cordx={-270,-268,-266,-264,-262}
- local cordy={5,5,5,5,5}
- local cordz={-66,-66,-66,-66,-66}
- local chest={1,2,3,4,5}
- local che=5
- function prov(i)
- if d.getWorld().getBlockId(cordx[i],cordy[i]-3,cordz[i])==35 then
- che=che-1
- chest[i]=-1
- if che==4 then
- c.say("Залишилось 4 сундука")
- end
- if che==3 then
- c.say("Залишилось 3 сундука")
- end
- if che==2 then
- c.say("Залишилось 2 сундука")
- end
- if che==1 then
- c.say("Залишився 1 сундук")
- end
- if che==0 then
- c.say("Сундуків нема!")
- os.sleep(10)
- for j=1,n do
- for k=1,27 do
- d.getWorld().removeItem(cordx[j],cordy[j],cordz[j],k)
- end
- d.getWorld().setBlock(cordx[j],cordy[j],cordz[j],0,0)
- end
- end
- os.sleep(3)
- end
- end
- function insert(i)
- local random=math.random(1,3)
- if (random==1) then
- d.getWorld().insertItem("customnpcs:npcEarthElement", 3, 0, "", cordx[i],cordy[i],cordz[i], 1)
- d.getWorld().insertItem("IC2:itemIngot", 2, 0, "", cordx[i],cordy[i],cordz[i], 1)
- d.getWorld().insertItem("minecraft:gold_ingot", 1, 0, "", cordx[i],cordy[i],cordz[i], 1)
- end
- if (random==2) then
- d.getWorld().insertItem("customnpcs:npcEarthElement", 2, 0, "", cordx[i],cordy[i],cordz[i], 1)
- d.getWorld().insertItem("minecraft:diamond", 2, 0, "", cordx[i],cordy[i],cordz[i], 1)
- d.getWorld().insertItem("minecraft:gold_ingot", 2, 0, "", cordx[i],cordy[i],cordz[i], 1)
- end
- if (random==3) then
- d.getWorld().insertItem("customnpcs:npcEarthElement", 1, 0, "", cordx[i],cordy[i],cordz[i], 1)
- d.getWorld().insertItem("minecraft:diamond", 1, 0, "", cordx[i],cordy[i],cordz[i], 1)
- d.getWorld().insertItem("IC2:itemIngot", 1, 0, "", cordx[i],cordy[i],cordz[i], 1)
- d.getWorld().insertItem("ender_pearl", 1, 0, "", cordx[i],cordy[i],cordz[i], 1)
- end
- end
- function spawn()
- for i=1,5 do
- d.getWorld().setBlock(cordx[i],cordy[i],cordz[i],146,0)
- d.getWorld().setBlock(cordx[i],cordy[i]-1,cordz[i],33,0)
- d.getWorld().setBlock(cordx[i],cordy[i]-2,cordz[i],35,0)
- d.getWorld().setBlock(cordx[i],cordy[i]-3,cordz[i],0,0)
- insert(i)
- end
- end
- spawn()
- while true do
- for i=1,n do
- flag=1
- for j=1,n do
- if i==chest[j] then
- flag =0
- end
- end
- if flag==0 then
- prov(i)
- end
- end
- if che ==0 then
- c.say("Закритие програмки")
- break
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement