goblin_tombstone.lua 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. core.register_entity('kobo:goblin_tombstone', {
  2. initial_properties = {
  3. visual = 'mesh',
  4. mesh = 'kobo_tombstone.obj',
  5. visual_size = {x=10, y=10},
  6. textures = {'kobo_tombstone.png'},
  7. physical = false,
  8. collisionbox = {-.125, -.5, -.125, .125, -.25, .125},
  9. },
  10. on_activate = function(self, staticdata, dtime_s)
  11. local data = core.deserialize(staticdata)
  12. if data then
  13. self.node_timer = data.node_timer
  14. end
  15. end,
  16. get_staticdata = function(self)
  17. local data = {}
  18. data.node_timer = self.node_timer
  19. return core.serialize(data)
  20. end,
  21. on_step = function(self, dtime, moveresults)
  22. self.node_timer = (self.node_timer or 0) + dtime
  23. if self.node_timer > 60 then
  24. self.object:remove()
  25. end
  26. end,
  27. on_punch = function(self, puncher)
  28. self.object:remove()
  29. end,
  30. --[[ on_rightclick = function(self, clicker)
  31. local player_name = clicker:get_player_name()
  32. core.show_formspec(player_name, 'kobo:goblin_debug', goblin_debug(self))
  33. end,
  34. ]]
  35. })