From 7568a2b3fa16a1696809ba41ce777f23e77db6b0 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 10 Nov 2016 16:48:52 +0100 Subject: [PATCH] Add partial backwards-compability --- README.md | 5 ++++- init.lua | 14 ++++++++++++++ mummy.lua | 4 +++- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d775d36..68b2207 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,14 @@ * Version: 0.6 -## Using the mod +## Description This mod adds randomly spawned pyramids in deserts. The pyramids are very rare and contain a chest with stuff. Also there are mummys inside, which attack the player if found in their radius. +## For users of the old `pyramids` mod +This mod is a fork of the old `pyramids` mod by BlockMen and intended to be a direct +(but unofficial) successor of it. ## Licensing This program is free software. It comes without any warranty, to diff --git a/init.lua b/init.lua index 05d3511..fd38dfd 100644 --- a/init.lua +++ b/init.lua @@ -175,3 +175,17 @@ minetest.register_on_generated(function(minp, maxp, seed) minetest.after(0.8,make,p2) end end) + +-- Add backwards-compability for nodes from the original pyramids mod +if minetest.get_modpath("pyramids") == nil then + -- Nodes + minetest.register_alias("pyramids:trap", "tsm_pyramids:trap") + minetest.register_alias("pyramids:trap_2", "tsm_pyramids:trap_2") + minetest.register_alias("pyramids:deco_stone1", "tsm_pyramids:deco_stone1") + minetest.register_alias("pyramids:deco_stone2", "tsm_pyramids:deco_stone2") + minetest.register_alias("pyramids:deco_stone3", "tsm_pyramids:deco_stone3") + minetest.register_alias("pyramids:spawner_mummy", "tsm_pyramids:spawner_mummy") + + -- FIXME: Entities are currently NOT backwards-compatible + -- TODO: Update README when full backwards-compability is achieved +end diff --git a/mummy.lua b/mummy.lua index f78d3f1..02a3f5d 100644 --- a/mummy.lua +++ b/mummy.lua @@ -375,7 +375,9 @@ if not minetest.setting_getbool("only_peaceful_mobs") then if obj:is_player() then player_near = true else - if obj:get_luaentity().mob_name == "mummy" then mobs = mobs + 1 end + if obj:get_luaentity() and obj:get_luaentity().mob_name == "mummy" then + mobs = mobs + 1 + end end end if player_near then