Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Another pack of fixes for 2024.12 #1890

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions mods/lord/Core/projectiles/src/projectiles/entity.lua
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,16 @@ local function punch_target(projectile, target, damage_groups, remove_after_hit,
projectile.object:remove()
end

--- @param entity LuaEntity entity to check if it is a projectile
--- @param entity ObjectRef entity to check if it is a projectile
--- @return boolean true, if it is a projectile, or false
local function is_entity_projectile(entity)
if not entity or not entity:get_luaentity() then
return
end
local entity_name = entity:get_luaentity().name
local registered_projectiles = projectiles.get_projectiles()
for _, reg in pairs(registered_projectiles) do
if reg.entity_name == entity:get_luaentity().name then
if reg.entity_name == entity_name then
return true
end
end
Expand Down Expand Up @@ -106,7 +110,7 @@ end

-- Hit handling depending on target
--- @param projectile LuaEntity projectile entity
--- @param target LuaEntity target entity
--- @param target ObjectRef target entity
--- @param damage_groups table damage groups table (see Minetest API)
--- @param velocity vector projectile velocity
local function hit_handling(projectile, target, damage_groups, velocity)
Expand All @@ -115,12 +119,12 @@ local function hit_handling(projectile, target, damage_groups, velocity)
return punch_target(projectile, target, damage_groups, projectile._remove_on_object_hit, { fleshy = damage })
end
-- Hit player
if target:is_player() then
if target and target:is_player() then
play_sound_on_hit(projectile, "object")
hit()
else
-- Hit another projectile
if is_entity_projectile(target) then
if target and is_entity_projectile(target) then
projectile.object:set_acceleration({x = 0, y = GRAVITY * -1, z = 0})
target:set_acceleration({x = 0, y = GRAVITY * -1, z = 0})
play_sound_on_hit(projectile, "object")
Expand Down
10 changes: 5 additions & 5 deletions mods/lord/Tools/lord_projectiles/src/lord_projectiles/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,8 @@ return {
},
entity_reg = {
initial_properties = {
visual = "item",
wield_item = "lord_projectiles:fire_ball",
visual = "sprite",
textures = { "mobs_fireball.png" },
visual_size = vector.new(1, 1, 1),
},
max_speed = 40,
Expand Down Expand Up @@ -269,7 +269,7 @@ return {
local rad_vec = vector.new(radius, radius, radius)
local min_pos = vector.subtract(pos, rad_vec)
local max_pos = vector.add(pos, rad_vec)
projectiles.explode_area(pos, radius, 5, projectile.object, { fleshy = 15 })
projectiles.explode_area(pos, radius, 5, projectile.object, { fire = 10 })
minetest.add_particlespawner({
pos = {
min = min_pos,
Expand Down Expand Up @@ -316,8 +316,8 @@ return {
},
entity_reg = {
initial_properties = {
visual = "item",
wield_item = "lord_projectiles:dark_ball",
visual = "sprite",
textures = { "lottmobs_darkball.png" },
visual_size = vector.new(1, 1, 1),
},
max_speed = 20,
Expand Down
Loading