0d37b177c0
* mods/CORE/mcl_damage/API.md: Fix errors in description of modifier prioritization. * mods/ENTITIES/mcl_mobs/breeding.lua (feed_tame) (check_breathing): * mods/ENTITIES/mcl_mobs/mod.conf: Delete references to luck. * mods/ENTITIES/mcl_mobs/physics.lua (reset_breath): New function. * mods/ENTITIES/mobs_mc/shulker.lua (hit_mob): Fix typo. * mods/HELP/mcl_tt/snippets_mcl.lua: Remove references to stackable effects, which don't exist in Minecraft. * mods/HELP/tt/init.lua (apply_snippets): Delete unused local variable. (reload_itemstack_description): Filter original description through `def._mcl_filter_description' if it exists. Delete special case for potions. * mods/HUD/mcl_experience/bottle.lua (bottle, throw_xp_bottle): * mods/HUD/mcl_experience/mod.conf: Delete references to luck. * mods/HUD/mcl_inventory/creative.lua (set_inv_search): Guarantee that potent and extended variants of potions appear in search list. * mods/HUD/mcl_inventory/mod.conf: Render tt a mandatory dependency. * mods/ITEMS/mcl_bows/bow.lua: * mods/ITEMS/mcl_bows/crossbow.lua: * mods/ITEMS/mcl_bows/mod.conf: * mods/ITEMS/mcl_end/eye_of_ender.lua (ender_eye): * mods/ITEMS/mcl_end/mod.conf (depends): * mods/ITEMS/mcl_fishing/init.lua (mcl_fishing): * mods/ITEMS/mcl_fishing/mod.conf (description): Delete references to mcl_luck. * mods/ITEMS/mcl_potions/API.md: Document on_reject. * mods/ITEMS/mcl_potions/functions.lua (register_effect): Save `on_reject' in registered definitions. (absorption): Enable for mobs as well; implement on_reject to set a lower bound on absorption health when an inferior effect is discarded for a better one, but without affecting the duration of the latter. (fire_resistance, resistance): Enable for mobs. (luck, bad_luck): Extricate from mcl_luck. (level_from_details, duration_from_details): Extract some copypasta here. (give_effect): Call on_reject in the abovementioned scenario. (_extinguish_nearby_fire): Rename to `_water_effect'. Extinguish nearby burning entities and replenish breath counter of axolotls. * mods/ITEMS/mcl_potions/init.lua (water_splash): Delete function. (water): Call _water_effect on splash. * mods/ITEMS/mcl_potions/lingering.lua (lingering_effect_at): Rename to `lingering_effects_at'. (potency_to_level): New function. (add_lingering_effects): New function. Record a list of active effects at any position to enable applying multiple effects to one position. (def_to_effect_list, particle_texture): New function. (register_globalstep): Enable overriding the total lifespan of an area effect cloud. Restore ability to extinguish nearby fires and mobs, and adapt to the new area effect representation. (register_lingering): Set _mcl_filter_description. Correct invocation of obsolete function and adapt to the foregoing changes. * mods/ITEMS/mcl_potions/potions.lua (generate_on_use) (register_potion): Effects do not stack in Minecraft, so remove them from Mineclonia also. Register implementation of _mcl_filter_description. (filter_potion_description): New function. * mods/ITEMS/mcl_potions/splash.lua (register_splash): Extract some widely reused code into a common function, and register implementation of _mcl_filter_description. * mods/ITEMS/mcl_potions/tipped_arrow.lua (register_arrow): Likewise. * mods/ITEMS/mcl_totems/init.lua: Grant user Regeneration, Fire Resistance and Absorption upon resurrection. * mods/ITEMS/mcl_totems/mod.conf (depends): Depend on mcl_potions. * mods/PLAYER/mcl_criticals/init.lua: * mods/PLAYER/mcl_criticals/mod.conf: Revert mcl_luck changes.
31 lines
1.1 KiB
Lua
31 lines
1.1 KiB
Lua
mcl_damage.register_modifier(function(obj, damage, reason)
|
|
if reason.type == "player" then
|
|
local hitter = reason.direct
|
|
if mcl_sprint.is_sprinting(hitter) then
|
|
obj:add_velocity(hitter:get_velocity())
|
|
elseif (hitter:get_velocity() or hitter:get_player_velocity()).y < 0 and damage > 0 then
|
|
local pos = mcl_util.get_object_center(obj)
|
|
minetest.add_particlespawner({
|
|
amount = 15,
|
|
time = 0.1,
|
|
minpos = {x=pos.x-0.5, y=pos.y-0.5, z=pos.z-0.5},
|
|
maxpos = {x=pos.x+0.5, y=pos.y+0.5, z=pos.z+0.5},
|
|
minvel = {x=-0.1, y=-0.1, z=-0.1},
|
|
maxvel = {x=0.1, y=0.1, z=0.1},
|
|
minacc = {x=0, y=0, z=0},
|
|
maxacc = {x=0, y=0, z=0},
|
|
minexptime = 1,
|
|
maxexptime = 2,
|
|
minsize = 1.5,
|
|
maxsize = 1.5,
|
|
collisiondetection = false,
|
|
vertical = false,
|
|
texture = "mcl_particles_crit.png^[colorize:#bc7a57:127",
|
|
})
|
|
minetest.sound_play("mcl_criticals_hit", {object = obj})
|
|
-- the minecraft wiki is actually wrong about a crit dealing 150% damage, see minecraft source code
|
|
return damage + math.random(0, math.floor(damage * 1.5 + 2))
|
|
end
|
|
end
|
|
end, -100)
|