Advertisement
Guest User

Untitled

a guest
Jul 11th, 2018
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. minetest.register_globalstep(function(dtime)
  2. stimer = stimer + dtime;
  3. if stimer >= 5 then
  4. stimer = 0;
  5. local players = minetest.get_connected_players();
  6. for _,player in pairs(players) do
  7. local name = player:get_player_name();
  8. local pos = player:getpos();
  9. local inspace=0; if pos.y>space_start then inspace = 1 end
  10. local inspace0=enviro_space[name];
  11. if inspace~=inspace0 then -- only adjust player enviroment ONLY if change occured ( earth->space or space->earth !)
  12. enviro_space[name] = inspace;
  13. enviro_adjust_physics(player);
  14. end
  15.  
  16. if ENABLE_SPACE_EFFECTS and inspace==1 then -- special space code
  17.  
  18.  
  19. if pos.y<1500 and pos.y>1120 then
  20. local hp = player:get_hp();
  21.  
  22. if hp>0 then
  23. minetest.chat_send_player(name,"WARNING: you entered DEADLY RADIATION ZONE");
  24. local privs = minetest.get_player_privs(name)
  25. if not privs.kick then player:set_hp(hp-15) end
  26. end
  27. return
  28. else
  29.  
  30. local ppos = protector_position(pos);
  31. local populated = (minetest.get_node(ppos).name=="basic_protect:protector");
  32. if populated then
  33. if minetest.get_meta(ppos):get_int("space") == 1 then populated = false end
  34. end
  35.  
  36. if not populated then -- do damage if player found not close to protectors
  37. local hp = player:get_hp();
  38. local privs = minetest.get_player_privs(name);
  39. if hp>0 and not privs.kick then
  40. player:set_hp(hp-10); -- dead in 20/10 = 2 events
  41. minetest.chat_send_player(name,"WARNING: in space you must stay close to spawn or protected areas");
  42. end
  43. end
  44. end
  45.  
  46. end
  47. end
  48. end
  49. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement