forked from archfan7411/shadowrealm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
realm.lua
41 lines (35 loc) · 1.04 KB
/
realm.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
-- some random shadow realm things
realm = {}
-- If the nether mod is installed, inquire about nether player status.
local is_player_in_nether
if nether == nil then
is_player_in_nether = function (player)
return false
end
else
is_player_in_nether = nether.is_player_in_nether
end
local modstorage = minetest.get_mod_storage()
realm.is_gargantuan_defeated = modstorage:get_int("dead") == 1
realm.on_gargantuan_death = function()
minetest.chat_send_all("A Gargantuan, one of the servants of Cerdon, has been slain!")
realm.is_gargantuan_defeated = true
modstorage:set_int("dead", 1)
end
-- as long as gargantuan remains undefeated
local timer = 0
minetest.register_globalstep(function(dtime)
if not realm.is_gargantuan_defeated and dtime then
timer = timer + dtime
if not (timer >= 1) then return end
timer = 0
for _, player in pairs(minetest.get_connected_players()) do
if not is_player_in_nether(player) then
local pos = player:get_pos()
if ( pos.y < -200 ) then
player:set_hp(player:get_hp()-1)
end
end
end
end
end)