Merge remote-tracking branch 'upstream/master' into nalc-1.2-dev

This commit is contained in:
Sys Quatre 2020-06-12 21:51:55 +02:00
commit d8ece75bee
2 changed files with 9 additions and 12 deletions

View File

@ -1,6 +1,6 @@
# Pyramids (with Treasurer support) [`tsm_pyramids`] # Pyramids (with Treasurer support) [`tsm_pyramids`]
* Version: 1.0.0 * Version: 1.0.2
## 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

View File

@ -49,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
@ -65,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)
@ -128,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
@ -162,7 +158,7 @@ MUMMY_DEF.on_punch = function(self, puncher, time_from_last_punch, tool_capabili
} }
end 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}
@ -178,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
@ -244,10 +240,11 @@ MUMMY_DEF.on_step = function(self, dtime)
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
@ -266,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