Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- minetest.register_globalstep(function(dtime)
- stimer = stimer + dtime;
- if stimer >= 5 then
- stimer = 0;
- local players = minetest.get_connected_players();
- for _,player in pairs(players) do
- local name = player:get_player_name();
- local pos = player:getpos();
- local inspace=0; if pos.y>space_start then inspace = 1 end
- local inspace0=enviro_space[name];
- if inspace~=inspace0 then -- only adjust player enviroment ONLY if change occured ( earth->space or space->earth !)
- enviro_space[name] = inspace;
- enviro_adjust_physics(player);
- end
- if ENABLE_SPACE_EFFECTS and inspace==1 then -- special space code
- if pos.y<1500 and pos.y>1120 then
- local hp = player:get_hp();
- if hp>0 then
- minetest.chat_send_player(name,"WARNING: you entered DEADLY RADIATION ZONE");
- local privs = minetest.get_player_privs(name)
- if not privs.kick then player:set_hp(hp-15) end
- end
- return
- else
- local ppos = protector_position(pos);
- local populated = (minetest.get_node(ppos).name=="basic_protect:protector");
- if populated then
- if minetest.get_meta(ppos):get_int("space") == 1 then populated = false end
- end
- if not populated then -- do damage if player found not close to protectors
- local hp = player:get_hp();
- local privs = minetest.get_player_privs(name);
- if hp>0 and not privs.kick then
- player:set_hp(hp-10); -- dead in 20/10 = 2 events
- minetest.chat_send_player(name,"WARNING: in space you must stay close to spawn or protected areas");
- end
- end
- end
- end
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement