Advertisement
voxeltpt

Untitled

Jun 6th, 2021 (edited)
674
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.71 KB | None | 0 0
  1. robot = world:get_entity(4294967295)
  2. layer = 1
  3.  
  4. local cnt = 0
  5. function step(count)
  6.     if robot:get_layer() ~= layer then
  7.         --teleport back
  8.         local x,y = robot:get_position()
  9.         robot:warp(x, y, layer)
  10.         if cnt >= 1 then
  11.             --punish the player if he changes layer repeatedly
  12.             local hp, max_hp = robot:get_hp()
  13.             robot:damage(max_hp * 0.99)
  14.         end
  15.         cnt = cnt + 1
  16.         --show warning message
  17.         game:message("Don't change layers!")
  18.     end
  19. end
  20. function init()
  21.     --hide "Lua Script" object from the world
  22.     local luaObject = world:get_entity(this:get_id())
  23.     luaObject:hide()
  24.     luaObject:warp(9999999,9999999,(layer + 1)%4)
  25. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement