forked from VoxeLibre/VoxeLibre
Merge pull request 'dogshoot_enhancments/mob_fire_mechs' (#2872) from dogshoot_enhancments/mob_fire_mechs into master
Reviewed-on: MineClone2/MineClone2#2872 Reviewed-by: cora <cora@noreply.git.minetest.land>
This commit is contained in:
commit
138c0e8668
|
@ -320,6 +320,10 @@ local collision = function(self)
|
||||||
local ent = object:get_luaentity()
|
local ent = object:get_luaentity()
|
||||||
if object:is_player() or (ent and ent.is_mob and object ~= self.object) then
|
if object:is_player() or (ent and ent.is_mob and object ~= self.object) then
|
||||||
|
|
||||||
|
if object:is_player() and mcl_burning.is_burning(self.object) then
|
||||||
|
mcl_burning.set_on_fire(object, 4)
|
||||||
|
end
|
||||||
|
|
||||||
local pos2 = object:get_pos()
|
local pos2 = object:get_pos()
|
||||||
local vec = {x = pos.x - pos2.x, z = pos.z - pos2.z}
|
local vec = {x = pos.x - pos2.x, z = pos.z - pos2.z}
|
||||||
local force = (width + 0.5) - vector.distance(
|
local force = (width + 0.5) - vector.distance(
|
||||||
|
@ -1345,6 +1349,7 @@ local do_env_damage = function(self)
|
||||||
self.health = self.health - self.lava_damage
|
self.health = self.health - self.lava_damage
|
||||||
|
|
||||||
effect(pos, 5, "fire_basic_flame.png", nil, nil, 1, nil)
|
effect(pos, 5, "fire_basic_flame.png", nil, nil, 1, nil)
|
||||||
|
mcl_burning.set_on_fire(self.object, 10)
|
||||||
|
|
||||||
if check_for_death(self, "lava", {type = "environment",
|
if check_for_death(self, "lava", {type = "environment",
|
||||||
pos = pos, node = self.standing_in}) then
|
pos = pos, node = self.standing_in}) then
|
||||||
|
@ -1361,6 +1366,7 @@ local do_env_damage = function(self)
|
||||||
self.health = self.health - self.fire_damage
|
self.health = self.health - self.fire_damage
|
||||||
|
|
||||||
effect(pos, 5, "fire_basic_flame.png", nil, nil, 1, nil)
|
effect(pos, 5, "fire_basic_flame.png", nil, nil, 1, nil)
|
||||||
|
mcl_burning.set_on_fire(self.object, 5)
|
||||||
|
|
||||||
if check_for_death(self, "fire", {type = "environment",
|
if check_for_death(self, "fire", {type = "environment",
|
||||||
pos = pos, node = self.standing_in}) then
|
pos = pos, node = self.standing_in}) then
|
||||||
|
@ -2978,7 +2984,7 @@ local do_states = function(self, dtime)
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif self.attack_type == "dogfight"
|
elseif self.attack_type == "dogfight"
|
||||||
or (self.attack_type == "dogshoot" and dogswitch(self, dtime) == 2)
|
or (self.attack_type == "dogshoot" and dogswitch(self, dtime) == 2) and (dist >= self.avoid_distance or not self.shooter_avoid_enemy)
|
||||||
or (self.attack_type == "dogshoot" and dist <= self.reach and dogswitch(self) == 0) then
|
or (self.attack_type == "dogshoot" and dist <= self.reach and dogswitch(self) == 0) then
|
||||||
|
|
||||||
if self.fly
|
if self.fly
|
||||||
|
@ -3155,7 +3161,7 @@ local do_states = function(self, dtime)
|
||||||
|
|
||||||
elseif self.attack_type == "shoot"
|
elseif self.attack_type == "shoot"
|
||||||
or (self.attack_type == "dogshoot" and dogswitch(self, dtime) == 1)
|
or (self.attack_type == "dogshoot" and dogswitch(self, dtime) == 1)
|
||||||
or (self.attack_type == "dogshoot" and dist > self.reach and dogswitch(self) == 0) then
|
or (self.attack_type == "dogshoot" and (dist > self.reach or dist < self.avoid_distance and self.shooter_avoid_enemy) and dogswitch(self) == 0) then
|
||||||
|
|
||||||
p.y = p.y - .5
|
p.y = p.y - .5
|
||||||
s.y = s.y + .5
|
s.y = s.y + .5
|
||||||
|
@ -3173,7 +3179,27 @@ local do_states = function(self, dtime)
|
||||||
|
|
||||||
yaw = set_yaw(self, yaw, 0, dtime)
|
yaw = set_yaw(self, yaw, 0, dtime)
|
||||||
|
|
||||||
|
local stay_away_from_player = vector.new(0,0,0)
|
||||||
|
|
||||||
|
--strafe back and fourth
|
||||||
|
|
||||||
|
--stay away from player so as to shoot them
|
||||||
|
if dist < self.avoid_distance and self.shooter_avoid_enemy then
|
||||||
|
set_animation(self, "shoot")
|
||||||
|
stay_away_from_player=vector.multiply(vector.direction(p, s), 0.33)
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.strafes then
|
||||||
|
if not self.strafe_direction then
|
||||||
|
self.strafe_direction = 1.57
|
||||||
|
end
|
||||||
|
if math.random(40) == 1 then
|
||||||
|
self.strafe_direction = self.strafe_direction*-1
|
||||||
|
end
|
||||||
|
self.acc = vector.add(vector.multiply(vector.rotate_around_axis(vector.direction(s, p), vector.new(0,1,0), self.strafe_direction), 0.3*self.walk_velocity), stay_away_from_player)
|
||||||
|
else
|
||||||
set_velocity(self, 0)
|
set_velocity(self, 0)
|
||||||
|
end
|
||||||
|
|
||||||
local p = self.object:get_pos()
|
local p = self.object:get_pos()
|
||||||
p.y = p.y + (self.collisionbox[2] + self.collisionbox[5]) / 2
|
p.y = p.y + (self.collisionbox[2] + self.collisionbox[5]) / 2
|
||||||
|
@ -4664,6 +4690,9 @@ minetest.register_entity(name, {
|
||||||
|
|
||||||
|
|
||||||
-- MCL2 extensions
|
-- MCL2 extensions
|
||||||
|
shooter_avoid_enemy = def.shooter_avoid_enemy,
|
||||||
|
strafes = def.strafes,
|
||||||
|
avoid_distance = def.avoid_distance or 9,
|
||||||
teleport = teleport,
|
teleport = teleport,
|
||||||
do_teleport = def.do_teleport,
|
do_teleport = def.do_teleport,
|
||||||
spawn_class = def.spawn_class,
|
spawn_class = def.spawn_class,
|
||||||
|
|
|
@ -206,7 +206,7 @@ function mcl_mobs.drive(entity, moving_anim, stand_anim, can_fly, dtime)
|
||||||
-- move forwards
|
-- move forwards
|
||||||
if ctrl.up then
|
if ctrl.up then
|
||||||
|
|
||||||
entity.v = entity.v + entity.accel / 10
|
entity.v = entity.v + entity.accel / 10 * entity.run_velocity / 2.6
|
||||||
|
|
||||||
-- move backwards
|
-- move backwards
|
||||||
elseif ctrl.down then
|
elseif ctrl.down then
|
||||||
|
|
|
@ -181,6 +181,12 @@ local horse = {
|
||||||
on_spawn = update_textures,
|
on_spawn = update_textures,
|
||||||
do_custom = function(self, dtime)
|
do_custom = function(self, dtime)
|
||||||
|
|
||||||
|
if not self._horse_speed then
|
||||||
|
self._horse_speed = math.random(486, 1457)/100
|
||||||
|
elseif self.run_velocity ~= self._horse_speed then
|
||||||
|
self.run_velocity = self._horse_speed
|
||||||
|
end
|
||||||
|
|
||||||
-- set needed values if not already present
|
-- set needed values if not already present
|
||||||
if not self._regentimer then
|
if not self._regentimer then
|
||||||
self._regentimer = 0
|
self._regentimer = 0
|
||||||
|
|
|
@ -30,6 +30,8 @@ local skeleton = {
|
||||||
curiosity = 6,
|
curiosity = 6,
|
||||||
visual = "mesh",
|
visual = "mesh",
|
||||||
mesh = "mobs_mc_skeleton.b3d",
|
mesh = "mobs_mc_skeleton.b3d",
|
||||||
|
shooter_avoid_enemy = true,
|
||||||
|
strafes = true,
|
||||||
textures = { {
|
textures = { {
|
||||||
"mcl_bows_bow_0.png", -- bow
|
"mcl_bows_bow_0.png", -- bow
|
||||||
"mobs_mc_skeleton.png", -- skeleton
|
"mobs_mc_skeleton.png", -- skeleton
|
||||||
|
|
Loading…
Reference in New Issue