5 Commits
0.8 ... 1.0.0

Author SHA1 Message Date
85da5073b9 Version 1.0.0 2019-09-02 20:45:11 +02:00
d995fd381a Spawn egg: Make node on_rightclick take precedence 2019-08-25 18:47:10 +02:00
355aa1d40d Add mummy description field (CMI) 2019-08-25 18:21:12 +02:00
44482f6268 Add basic CMI support (experimental) 2019-08-25 18:04:16 +02:00
ae4fc9135c Add _cmi_is_mob 2019-08-25 17:35:56 +02:00
6 changed files with 71 additions and 11 deletions

View File

@ -1,6 +1,6 @@
# Pyramids (with Treasurer support) [`tsm_pyramids`]
* Version: 0.8
* Version: 1.0.0
## Description
This is a mod for Minetest Game which adds randomly spawned pyramids in deserts and

17
TODO Normal file
View File

@ -0,0 +1,17 @@
Minibugs:
- Mummy doesn't avoid lava
Features:
- More random rooms!
- Man statue
- Falling traps from above
- More variety in pyramid exterior styles
- Different entrances
- Stairs leading to entrance
- Open roof? For sun room
- Multiple entries (temple-like pyramids)
- Different pyramid sizes
- Damaged pyramids
- Missing blocks
- Trap stones
- No mummies, traps or treasures

View File

@ -6,6 +6,7 @@ Desert Sandstone with Cactus Engraving=
Desert Sandstone with Scarab Engraving=
Falling Cracked Sandstone Brick=
Falling Cracked Desert Sandstone Brick=
Mummy=
Mummy Spawn Egg=
Mummy Spawner=
Sandstone with Eye Engraving=

View File

@ -6,6 +6,7 @@ Desert Sandstone with Cactus Engraving=Wüstensandstein mit Kaktusgravur
Desert Sandstone with Scarab Engraving=Wüstensandstein mit Skarabäusgravur
Falling Cracked Sandstone Brick=Fallender rissiger Sandsteinziegel
Falling Cracked Desert Sandstone Brick=Fallender rissiger Wüstensandsteinziegel
Mummy=Mumie
Mummy Spawn Egg=Mumien-Spawn-Ei
Mummy Spawner=Mumien-Spawner
Sandstone with Eye Engraving=Sandstein mit Augengravur

View File

@ -1,4 +1,4 @@
name = tsm_pyramids
description = Pyramids with treasures! You can find them in deserts and sandstone deserts.
depends = default
optional_depends = farming, tnt, treasurer, doc_items, awards
optional_depends = farming, tnt, treasurer, doc_items, awards, cmi

View File

@ -1,5 +1,7 @@
local S = minetest.get_translator("tsm_pyramids")
local mod_cmi = minetest.get_modpath("cmi") ~= nil
local mummy_walk_limit = 1
local mummy_chillaxin_speed = 1
local mummy_animation_speed = 10
@ -91,6 +93,12 @@ local MUMMY_DEF = {
envdmg_timer = 0,
attacker = "",
attacking_timer = 0,
-- CMI stuff
-- Track last cause of damage for cmi.notify_die
last_damage_cause = { type = "unknown" },
_cmi_is_mob = true,
description = S("Mummy"),
}
local spawner_DEF = {
@ -128,7 +136,10 @@ spawner_DEF.on_punch = function(self, hitter)
end
MUMMY_DEF.on_activate = function(self)
MUMMY_DEF.on_activate = function(self, staticdata, dtime_s)
if mod_cmi then
cmi.notify_activate(self, dtime_s)
end
mummy_update_visuals_def(self)
self.anim = get_animations()
self.object:set_animation({x=self.anim.stand_START,y=self.anim.stand_END}, mummy_animation_speed, mummy_animation_blend)
@ -138,10 +149,18 @@ MUMMY_DEF.on_activate = function(self)
self.object:set_armor_groups({fleshy=130})
end
MUMMY_DEF.on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, dir)
MUMMY_DEF.on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, dir, damage)
if mod_cmi then
cmi.notify_punch(self, puncher, time_from_last_punch, tool_capabilities, dir, damage)
end
self.attacker = puncher
if damage > 0 then
self.last_damage = {
type = "punch",
puncher = puncher,
}
end
if puncher ~= nil then
minetest.sound_play(sound_hit, {pos = self.object:get_pos(), loop = false, max_hear_distance = 10, gain = 0.4})
if time_from_last_punch >= 0.45 then
@ -167,12 +186,15 @@ MUMMY_DEF.on_death = function(self, killer)
pos.y = pos.y + 1.0
minetest.add_item(pos, mummy_drop .. " " .. count)
end
if mod_cmi then
cmi.notify_die(self, self.last_damage)
end
end
local cnt1 = 0
local cnt2 = 0
MUMMY_DEF.on_step = function(self, dtime)
if mod_cmi then
cmi.notify_step(self, dtime)
end
self.timer = self.timer + 0.01
self.turn_timer = self.turn_timer + 0.01
self.jump_timer = self.jump_timer + 0.01
@ -186,9 +208,11 @@ MUMMY_DEF.on_step = function(self, dtime)
self.time_passed = 0
end
-- Environment damage
local def = minetest.registered_nodes[current_node.name]
local dps = def.damage_per_second
local dmg = 0
local dmg_node, dmg_pos
if dps ~= nil and dps > 0 then
dmg = dps
end
@ -210,6 +234,11 @@ MUMMY_DEF.on_step = function(self, dtime)
if self.envdmg_timer >= 1 then
self.envdmg_timer = 0
self.object:set_hp(self.object:get_hp()-dmg)
self.last_damage = {
type = "environment",
pos = current_pos,
node = current_node,
}
if self.object:get_hp() <= 0 then
if self.on_death then
self.on_death(self)
@ -341,11 +370,23 @@ minetest.register_craftitem("tsm_pyramids:spawn_egg", {
liquids_pointable = false,
stack_max = 99,
on_place = function(itemstack, placer, pointed_thing)
if pointed_thing.type == "node" then
minetest.add_entity(pointed_thing.above,"tsm_pyramids:mummy")
if not minetest.settings:get_bool("creative_mode") then itemstack:take_item() end
if pointed_thing.type ~= "node" then
return itemstack
end
-- am I clicking on something with existing on_rightclick function?
local node = minetest.get_node(pointed_thing.under)
if placer and not placer:get_player_control().sneak then
if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].on_rightclick then
return minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer, itemstack) or itemstack
end
end
minetest.add_entity(pointed_thing.above,"tsm_pyramids:mummy")
if not minetest.settings:get_bool("creative_mode") then
itemstack:take_item()
end
return itemstack
end,
})