mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-11-24 20:03:45 +01:00
Improved ghast combat
* ghast fireballs can now hit the shooter (used to just fly through) * improved ghast aim * increased ghast fireball lifetime * mob projectile lifetime is now counted in seconds (was in ticks) * improved variable naming * improved default mob projectile deflecting (applies to ghast fireball)
This commit is contained in:
parent
f41990c1d0
commit
1478960b7f
@ -362,12 +362,12 @@ function mcl_mobs.register_arrow(name, def)
|
||||
collisionbox = {0, 0, 0, 0, 0, 0}, -- remove box around arrows
|
||||
timer = 0,
|
||||
switch = 0,
|
||||
_lifetime = def._lifetime or 150,
|
||||
_lifetime = def._lifetime or 7,
|
||||
owner_id = def.owner_id,
|
||||
rotate = def.rotate,
|
||||
on_punch = def.on_punch or function(self)
|
||||
local vel = self.object:get_velocity()
|
||||
self.object:set_velocity({x=vel.x * -1, y=vel.y * -1, z=vel.z * -1})
|
||||
on_punch = def.on_punch or function(self, puncher, time_from_last_punch, tool_capabilities, dir, damage)
|
||||
local vel = self.object:get_velocity():length()
|
||||
self.object:set_velocity({x=dir.x * vel, y=dir.y * vel, z=dir.z * vel})
|
||||
end,
|
||||
collisionbox = def.collisionbox or {0, 0, 0, 0, 0, 0},
|
||||
automatic_face_movement_dir = def.rotate
|
||||
@ -377,7 +377,7 @@ function mcl_mobs.register_arrow(name, def)
|
||||
|
||||
on_step = def.on_step or function(self, dtime)
|
||||
|
||||
self.timer = self.timer + 1
|
||||
self.timer = self.timer + dtime
|
||||
|
||||
local pos = self.object:get_pos()
|
||||
|
||||
@ -443,24 +443,24 @@ function mcl_mobs.register_arrow(name, def)
|
||||
|
||||
if self.hit_player or self.hit_mob or self.hit_object then
|
||||
|
||||
for _,player in pairs(minetest.get_objects_inside_radius(pos, 1.5)) do
|
||||
for _,object in pairs(minetest.get_objects_inside_radius(pos, 1.5)) do
|
||||
|
||||
if self.hit_player
|
||||
and player:is_player() then
|
||||
and object:is_player() then
|
||||
|
||||
self.hit_player(self, player)
|
||||
self.hit_player(self, object)
|
||||
self.object:remove();
|
||||
return
|
||||
end
|
||||
|
||||
local entity = player:get_luaentity()
|
||||
local entity = object:get_luaentity()
|
||||
|
||||
if entity
|
||||
and self.hit_mob
|
||||
and entity.is_mob == true
|
||||
and tostring(player) ~= self.owner_id
|
||||
and (tostring(object) ~= self.owner_id or self.timer > 2)
|
||||
and entity.name ~= self.object:get_luaentity().name then
|
||||
self.hit_mob(self, player)
|
||||
self.hit_mob(self, object)
|
||||
self.object:remove();
|
||||
return
|
||||
end
|
||||
@ -468,9 +468,9 @@ function mcl_mobs.register_arrow(name, def)
|
||||
if entity
|
||||
and self.hit_object
|
||||
and (not entity.is_mob)
|
||||
and tostring(player) ~= self.owner_id
|
||||
and (tostring(object) ~= self.owner_id or self.timer > 2)
|
||||
and entity.name ~= self.object:get_luaentity().name then
|
||||
self.hit_object(self, player)
|
||||
self.hit_object(self, object)
|
||||
self.object:remove();
|
||||
return
|
||||
end
|
||||
|
@ -54,7 +54,7 @@ mcl_mobs.register_mob("mobs_mc:ghast", {
|
||||
attack_type = "dogshoot",
|
||||
arrow = "mobs_mc:fireball",
|
||||
shoot_interval = 3,
|
||||
shoot_offset = -5,
|
||||
shoot_offset = -0.5,
|
||||
dogshoot_switch = 1,
|
||||
dogshoot_count_max =1,
|
||||
passive = false,
|
||||
@ -109,6 +109,7 @@ mcl_mobs.register_arrow("mobs_mc:fireball", {
|
||||
textures = {"mcl_fire_fire_charge.png"},
|
||||
velocity = 5,
|
||||
collisionbox = {-.5, -.5, -.5, .5, .5, .5},
|
||||
_lifetime = 10,
|
||||
_is_fireball = true,
|
||||
|
||||
hit_player = function(self, player)
|
||||
|
@ -463,7 +463,7 @@ mcl_mobs.register_arrow("mobs_mc:wither_skull", {
|
||||
},
|
||||
velocity = 7,
|
||||
rotate = 90,
|
||||
_lifetime = 350,
|
||||
_lifetime = 15,
|
||||
on_punch = function(self) end,
|
||||
|
||||
-- direct hit
|
||||
@ -516,7 +516,7 @@ mcl_mobs.register_arrow("mobs_mc:wither_skull_strong", {
|
||||
},
|
||||
velocity = 4,
|
||||
rotate = 90,
|
||||
_lifetime = 500,
|
||||
_lifetime = 25,
|
||||
on_punch = function(self) end,
|
||||
|
||||
-- direct hit
|
||||
|
Loading…
Reference in New Issue
Block a user