mirror of
https://github.com/pandorabox-io/spacecannon.git
synced 2024-12-21 05:15:47 +01:00
Fix projectiles not damaging players (#20)
* fix: projectile not damaging players * feat: allow servers to control entity/player damage * tweak: lower cannon damage numbers a bit * fix: style
This commit is contained in:
parent
9f1a526dc6
commit
6737757471
13
cannon.lua
13
cannon.lua
@ -67,9 +67,10 @@ local register_spacecannon = function(def)
|
||||
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 1)
|
||||
local collided = false
|
||||
for _, obj in pairs(objs) do
|
||||
if obj:get_luaentity() ~= nil
|
||||
if (obj:is_player() or (obj:get_luaentity() ~= nil
|
||||
and obj:get_luaentity().name ~= self.name
|
||||
and obj:get_luaentity().name ~= "__builtin:item"
|
||||
and obj:get_luaentity().name ~= "__builtin:item"))
|
||||
and spacecannon.can_damage(obj)
|
||||
then
|
||||
collided = true
|
||||
obj:punch(self.object, 1.0, {
|
||||
@ -243,7 +244,7 @@ register_spacecannon({
|
||||
is_th = true,
|
||||
range = 1,
|
||||
storage_require_mod = 1,
|
||||
damage = 2,
|
||||
damage = 5,
|
||||
intensity = 1,
|
||||
timeout = 8,
|
||||
speed = 10,
|
||||
@ -259,7 +260,7 @@ register_spacecannon({
|
||||
range = 3,
|
||||
storage_require_mod = 3,
|
||||
intensity = 2,
|
||||
damage = 6,
|
||||
damage = 8,
|
||||
timeout = 8,
|
||||
speed = 5,
|
||||
penetration = 0,
|
||||
@ -300,7 +301,7 @@ register_spacecannon({
|
||||
range = 0,
|
||||
storage_require_mod = 1,
|
||||
intensity = 2,
|
||||
damage = 5,
|
||||
damage = 6,
|
||||
timeout = 10,
|
||||
speed = 9,
|
||||
penetration = 2,
|
||||
@ -324,7 +325,7 @@ register_spacecannon({
|
||||
range = 0,
|
||||
storage_require_mod = 1.5,
|
||||
intensity = 4,
|
||||
damage = 10,
|
||||
damage = 6,
|
||||
timeout = 15,
|
||||
speed = 10,
|
||||
penetration = 4,
|
||||
|
4
util.lua
4
util.lua
@ -63,6 +63,10 @@ spacecannon.can_destroy = function()
|
||||
return true
|
||||
end
|
||||
|
||||
spacecannon.can_damage = function(_obj)
|
||||
return true
|
||||
end
|
||||
|
||||
spacecannon.fire = function(pos, playername, color, speed, is_th, storage_require_mod)
|
||||
if not spacecannon.can_shoot(pos, playername) then
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user