Skip to content

Commit

Permalink
Fix another crash. Change fire ball explosive damage to fire
Browse files Browse the repository at this point in the history
  • Loading branch information
Doloment committed Jan 2, 2025
1 parent 10ef3c8 commit 3b06a4d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions mods/lord/Core/projectiles/src/projectiles/entity.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,13 @@ end
--- @param entity LuaEntity 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 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 @@ -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
Original file line number Diff line number Diff line change
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

0 comments on commit 3b06a4d

Please sign in to comment.