Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes Issue #1 #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions mod.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
name = shadowrealm
description = The realm of shadows contains many hidden horrors.
depends = mobs, default
optional_depends = nether
release = 3421
author = archfan7411
title = Shadow Realm
18 changes: 15 additions & 3 deletions realm.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

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
Expand All @@ -20,9 +30,11 @@ minetest.register_globalstep(function(dtime)
if not (timer >= 1) then return end
timer = 0
for _, player in pairs(minetest.get_connected_players()) do
local pos = player:get_pos()
if pos.y < -200 then
player:set_hp(player:get_hp()-1)
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
Expand Down