From 4b9482cb0924574b318fe3b878d99adbd07fed0d Mon Sep 17 00:00:00 2001 From: ancientmarinerdev Date: Sun, 5 Feb 2023 05:34:32 +0000 Subject: [PATCH 1/6] Mobs should not drop XP when dying by fire from sunlight --- mods/ENTITIES/mcl_mobs/api.lua | 11 ++++++++++- mods/ENTITIES/mcl_mobs/physics.lua | 10 +++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index 1e7c9168b..6cc8d3d28 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -365,6 +365,9 @@ function mob_class:on_step(dtime) if self:check_despawn(pos, dtime) then return true end if self:outside_limits() then return end + -- Start: Death/damage processing + -- All damage needs to be undertaken at the start. + -- We need to exit processing if the mob dies. if self:check_death_and_slow_mob() then --minetest.log("action", "Mob is dying: ".. tostring(self.name)) -- Do we abandon out of here now? @@ -377,9 +380,16 @@ function mob_class:on_step(dtime) mcl_burning.tick(self.object, dtime, self) -- mcl_burning.tick may remove object immediately if not self.object:get_pos() then return end + + if self:check_for_death("fire", {type = "fire"}) then + return true + end end + if self:env_damage (dtime, pos) then return end + if self.state == "die" then return end + -- End: Death/damage processing self:check_water_flow() self:env_danger_movement_checks (dtime) @@ -425,7 +435,6 @@ function mob_class:on_step(dtime) self:mob_sound("random", true) end - if self:env_damage (dtime, pos) then return end if self:do_states(dtime) then return end if not self.object:get_luaentity() then diff --git a/mods/ENTITIES/mcl_mobs/physics.lua b/mods/ENTITIES/mcl_mobs/physics.lua index 0c908b639..d4d3c836d 100644 --- a/mods/ENTITIES/mcl_mobs/physics.lua +++ b/mods/ENTITIES/mcl_mobs/physics.lua @@ -462,6 +462,14 @@ function mob_class:check_for_death(cause, cmi_cause) self:mob_sound("death") local function death_handle(self) + if cmi_cause and cmi_cause["type"] then + --minetest.log("cmi_cause: " .. tostring(cmi_cause["type"])) + end + --minetest.log("cause: " .. tostring(cause)) + + -- TODO other env damage shouldn't drop xp + -- "rain", "water", "drowning", "suffocation" + -- dropped cooked item if mob died in fire or lava if cause == "lava" or cause == "fire" then self:item_drop(true, 0) @@ -800,7 +808,7 @@ function mob_class:do_env_damage() self.suffocation_timer = 0 end - return self:check_for_death("", {type = "unknown"}) + return self:check_for_death("unknown", {type = "unknown"}) end function mob_class:env_damage (dtime, pos) From 39d4434df160bdc630c2329f2d35c7db7d33b3d0 Mon Sep 17 00:00:00 2001 From: ancientmarinerdev Date: Sun, 5 Feb 2023 23:42:36 +0000 Subject: [PATCH 2/6] Reorder on_step calls --- mods/ENTITIES/mcl_mobs/api.lua | 35 +++++++++++++---------------- mods/ENTITIES/mcl_mobs/movement.lua | 8 ++++++- 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index 6cc8d3d28..fa7cd3d4c 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -366,8 +366,7 @@ function mob_class:on_step(dtime) if self:outside_limits() then return end -- Start: Death/damage processing - -- All damage needs to be undertaken at the start. - -- We need to exit processing if the mob dies. + -- All damage needs to be undertaken at the start. We need to exit processing if the mob dies. if self:check_death_and_slow_mob() then --minetest.log("action", "Mob is dying: ".. tostring(self.name)) -- Do we abandon out of here now? @@ -378,8 +377,7 @@ function mob_class:on_step(dtime) if not self.fire_resistant then mcl_burning.tick(self.object, dtime, self) - -- mcl_burning.tick may remove object immediately - if not self.object:get_pos() then return end + if not self.object:get_pos() then return end -- mcl_burning.tick may remove object immediately if self:check_for_death("fire", {type = "fire"}) then return true @@ -394,38 +392,35 @@ function mob_class:on_step(dtime) self:check_water_flow() self:env_danger_movement_checks (dtime) - if mobs_debug then self:update_tag() end self:follow_flop() -- Mob following code. - self:set_animation_speed() -- set animation speed relitive to velocity + self:set_animation_speed() -- set animation speed relative to velocity + self:check_smooth_rotation(dtime) self:check_head_swivel(dtime) - if self.jump_sound_cooloff > 0 then - self.jump_sound_cooloff = self.jump_sound_cooloff - dtime - end + if self.jump_sound_cooloff > 0 then self.jump_sound_cooloff = self.jump_sound_cooloff - dtime end self:do_jump() - self:set_armor_texture() self:check_runaway_from() - self:monster_attack() self:npc_attack() - self:check_breeding() self:check_aggro(dtime) - -- run custom function (defined in mob lua file) - if self.do_custom then - if self.do_custom(self, dtime) == false then - return - end - end + self:check_breeding() + + self:check_item_pickup() + self:set_armor_texture() + + if self.do_custom and self.do_custom(self, dtime) == false then return end if update_timers(self, dtime) then return end self:check_particlespawners(dtime) - self:check_item_pickup() + + if self:env_damage (dtime, pos) then return end + if self:do_states(dtime) then return end if self.opinion_sound_cooloff > 0 then self.opinion_sound_cooloff = self.opinion_sound_cooloff - dtime @@ -437,6 +432,8 @@ function mob_class:on_step(dtime) if self:do_states(dtime) then return end + if mobs_debug then self:update_tag() end + if not self.object:get_luaentity() then return false end diff --git a/mods/ENTITIES/mcl_mobs/movement.lua b/mods/ENTITIES/mcl_mobs/movement.lua index 758e74467..4f174b300 100644 --- a/mods/ENTITIES/mcl_mobs/movement.lua +++ b/mods/ENTITIES/mcl_mobs/movement.lua @@ -239,9 +239,15 @@ function mob_class:is_at_water_danger() return false end local yaw = self.object:get_yaw() + local pos = self.object:get_pos() + + if not yaw or not pos then + return + end + local dir_x = -math.sin(yaw) * (self.collisionbox[4] + 0.5) local dir_z = math.cos(yaw) * (self.collisionbox[4] + 0.5) - local pos = self.object:get_pos() + local ypos = pos.y + self.collisionbox[2] -- just above floor local free_fall, blocker = minetest.line_of_sight( From b834e790a76fa8610df3548e67941e8552cb4663 Mon Sep 17 00:00:00 2001 From: ancientmarinerdev Date: Mon, 6 Feb 2023 04:35:35 +0000 Subject: [PATCH 3/6] Fix game crashes --- mods/ENTITIES/mcl_mobs/effects.lua | 15 +++++++++++++-- mods/ENTITIES/mcl_mobs/physics.lua | 2 ++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/effects.lua b/mods/ENTITIES/mcl_mobs/effects.lua index d4b071f93..a8b761d47 100644 --- a/mods/ENTITIES/mcl_mobs/effects.lua +++ b/mods/ENTITIES/mcl_mobs/effects.lua @@ -1,4 +1,4 @@ -local math, vector, minetest, mcl_mobs = math, vector, minetest, mcl_mobs +local math, tonumber, vector, minetest, mcl_mobs = math, tonumber, vector, minetest, mcl_mobs local mob_class = mcl_mobs.mob_class local active_particlespawners = {} local disable_blood = minetest.settings:get_bool("mobs_disable_blood") @@ -8,6 +8,15 @@ local player_transfer_distance = tonumber(minetest.settings:get("player_transfer if player_transfer_distance == 0 then player_transfer_distance = math.huge end +local function validate_vector (vect) + if vect then + if tonumber(vect.x) and tonumber(vect.y) and tonumber(vect.z) then + return true + end + end + return false +end + -- custom particle effects function mcl_mobs.effect(pos, amount, texture, min_size, max_size, radius, gravity, glow, go_down) @@ -385,6 +394,8 @@ function mob_class:check_head_swivel(dtime) mcl_util.set_bone_position(self.object,self.head_swivel, vector.new(0,self.bone_eye_height,self.horrizonatal_head_height), final_rotation) end + + function mob_class:set_animation_speed() local v = self.object:get_velocity() if v then @@ -400,7 +411,7 @@ function mob_class:set_animation_speed() end end --set_speed - if self.acc then + if validate_vector(self.acc) then self.object:add_velocity(self.acc) end end diff --git a/mods/ENTITIES/mcl_mobs/physics.lua b/mods/ENTITIES/mcl_mobs/physics.lua index d4d3c836d..797bb4b7e 100644 --- a/mods/ENTITIES/mcl_mobs/physics.lua +++ b/mods/ENTITIES/mcl_mobs/physics.lua @@ -311,6 +311,8 @@ end function mob_class:set_yaw(yaw, delay, dtime) if self.noyaw then return end + if not self.object:get_yaw() or not self.object:get_pos() then return end + if self.state ~= PATHFINDING then self._turn_to = yaw end From d9982e20d2e27ce622a657adaed20b4726ac0393 Mon Sep 17 00:00:00 2001 From: FossFanatic Date: Wed, 8 Feb 2023 19:57:00 +0000 Subject: [PATCH 4/6] Make the footer more with the times --- menu/footer.png | Bin 1436 -> 1378 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/menu/footer.png b/menu/footer.png index 72f80a43c524b00635132a989651e967ccbfc4fb..4563e95772fc4616b9af9d977e4c730900437ac8 100644 GIT binary patch delta 1359 zcmbQk{fKLVO1)5kPlzi+ehvczgO!>7e+Gt^xAwohb>MSGd>&AUu_VYZn8D%MjWh-Z zmVcfujv*Dd-p=LhTWlb}Aoxg;<74v~=74Gc_h&Na{@UPccAT#>V5*y7GLKqd_yWsI zzRW-)kihcAvsv$(`Pb+b_?^mF|7B*}%&+ww+10a4_A@gvD|}deo4w({evJRCl?BJc2EvMtn z!ly@lE7MN2&6{|)?D?v-_p_Clrr$1>E;P@tk9d&!=$lpE-CdS@CvR0Py*KSrak2}K zf&s{1^A22pa_`W#9?9+l1y+s5u}7PH5@t(pJ#TcW+O|ISchTRIv8r5)QY{O1CTjn8 ze2}Vp>umkpoXY%P^F9dM8ZvYA9AMyx5v_=<3-#mMxA(v{38urDEMc*G<(!R-g(IZ* zR&=ul=e90=b<56l=YhL9)u((Og!q55sj9X^NN1uw=hao2$x7t2E^LAO`M#+bk zi%y=MwAy#CXVh-vSBZ_LFR#8nHcM{x?M&5Q2ijxGm>{Ndl|_5LzUR6B-)(aa9`(ab zHFFItubwIMIRAHB>$=x#bd=AEoxFXw<7Q0p+Ko9|ZrOWA)k@X>3~Vf2vUc{lOQuVf zmQ>ZM^0KkGB`~na-K&1i!Sj5vsik&!_Nrcnh65mk20rlGM7DmInx)x)Mf&ZE!%XfI zLglQ2wtU~~;d)w)1!NGA__yc4CxZvg+p}-$x7lod`9H4GeE+7jhIH0x@@aEs)h~X$ zcFTiE{artccAlx%n?7H%k+D%w0!Y~FZTPQxDqzX&t3Drv6)WdCH3qHz`2En4 zkz$Px1sbK}Pib@~&R02pXnv@8+2Y!DER{bxzrN_6`s3}R7w5WN@A6J(Q#Jsm0U+_A zon_xLmWWrazm@JrosM2zn*BV)ay?t-%S)*Ck ziF}po-o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)~QOlPy5KCTPDrRnAi{$hrWW;44hr~CWz#5mczJ{~o!YC23{JDV9h$tZ`9^nK(mFasSLZV&O&AzPydq>djNQPE7Y@!>4{Z2ipc|T_na^(EnRS!^-TQ9D9%$&EaZgrR)>3 ziSy6z%~H$rRbtRz7ZlX@>-BX^QPYFiY>&Ug;PGifs+H3tM{>d0ffUsz#{(~?ysgZP zfAMCQ)c2weTVqN^j9T^g>-GCR!l1cHEO&*yxl*KPs;@P$gM#PXX@rV1#~#B6%zm%b z`f4HOZr=Rq!z*CpqYSsBJej!QyvedByB&q~ZwsP&=Bnw|M$|@HvkOtciR#trQ;_KN z+y5>6RmhmlpQBW|GbT6PlU3=r(l1eRN4ea3KgsSqQuX@nr_6F(x``9jjX$c0)t|!b zt$)^*@!74E5g8E95!^gO?Ic_&4zvufpsI_bgJLUMZnuP-oKVn^*MOEmo@WSKbXbrC z#*dtqDbmNMn(Lmx3@<4bT8!iDzNgP5aUzPn!=tPbJOYRlb0Cr8lT!UKoF~1}rak0J zTOBvqPgGQ0tUsgGpFl73E~nqy^IHTY*1r_zoZMW`t?}1O@1FNLJo;E0ljOb{*?wuN zarEw(#0t%Y85@idh)?r=PNCg|^kS9^7mvb5*){;7nFP9X7x^b@ zboSUJs?d0e{{XPVcld+i%@$E4$Oo+wAE>UV@$blf`&p!9#jkUsCmYw#B F{RbrWfO-G` From c4d60e50cc736eb9d2234d3bab85a2583fc72d3e Mon Sep 17 00:00:00 2001 From: SmokeyDope Date: Tue, 7 Feb 2023 22:20:45 +0000 Subject: [PATCH 5/6] Make minecart rails unable to be broken with water --- mods/ENTITIES/mcl_minecarts/rails.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ENTITIES/mcl_minecarts/rails.lua b/mods/ENTITIES/mcl_minecarts/rails.lua index 5117fe48c..31bda1c98 100644 --- a/mods/ENTITIES/mcl_minecarts/rails.lua +++ b/mods/ENTITIES/mcl_minecarts/rails.lua @@ -2,7 +2,7 @@ local S = minetest.get_translator(minetest.get_current_modname()) -- Template rail function local function register_rail(itemstring, tiles, def_extras, creative) - local groups = {handy=1,pickaxey=1, attached_node=1,rail=1,connect_to_raillike=minetest.raillike_group("rail"),dig_by_water=1,destroy_by_lava_flow=1, transport=1} + local groups = {handy=1,pickaxey=1, attached_node=1,rail=1,connect_to_raillike=minetest.raillike_group("rail"),dig_by_water=0,destroy_by_lava_flow=1, transport=1} if creative == false then groups.not_in_creative_inventory = 1 end From 71671f8b5f89393488462105fd9eb46519af9760 Mon Sep 17 00:00:00 2001 From: SmokeyDope Date: Tue, 7 Feb 2023 22:36:25 +0000 Subject: [PATCH 6/6] Make minecart rails unable to be broken with lava --- mods/ENTITIES/mcl_minecarts/rails.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ENTITIES/mcl_minecarts/rails.lua b/mods/ENTITIES/mcl_minecarts/rails.lua index 31bda1c98..9c9050341 100644 --- a/mods/ENTITIES/mcl_minecarts/rails.lua +++ b/mods/ENTITIES/mcl_minecarts/rails.lua @@ -2,7 +2,7 @@ local S = minetest.get_translator(minetest.get_current_modname()) -- Template rail function local function register_rail(itemstring, tiles, def_extras, creative) - local groups = {handy=1,pickaxey=1, attached_node=1,rail=1,connect_to_raillike=minetest.raillike_group("rail"),dig_by_water=0,destroy_by_lava_flow=1, transport=1} + local groups = {handy=1,pickaxey=1, attached_node=1,rail=1,connect_to_raillike=minetest.raillike_group("rail"),dig_by_water=0,destroy_by_lava_flow=0, transport=1} if creative == false then groups.not_in_creative_inventory = 1 end