Compare commits

..

79 Commits

Author SHA1 Message Date
teknomunk 3d01f5ad03 Replace _puncher with _owner, rework projectile code to make _owner a string, copy mcl_util.gen_uuid() from minecart branch, add mcl_util.get_entity_id(), fix crash 2024-10-27 16:03:20 +01:00
teknomunk f584e85f67 Remove debug dump, move maximum time to live to vl_projectile 2024-10-27 16:03:20 +01:00
teknomunk 05c043dcf3 Document vl_projectile.replace_with_item_drop 2024-10-27 16:03:20 +01:00
teknomunk 75370fbac9 Move projectile stick logic into vl_projectile 2024-10-27 16:03:20 +01:00
teknomunk 7b615a8e5a Move tracer to vl_projectile 2024-10-27 16:03:20 +01:00
teknomunk 872cc080f1 Change mcl_bows to use standard vl_projectile on_step handler, move burning behavior to vl_projectile 2024-10-27 16:03:20 +01:00
teknomunk 0b5cf3af99 Move arrow-node logic out of mcl_bows/arrow.lua and into the node definitions under _vl_projectile.on_collide 2024-10-27 16:03:20 +01:00
teknomunk ce01519faf Remove secondary collision check in mcl_bows/arrow.lua (it was just hitting grass) 2024-10-27 16:03:20 +01:00
teknomunk 9442e4dd69 Remove code with no effect other than emitting a warning 2024-10-27 16:03:20 +01:00
teknomunk e390f36868 Resolve luacheck findings 2024-10-27 16:03:20 +01:00
teknomunk 725a3dd969 Fix crashes in mcl_throwing 2024-10-27 16:03:20 +01:00
teknomunk 799e734315 Fix crash when hit with an arrow that is not piercing 2024-10-27 16:03:20 +01:00
the-real-herowl 112d3c1a77 Rockets and piercing arrows fixed
They both work properly now.
2024-10-27 16:03:20 +01:00
the-real-herowl 963644f62b Fix throwables' punch allow check 2024-10-27 16:03:20 +01:00
the-real-herowl 990d126322 Fixed abnormal skull rotation 2024-10-27 16:03:20 +01:00
the-real-herowl f5505118d8 Fixed wither skulls
- wither skulls now hit players again
- wither skulls (strong version) don't cause a crash anymore
2024-10-27 16:03:20 +01:00
teknomunk 931e618643 Add attribution with exact links for minetest code 2024-10-27 16:03:20 +01:00
teknomunk fa210cde78 Add hook to allow piercing enchantment to be implemented 2024-10-27 16:03:20 +01:00
teknomunk bf8716bd00 Fix chick spawning in the presence of a functional has_room() check 2024-10-27 16:03:20 +01:00
teknomunk 244cf40d11 Fix dispenser arrows so they hit players and entities, minetest.register_entity -> vl_projectile.register for mcl_throwing:egg 2024-10-27 16:03:20 +01:00
teknomunk a2ef6c4dc9 Make egg and snowball stack count match master 2024-10-27 16:03:20 +01:00
teknomunk 417f9f624a Prevent dereferencing nil in wither.lua, fix minor typo in debug statement 2024-10-27 16:03:20 +01:00
teknomunk 7aa3758894 Add workarround for random velocity change of particles on creation 2024-10-27 16:03:20 +01:00
teknomunk 18521adc47 Make sure a projectile sets on fire the thing it collided with 2024-10-27 16:03:20 +01:00
teknomunk af07e0f29c Stop wither from shooting itself 2024-10-27 16:03:20 +01:00
teknomunk 8907251cad Fix player-mcl_throwing collisions, fix chick spawning on egg collisions, luacheck fixes 2024-10-27 16:03:20 +01:00
teknomunk 9d6d72452f Fix unintentional collision box change 2024-10-27 16:03:20 +01:00
teknomunk cd550a7f33 Fix luacheck findings for this PR: remove unused variables, remove overwritten value, add missing dependencies, fix undefined variable usage 2024-10-27 16:03:20 +01:00
teknomunk 53a76b09d9 Prevent projectiles from crashing server when removed when it punched something (wither skull hitting the wither will cause this), mark wither skull with _removed = true when death timer removes it 2024-10-27 16:03:20 +01:00
teknomunk cf831049e5 Allow mob projectiles to hit their owner after 2 seconds (used by ghast fireball) 2024-10-27 16:03:20 +01:00
teknomunk e5a7f010bd Make snowballs have the same collision conditions as before 2024-10-27 16:03:20 +01:00
teknomunk c9383f957c Undo conversions to use mcl_bows:arrow_entity and use arrow_item.."_entity" like master 2024-10-27 16:03:20 +01:00
teknomunk 18763a740f Convert flying bobber to vl_projectile, modify mcl_throwing.register_throwable_object() to check for _vl_projectile field 2024-10-27 16:03:20 +01:00
teknomunk 8385bfcced Remove redundant check 2024-10-27 16:03:20 +01:00
teknomunk a4a8739514 Correct behavior when ignore_gravity flag is true, fix mob projectile velocity calculation, add missing entity_def lookup 2024-10-27 16:03:20 +01:00
teknomunk 2a2d082046 Convert mcl_mobs.register_arrow() to use vl_projectile, tested only with shulker bullet so far 2024-10-27 16:03:20 +01:00
teknomunk 74d97132c1 Restore tipped arrow entity registration as near copy of mcl_bows:arrow_entity 2024-10-27 16:03:20 +01:00
teknomunk 5564610b09 Small optimization for calculating _allow_punch 2024-10-27 16:03:20 +01:00
teknomunk dfb909e6bf Remove unnecessary vectory copy 2024-10-27 16:03:20 +01:00
teknomunk 007d505a96 Make splash, lingering and othe projectiles hit players 2024-10-27 16:03:20 +01:00
teknomunk db00c709db Stop minimum draw arrows from hitting player that shot them 2024-10-27 16:03:20 +01:00
teknomunk e12420b93e Prevent collisions with entities until projectile is at least one node from where it started (to prevent always hitting yourself), modify mcl_bows.shoot_arrow() and mcl_bows_s.shoot_arrow_crossbow() to use vl_projectile.create(), fix projectiles damaging players 2024-10-27 16:03:20 +01:00
teknomunk 4b6fa8b869 Inline dir_to_pitch() and use correct formula for pitch 2024-10-27 16:03:20 +01:00
teknomunk 1bfb4b5d8b Address most of kno10's comments about mcl_utils/node.lua and a couple others, fix lingering potion sound 2024-10-27 16:03:20 +01:00
teknomunk 42f4175930 Address more review comments 2024-10-27 16:03:20 +01:00
teknomunk 63748cd03f Make arrows damage players, update API documentation, fix several crashes that occurred when arrows hit a player 2024-10-27 16:03:20 +01:00
teknomunk 9990c7937d Fix picking up tipped arrows 2024-10-27 16:03:20 +01:00
teknomunk 4325ba0071 Fix crash with splash potions of harming, make splash particles match potion color 2024-10-27 16:03:20 +01:00
teknomunk 1d575df8b7 Fix splash potions, fix crash when projectiles hit unknown nodes 2024-10-27 16:03:20 +01:00
teknomunk 54b9861491 Remove logging in tipped_arrows, prevent crash when spawning chicks, add extra safety check in vl_projectile.collides_with_solids 2024-10-27 16:03:20 +01:00
teknomunk f22224a162 Lingering potions should not collide with liquids, change behaviors assersion loop to catch nil members 2024-10-27 16:03:20 +01:00
teknomunk fcb8b1ffb7 Convert lingering potion to vl_projectile 2024-10-27 16:03:20 +01:00
teknomunk 77e1b14030 Convert splash potion to vl_projectile, remove dead code, precompute several values in splash potion code, add check of behaviors array in vl_projectile 2024-10-27 16:03:20 +01:00
teknomunk ef2bc7dbfa Fix crash related to nil _time_in_air 2024-10-27 16:03:20 +01:00
teknomunk e4bfaca30e Revert entity->object for three lines 2024-10-27 16:03:20 +01:00
teknomunk 058e6d6c26 Fix typo _ -> . 2024-10-27 16:03:20 +01:00
teknomunk 3506d5f820 Add empty line 2024-10-27 16:03:20 +01:00
teknomunk e3fcbdf1cc Fix typo in api.md, add TODO, change entity -> object 2024-10-27 16:03:20 +01:00
teknomunk 2214e6bdba Fix typos documentation, add ignore_gravity and liquid_drag options, use vl_projectile.register() for enter pearl, move projectile physics to vl_projectile add hook for future vl_physics support 2024-10-27 16:03:20 +01:00
teknomunk 9eefe64e90 Update mcl_util.get_double_container_neighbor_pos() to use vector.offset 2024-10-27 16:03:20 +01:00
teknomunk 6c6e17ad6d Resolve more review comments, fix crash 2024-10-27 16:03:20 +01:00
teknomunk a58151d73d Resolve review comments 2024-10-27 16:03:20 +01:00
teknomunk 59c342d626 Remove debug print 2024-10-27 16:03:20 +01:00
teknomunk 491be0f116 Give arrows a maximum lifetime to prevent them from getting stuck in mid-air forever 2024-10-27 16:03:20 +01:00
teknomunk 9d9b493651 Fix documentation for raycast_collides_with_entities 2024-10-27 16:03:20 +01:00
teknomunk c950115b2c Add API documentation, minor API cleanup 2024-10-27 16:03:20 +01:00
teknomunk 42d7f400c4 Convert rocket to use vl_projectile API using mcl_bows:arrow as a template, remove some dead code 2024-10-27 16:03:20 +01:00
teknomunk e7f6405bf3 Fold tipped arrows into standard arrows and handle effects via item definition callback, remove arrows when they collide with entities, update handling of removing projectiles 2024-10-27 16:03:20 +01:00
teknomunk 4441f9ad5e Fix crash on startup 2024-10-27 16:03:20 +01:00
teknomunk ac6cc76aad More refactoring to generalize arrow code into projectile 2024-10-27 16:03:20 +01:00
teknomunk a12ff875f2 Start mcl_bows:arrow_entity refactor 2024-10-27 16:03:20 +01:00
teknomunk 1f7a810497 Remove _thrower from vl_projectile (uses self._vl_projectile.owner instead), reorder some code 2024-10-27 16:03:20 +01:00
teknomunk ff5aab5d7c Finish reworking all items in mcl_throwing 2024-10-27 16:03:20 +01:00
teknomunk 162ddbe7f5 Add in vl_projectile, add mcl_util.match_node_to_filter 2024-10-27 16:03:20 +01:00
teknomunk d83cebfb85 Move node related functions to mods/CORE/mcl_util/nodes.lua 2024-10-27 16:03:20 +01:00
teknomunk 0ece1ed996 Create vl_projectile and refactor snowball and partially refactor ender pearl 2024-10-27 16:03:20 +01:00
Mikita Wiśniewski 41b188caea Remove "double drop" mechanics for bamboo (fixes #4514) (#4642)
Reviewed-on: VoxeLibre/VoxeLibre#4642
Reviewed-by: the-real-herowl <the-real-herowl@noreply.git.minetest.land>
Co-authored-by: Mikita Wiśniewski <rudzik8@protonmail.com>
Co-committed-by: Mikita Wiśniewski <rudzik8@protonmail.com>
2024-10-27 14:16:06 +01:00
kno10 ae7995d195 Fix axolotl attacking water mobs (#4675)
Also avoid jumping out of the water closes #4644

Reviewed-on: VoxeLibre/VoxeLibre#4675
Reviewed-by: the-real-herowl <the-real-herowl@noreply.git.minetest.land>
Co-authored-by: kno10 <kno10@noreply.git.minetest.land>
Co-committed-by: kno10 <kno10@noreply.git.minetest.land>
2024-10-27 14:10:11 +01:00
kno10 e293cbe631 Better handling of touching_ground for bouncing on beds (#4689)
Reviewed-on: VoxeLibre/VoxeLibre#4689
Reviewed-by: the-real-herowl <the-real-herowl@noreply.git.minetest.land>
Co-authored-by: kno10 <erich.schubert@gmail.com>
Co-committed-by: kno10 <erich.schubert@gmail.com>
2024-10-27 14:03:50 +01:00
6 changed files with 22 additions and 51 deletions

View File

@ -928,8 +928,6 @@ end
-- falling and fall damage
-- returns true if mob died
function mob_class:falling(pos, moveresult)
if moveresult and moveresult.touching_ground then return false end
if self.fly and self.state ~= "die" then
return
end
@ -952,7 +950,13 @@ function mob_class:falling(pos, moveresult)
new_acceleration = vector.new(0, DEFAULT_FALL_SPEED, 0)
elseif v.y <= 0 and v.y > self.fall_speed then
-- fall downwards at set speed
new_acceleration = vector.new(0, self.fall_speed, 0)
if moveresult and moveresult.touching_ground then
-- when touching ground, retain a minimal gravity to keep the touching_ground flag
-- but also to not get upwards acceleration with large dtime when on bouncy ground
new_acceleration = vector.new(0, self.fall_speed * 0.01, 0)
else
new_acceleration = vector.new(0, self.fall_speed, 0)
end
else
-- stop accelerating once max fall speed hit
new_acceleration =vector.zero()

View File

@ -72,18 +72,24 @@ local axolotl = {
fly = true,
fly_in = { "mcl_core:water_source", "mclx_core:river_water_source" },
breathes_in_water = true,
jump = true,
jump = false, -- would get them out of the water too often
damage = 2,
reach = 2,
attack_type = "dogfight",
attack_animals = true,
specific_attack = {
"extra_mobs_cod",
"extra_mobs_glow_squid",
"extra_mobs_salmon",
"extra_mobs_tropical_fish",
"mobs_mc_squid"
},
"mobs_mc:cod",
"mobs_mc:glow_squid",
"mobs_mc:salmon",
"mobs_mc:tropical_fish",
"mobs_mc:squid",
"mobs_mc:zombie", -- todo: only drowned?
"mobs_mc:baby_zombie",
"mobs_mc:husk",
"mobs_mc:baby_husk",
"mobs_mc:guardian_elder",
"mobs_mc:guardian",
},
runaway = true,
}

View File

@ -5,9 +5,6 @@
--- Copyright (C) 2022 - 2023, Michieal. See License.txt
-- CONSTS
local DOUBLE_DROP_CHANCE = 8
-- Used everywhere. Often this is just the name, but it makes sense to me as BAMBOO, because that's how I think of it...
-- "BAMBOO" goes here.
local BAMBOO = "mcl_bamboo:bamboo"
local BAMBOO_ENDCAP_NAME = "mcl_bamboo:bamboo_endcap"
local BAMBOO_PLANK = BAMBOO .. "_plank"
@ -16,7 +13,7 @@ local BAMBOO_PLANK = BAMBOO .. "_plank"
local modname = minetest.get_current_modname()
local S = minetest.get_translator(modname)
local node_sound = mcl_sounds.node_sound_wood_defaults()
local pr = PseudoRandom((os.time() + 15766) * 12) -- switched from math.random() to PseudoRandom because the random wasn't very random.
local pr = PseudoRandom((os.time() + 15766) * 12)
local on_rotate
if minetest.get_modpath("screwdriver") then
@ -31,33 +28,7 @@ local bamboo_def = {
paramtype = "light",
groups = {handy = 1, axey = 1, choppy = 1, dig_by_piston = 1, plant = 1, non_mycelium_plant = 1, flammable = 3},
sounds = node_sound,
drop = {
max_items = 1,
-- From the API:
-- max_items: Maximum number of item lists to drop.
-- The entries in 'items' are processed in order. For each:
-- Item filtering is applied, chance of drop is applied, if both are
-- successful the entire item list is dropped.
-- Entry processing continues until the number of dropped item lists
-- equals 'max_items'.
-- Therefore, entries should progress from low to high drop chance.
items = {
-- Examples:
{
-- 1 in DOUBLE_DROP_CHANCE chance of dropping.
-- Default rarity is '1'.
rarity = DOUBLE_DROP_CHANCE,
items = {BAMBOO .. " 2"},
},
{
-- 1 in 1 chance of dropping. (Note: this means that it will drop 100% of the time.)
-- Default rarity is '1'.
rarity = 1,
items = {BAMBOO},
},
},
},
drop = BAMBOO,
inventory_image = "mcl_bamboo_bamboo_shoot.png",
wield_image = "mcl_bamboo_bamboo_shoot.png",
@ -86,7 +57,6 @@ local bamboo_def = {
on_rotate = on_rotate,
on_place = function(itemstack, placer, pointed_thing)
if not pointed_thing then
return itemstack
end
@ -241,9 +211,6 @@ local bamboo_def = {
if node_above and ((bamboo_node and bamboo_node > 0) or node_above.name == BAMBOO_ENDCAP_NAME) then
minetest.remove_node(new_pos)
minetest.sound_play(node_sound.dug, sound_params, true)
if pr:next(1, DOUBLE_DROP_CHANCE) == 1 then
minetest.add_item(new_pos, istack)
end
minetest.add_item(new_pos, istack)
end
end,

View File

@ -9,8 +9,6 @@ local SIDE_SCAFFOLDING = false
local SIDE_SCAFFOLD_NAME = "mcl_bamboo:scaffolding_horizontal"
-- ---------------------------------------------------------------------------
local SCAFFOLDING_NAME = "mcl_bamboo:scaffolding"
-- Used everywhere. Often this is just the name, but it makes sense to me as BAMBOO, because that's how I think of it...
-- "BAMBOO" goes here.
local BAMBOO = "mcl_bamboo:bamboo"
local BAMBOO_PLANK = BAMBOO .. "_plank"

View File

@ -7,8 +7,6 @@
-- LOCALS
local modname = minetest.get_current_modname()
-- Used everywhere. Often this is just the name, but it makes sense to me as BAMBOO, because that's how I think of it...
-- "BAMBOO" goes here.
local BAMBOO = "mcl_bamboo:bamboo"
mcl_bamboo = {}

View File

@ -5,8 +5,6 @@
--- These are all of the fuel recipes and all of the crafting recipes, consolidated into one place.
--- Copyright (C) 2022 - 2023, Michieal. See License.txt
-- Used everywhere. Often this is just the name, but it makes sense to me as BAMBOO, because that's how I think of it...
-- "BAMBOO" goes here.
local BAMBOO = "mcl_bamboo:bamboo"
local BAMBOO_PLANK = BAMBOO .. "_plank"
-- Craftings