mirror of
http://repo.or.cz/minetest_pyramids/tsm_pyramids.git
synced 2025-06-29 14:40:53 +02:00
Compare commits
15 Commits
Author | SHA1 | Date | |
---|---|---|---|
61ebaab55e | |||
8a449ea8a8 | |||
0abcd7960a | |||
f5fef5118d | |||
0974de93e4 | |||
0629d3b6ed | |||
5e9cd77fdc | |||
1b3f948daa | |||
63572c5c23 | |||
2538680eea | |||
85da5073b9 | |||
d995fd381a | |||
355aa1d40d | |||
44482f6268 | |||
ae4fc9135c |
@ -1,6 +1,6 @@
|
|||||||
# Pyramids (with Treasurer support) [`tsm_pyramids`]
|
# Pyramids (with Treasurer support) [`tsm_pyramids`]
|
||||||
|
|
||||||
* Version: 0.8
|
* Version: 1.0.3
|
||||||
|
|
||||||
## Description
|
## Description
|
||||||
This is a mod for Minetest Game which adds randomly spawned pyramids in deserts and
|
This is a mod for Minetest Game which adds randomly spawned pyramids in deserts and
|
||||||
|
17
TODO
Normal file
17
TODO
Normal 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
|
5
init.lua
5
init.lua
@ -345,11 +345,6 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
minetest.log("verbose", "[tsm_pyramids] Pyramid not placed, no suitable surface. minp="..minetest.pos_to_string(minp))
|
minetest.log("verbose", "[tsm_pyramids] Pyramid not placed, no suitable surface. minp="..minetest.pos_to_string(minp))
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
-- Select the material type by the most prominent node type
|
|
||||||
-- E.g. if desert sand is most prominent, we place a desert sandstone pyramid
|
|
||||||
if sand_cnt_max_id then
|
|
||||||
sand = sands[sand_cnt_max_id]
|
|
||||||
end
|
|
||||||
if p2.y < PYRA_MIN_Y then
|
if p2.y < PYRA_MIN_Y then
|
||||||
minetest.log("info", "[tsm_pyramids] Pyramid not placed, too deep. p2="..minetest.pos_to_string(p2))
|
minetest.log("info", "[tsm_pyramids] Pyramid not placed, too deep. p2="..minetest.pos_to_string(p2))
|
||||||
return
|
return
|
||||||
|
@ -6,6 +6,7 @@ Desert Sandstone with Cactus Engraving=
|
|||||||
Desert Sandstone with Scarab Engraving=
|
Desert Sandstone with Scarab Engraving=
|
||||||
Falling Cracked Sandstone Brick=
|
Falling Cracked Sandstone Brick=
|
||||||
Falling Cracked Desert Sandstone Brick=
|
Falling Cracked Desert Sandstone Brick=
|
||||||
|
Mummy=
|
||||||
Mummy Spawn Egg=
|
Mummy Spawn Egg=
|
||||||
Mummy Spawner=
|
Mummy Spawner=
|
||||||
Sandstone with Eye Engraving=
|
Sandstone with Eye Engraving=
|
||||||
|
@ -6,6 +6,7 @@ Desert Sandstone with Cactus Engraving=Wüstensandstein mit Kaktusgravur
|
|||||||
Desert Sandstone with Scarab Engraving=Wüstensandstein mit Skarabäusgravur
|
Desert Sandstone with Scarab Engraving=Wüstensandstein mit Skarabäusgravur
|
||||||
Falling Cracked Sandstone Brick=Fallender rissiger Sandsteinziegel
|
Falling Cracked Sandstone Brick=Fallender rissiger Sandsteinziegel
|
||||||
Falling Cracked Desert Sandstone Brick=Fallender rissiger Wüstensandsteinziegel
|
Falling Cracked Desert Sandstone Brick=Fallender rissiger Wüstensandsteinziegel
|
||||||
|
Mummy=Mumie
|
||||||
Mummy Spawn Egg=Mumien-Spawn-Ei
|
Mummy Spawn Egg=Mumien-Spawn-Ei
|
||||||
Mummy Spawner=Mumien-Spawner
|
Mummy Spawner=Mumien-Spawner
|
||||||
Sandstone with Eye Engraving=Sandstein mit Augengravur
|
Sandstone with Eye Engraving=Sandstein mit Augengravur
|
||||||
|
2
mod.conf
2
mod.conf
@ -1,4 +1,4 @@
|
|||||||
name = tsm_pyramids
|
name = tsm_pyramids
|
||||||
description = Pyramids with treasures! You can find them in deserts and sandstone deserts.
|
description = Pyramids with treasures! You can find them in deserts and sandstone deserts.
|
||||||
depends = default
|
depends = default
|
||||||
optional_depends = farming, tnt, treasurer, doc_items, awards
|
optional_depends = farming, tnt, treasurer, doc_items, awards, cmi
|
||||||
|
78
mummy.lua
78
mummy.lua
@ -1,5 +1,7 @@
|
|||||||
local S = minetest.get_translator("tsm_pyramids")
|
local S = minetest.get_translator("tsm_pyramids")
|
||||||
|
|
||||||
|
local mod_cmi = minetest.get_modpath("cmi") ~= nil
|
||||||
|
|
||||||
local mummy_walk_limit = 1
|
local mummy_walk_limit = 1
|
||||||
local mummy_chillaxin_speed = 1
|
local mummy_chillaxin_speed = 1
|
||||||
local mummy_animation_speed = 10
|
local mummy_animation_speed = 10
|
||||||
@ -47,15 +49,11 @@ local ANIM_WALK_MINE = 5
|
|||||||
local ANIM_MINE = 6
|
local ANIM_MINE = 6
|
||||||
|
|
||||||
local function hit(self)
|
local function hit(self)
|
||||||
local prop = {
|
self.object:set_texture_mod("^tsm_pyramids_hit.png")
|
||||||
mesh = mummy_mesh,
|
|
||||||
textures = {"tsm_pyramids_mummy.png^tsm_pyramids_hit.png"},
|
|
||||||
}
|
|
||||||
self.object:set_properties(prop)
|
|
||||||
minetest.after(0.4, function(self)
|
minetest.after(0.4, function(self)
|
||||||
local prop = {textures = mummy_texture,}
|
local prop = {textures = mummy_texture,}
|
||||||
if self ~= nil and self.object ~= nil then
|
if self ~= nil and self.object ~= nil then
|
||||||
self.object:set_properties(prop)
|
self.object:set_texture_mod("")
|
||||||
end
|
end
|
||||||
end, self)
|
end, self)
|
||||||
end
|
end
|
||||||
@ -63,7 +61,6 @@ end
|
|||||||
local function mummy_update_visuals_def(self)
|
local function mummy_update_visuals_def(self)
|
||||||
npc_anim = 0 -- Animation will be set further below immediately
|
npc_anim = 0 -- Animation will be set further below immediately
|
||||||
local prop = {
|
local prop = {
|
||||||
mesh = mummy_mesh,
|
|
||||||
textures = mummy_texture,
|
textures = mummy_texture,
|
||||||
}
|
}
|
||||||
self.object:set_properties(prop)
|
self.object:set_properties(prop)
|
||||||
@ -91,6 +88,12 @@ local MUMMY_DEF = {
|
|||||||
envdmg_timer = 0,
|
envdmg_timer = 0,
|
||||||
attacker = "",
|
attacker = "",
|
||||||
attacking_timer = 0,
|
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 = {
|
local spawner_DEF = {
|
||||||
@ -120,6 +123,7 @@ spawner_DEF.on_step = function(self, dtime)
|
|||||||
if self.timer > 1 then
|
if self.timer > 1 then
|
||||||
if n and n.name and n.name ~= "tsm_pyramids:spawner_mummy" then
|
if n and n.name and n.name ~= "tsm_pyramids:spawner_mummy" then
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -128,7 +132,10 @@ spawner_DEF.on_punch = function(self, hitter)
|
|||||||
|
|
||||||
end
|
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)
|
mummy_update_visuals_def(self)
|
||||||
self.anim = get_animations()
|
self.anim = get_animations()
|
||||||
self.object:set_animation({x=self.anim.stand_START,y=self.anim.stand_END}, mummy_animation_speed, mummy_animation_blend)
|
self.object:set_animation({x=self.anim.stand_START,y=self.anim.stand_END}, mummy_animation_speed, mummy_animation_blend)
|
||||||
@ -138,12 +145,20 @@ MUMMY_DEF.on_activate = function(self)
|
|||||||
self.object:set_armor_groups({fleshy=130})
|
self.object:set_armor_groups({fleshy=130})
|
||||||
end
|
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
|
self.attacker = puncher
|
||||||
|
|
||||||
|
if damage and damage > 0 then
|
||||||
|
self.last_damage = {
|
||||||
|
type = "punch",
|
||||||
|
puncher = puncher,
|
||||||
|
}
|
||||||
|
end
|
||||||
if puncher ~= nil then
|
if puncher ~= nil then
|
||||||
minetest.sound_play(sound_hit, {pos = self.object:get_pos(), loop = false, max_hear_distance = 10, gain = 0.4})
|
minetest.sound_play(sound_hit, {pos = self.object:get_pos(), loop = false, max_hear_distance = 10, gain = 0.4}, true)
|
||||||
if time_from_last_punch >= 0.45 then
|
if time_from_last_punch >= 0.45 then
|
||||||
hit(self)
|
hit(self)
|
||||||
self.direction = {x=self.object:get_velocity().x, y=self.object:get_velocity().y, z=self.object:get_velocity().z}
|
self.direction = {x=self.object:get_velocity().x, y=self.object:get_velocity().y, z=self.object:get_velocity().z}
|
||||||
@ -159,7 +174,7 @@ MUMMY_DEF.on_punch = function(self, puncher, time_from_last_punch, tool_capabili
|
|||||||
end
|
end
|
||||||
|
|
||||||
MUMMY_DEF.on_death = function(self, killer)
|
MUMMY_DEF.on_death = function(self, killer)
|
||||||
minetest.sound_play(sound_dead, {pos = self.object:get_pos(), max_hear_distance = 10 , gain = 0.3})
|
minetest.sound_play(sound_dead, {pos = self.object:get_pos(), max_hear_distance = 10 , gain = 0.3}, true)
|
||||||
-- Drop item on death
|
-- Drop item on death
|
||||||
local count = math.random(0,3)
|
local count = math.random(0,3)
|
||||||
if count > 0 then
|
if count > 0 then
|
||||||
@ -167,12 +182,15 @@ MUMMY_DEF.on_death = function(self, killer)
|
|||||||
pos.y = pos.y + 1.0
|
pos.y = pos.y + 1.0
|
||||||
minetest.add_item(pos, mummy_drop .. " " .. count)
|
minetest.add_item(pos, mummy_drop .. " " .. count)
|
||||||
end
|
end
|
||||||
|
if mod_cmi then
|
||||||
|
cmi.notify_die(self, self.last_damage)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local cnt1 = 0
|
|
||||||
local cnt2 = 0
|
|
||||||
|
|
||||||
MUMMY_DEF.on_step = function(self, dtime)
|
MUMMY_DEF.on_step = function(self, dtime)
|
||||||
|
if mod_cmi then
|
||||||
|
cmi.notify_step(self, dtime)
|
||||||
|
end
|
||||||
self.timer = self.timer + 0.01
|
self.timer = self.timer + 0.01
|
||||||
self.turn_timer = self.turn_timer + 0.01
|
self.turn_timer = self.turn_timer + 0.01
|
||||||
self.jump_timer = self.jump_timer + 0.01
|
self.jump_timer = self.jump_timer + 0.01
|
||||||
@ -186,9 +204,11 @@ MUMMY_DEF.on_step = function(self, dtime)
|
|||||||
self.time_passed = 0
|
self.time_passed = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Environment damage
|
||||||
local def = minetest.registered_nodes[current_node.name]
|
local def = minetest.registered_nodes[current_node.name]
|
||||||
local dps = def.damage_per_second
|
local dps = def.damage_per_second
|
||||||
local dmg = 0
|
local dmg = 0
|
||||||
|
local dmg_node, dmg_pos
|
||||||
if dps ~= nil and dps > 0 then
|
if dps ~= nil and dps > 0 then
|
||||||
dmg = dps
|
dmg = dps
|
||||||
end
|
end
|
||||||
@ -210,15 +230,21 @@ MUMMY_DEF.on_step = function(self, dtime)
|
|||||||
if self.envdmg_timer >= 1 then
|
if self.envdmg_timer >= 1 then
|
||||||
self.envdmg_timer = 0
|
self.envdmg_timer = 0
|
||||||
self.object:set_hp(self.object:get_hp()-dmg)
|
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.object:get_hp() <= 0 then
|
||||||
if self.on_death then
|
if self.on_death then
|
||||||
self.on_death(self)
|
self.on_death(self)
|
||||||
end
|
end
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
|
return
|
||||||
else
|
else
|
||||||
hit(self)
|
hit(self)
|
||||||
self.sound_timer = 0
|
self.sound_timer = 0
|
||||||
minetest.sound_play(sound_hit, {pos = current_pos, max_hear_distance = 10, gain = 0.4})
|
minetest.sound_play(sound_hit, {pos = current_pos, max_hear_distance = 10, gain = 0.4}, true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@ -237,7 +263,7 @@ MUMMY_DEF.on_step = function(self, dtime)
|
|||||||
|
|
||||||
--play sound
|
--play sound
|
||||||
if self.sound_timer > math.random(5,35) then
|
if self.sound_timer > math.random(5,35) then
|
||||||
minetest.sound_play(sound_normal, {pos = current_pos, max_hear_distance = 10, gain = 0.2})
|
minetest.sound_play(sound_normal, {pos = current_pos, max_hear_distance = 10, gain = 0.2}, true)
|
||||||
self.sound_timer = 0
|
self.sound_timer = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -341,11 +367,23 @@ minetest.register_craftitem("tsm_pyramids:spawn_egg", {
|
|||||||
liquids_pointable = false,
|
liquids_pointable = false,
|
||||||
stack_max = 99,
|
stack_max = 99,
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
if pointed_thing.type == "node" then
|
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
|
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
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,
|
end,
|
||||||
|
|
||||||
})
|
})
|
||||||
|
1
room.lua
1
room.lua
@ -1116,6 +1116,7 @@ function tsm_pyramids.make_traps(pos, stype, rotations, layout_room)
|
|||||||
-- The depth of air between trap stones and lava layer is <depth> - 4
|
-- The depth of air between trap stones and lava layer is <depth> - 4
|
||||||
local deep_trap = math.random(1,2) == 1
|
local deep_trap = math.random(1,2) == 1
|
||||||
local trap_node
|
local trap_node
|
||||||
|
local depth
|
||||||
if deep_trap then
|
if deep_trap then
|
||||||
trap_node = " "
|
trap_node = " "
|
||||||
depth = 14
|
depth = 14
|
||||||
|
Reference in New Issue
Block a user