Tweak mob shooting behaviour

This commit is contained in:
Wuzzy 2019-12-09 09:56:38 +01:00
parent 8a2e6d434d
commit 84ff24f8ed
3 changed files with 22 additions and 8 deletions

View File

@ -4,6 +4,7 @@
--License for code WTFPL and otherwise stated in readmes
local S = minetest.get_translator("mobs_mc")
local mod_bows = minetest.get_modpath("mcl_bows") ~= nil
--###################
--################### SKELETON
@ -31,7 +32,6 @@ local skeleton = {
random = "mobs_mc_skeleton_random",
death = "mobs_mc_skeleton_death",
damage = "mobs_mc_skeleton_hurt",
shoot_attack = "mcl_bows_bow_shoot",
distance = 16,
},
walk_velocity = 1.2,
@ -80,10 +80,14 @@ local skeleton = {
attack_type = "dogshoot",
arrow = "mcl_bows:arrow_entity",
shoot_arrow = function(self, pos, dir)
mcl_bows.shoot_arrow("mcl_bows:arrow", pos, dir, self.object:get_yaw(), self.object)
if mod_bows then
-- 2-4 damage per arrow
local dmg = math.max(4, math.random(2, 8))
mcl_bows.shoot_arrow("mcl_bows:arrow", pos, dir, self.object:get_yaw(), self.object, nil, dmg)
end
end,
shoot_interval = 2.5,
shoot_offset = 1,
shoot_interval = 2,
shoot_offset = 1.5,
dogshoot_switch = 1,
dogshoot_count_max =1.8,
}

View File

@ -8,6 +8,7 @@ local S = minetest.get_translator("mobs_mc")
local snow_trail_frequency = 0.5 -- Time in seconds for checking to add a new snow trail
local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false
local mod_throwing = minetest.get_modpath("mcl_throwing") ~= nil
local gotten_texture = {
"mobs_mc_snowman.png",
@ -51,7 +52,12 @@ mobs:register_mob("mobs_mc:snowman", {
jump = true,
makes_footstep_sound = true,
attack_type = "shoot",
arrow = "mobs_mc:snowball_entity",
arrow = "mcl_throwing:snowball_entity",
shoot_arrow = function(self, pos, dir)
if mod_throwing then
mcl_throwing.throw("mcl_throwing:snowball", pos, dir)
end
end,
shoot_interval = 1,
shoot_offset = 1,
animation = {

View File

@ -4,15 +4,20 @@
--License for code WTFPL and otherwise stated in readmes
local S = minetest.get_translator("mobs_mc")
local mod_bows = minetest.get_modpath("mcl_bows") ~= nil
mobs:register_mob("mobs_mc:illusioner", {
type = "monster",
attack_type = "shoot",
shoot_interval = 0.5,
shoot_interval = 2.5,
shoot_offset = 1.5,
arrow = "mcl_bows:arrow_entity",
shoot_arrow = function(self, pos, dir)
mcl_bows.shoot_arrow("mcl_bows:arrow", pos, dir, self.object:get_yaw(), self.object)
if mod_bows then
-- 1-4 damage per arrow
local dmg = math.random(1, 4)
mcl_bows.shoot_arrow("mcl_bows:arrow", pos, dir, self.object:get_yaw(), self.object, nil, dmg)
end
end,
hp_min = 32,
hp_max = 32,
@ -26,7 +31,6 @@ mobs:register_mob("mobs_mc:illusioner", {
}, },
sounds = {
-- TODO: more sounds
shoot_attack = "mcl_bows_bow_shoot",
distance = 16,
},
visual_size = {x=3, y=3},