forked from mtcontrib/mobs_redo
added explosion timer, explosion counts until out of view range
This commit is contained in:
parent
7c10fb7e27
commit
8dd6622855
28
api.lua
28
api.lua
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
mobs = {}
|
mobs = {}
|
||||||
mobs.mod = "redo"
|
mobs.mod = "redo"
|
||||||
mobs.version = "20171009"
|
mobs.version = "20171013"
|
||||||
|
|
||||||
|
|
||||||
-- Intllib
|
-- Intllib
|
||||||
@ -1710,18 +1710,18 @@ local do_states = function(self, dtime)
|
|||||||
|
|
||||||
yaw = set_yaw(self.object, yaw)
|
yaw = set_yaw(self.object, yaw)
|
||||||
|
|
||||||
if dist > self.reach then
|
-- start timer when inside reach
|
||||||
|
if dist < self.reach and not self.v_start then
|
||||||
if not self.v_start then
|
|
||||||
|
|
||||||
self.v_start = true
|
self.v_start = true
|
||||||
set_velocity(self, self.run_velocity)
|
|
||||||
self.timer = 0
|
|
||||||
self.blinktimer = 0
|
|
||||||
else
|
|
||||||
self.timer = 0
|
self.timer = 0
|
||||||
self.blinktimer = 0
|
self.blinktimer = 0
|
||||||
|
-- print ("=== explosion timer started", self.explosion_timer)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- walk right up to player when timer active
|
||||||
|
if dist < 1.5 and self.v_start then
|
||||||
|
set_velocity(self, 0)
|
||||||
|
else
|
||||||
set_velocity(self, self.run_velocity)
|
set_velocity(self, self.run_velocity)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1730,9 +1730,8 @@ local do_states = function(self, dtime)
|
|||||||
else
|
else
|
||||||
set_animation(self, "walk")
|
set_animation(self, "walk")
|
||||||
end
|
end
|
||||||
else
|
|
||||||
set_velocity(self, 0)
|
if self.v_start then
|
||||||
set_animation(self, "punch")
|
|
||||||
|
|
||||||
self.timer = self.timer + dtime
|
self.timer = self.timer + dtime
|
||||||
self.blinktimer = (self.blinktimer or 0) + dtime
|
self.blinktimer = (self.blinktimer or 0) + dtime
|
||||||
@ -1750,7 +1749,9 @@ local do_states = function(self, dtime)
|
|||||||
self.blinkstatus = not self.blinkstatus
|
self.blinkstatus = not self.blinkstatus
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.timer > 3 then
|
-- print ("=== explosion timer", self.timer)
|
||||||
|
|
||||||
|
if self.timer > self.explosion_timer then
|
||||||
|
|
||||||
local pos = self.object:get_pos()
|
local pos = self.object:get_pos()
|
||||||
local radius = self.explosion_radius or 1
|
local radius = self.explosion_radius or 1
|
||||||
@ -2734,6 +2735,7 @@ minetest.register_entity(name, {
|
|||||||
pathfinding = def.pathfinding,
|
pathfinding = def.pathfinding,
|
||||||
immune_to = def.immune_to or {},
|
immune_to = def.immune_to or {},
|
||||||
explosion_radius = def.explosion_radius,
|
explosion_radius = def.explosion_radius,
|
||||||
|
explosion_timer = def.explosion_timer or 3,
|
||||||
custom_attack = def.custom_attack,
|
custom_attack = def.custom_attack,
|
||||||
double_melee_attack = def.double_melee_attack,
|
double_melee_attack = def.double_melee_attack,
|
||||||
dogshoot_switch = def.dogshoot_switch,
|
dogshoot_switch = def.dogshoot_switch,
|
||||||
|
3
api.txt
3
api.txt
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
MOB API (15th September 2017)
|
MOB API (13th October 2017)
|
||||||
|
|
||||||
The mob api is a function that can be called on by other mods to add new animals or monsters into minetest.
|
The mob api is a function that can be called on by other mods to add new animals or monsters into minetest.
|
||||||
|
|
||||||
@ -88,6 +88,7 @@ This functions registers a new mob as a Minetest entity.
|
|||||||
'custom_attack' when set this function is called instead of the normal mob melee attack, parameters are (self, to_attack)
|
'custom_attack' when set this function is called instead of the normal mob melee attack, parameters are (self, to_attack)
|
||||||
'double_melee_attack' if false then api will choose randomly between 'punch' and 'punch2' attack animations
|
'double_melee_attack' if false then api will choose randomly between 'punch' and 'punch2' attack animations
|
||||||
'explosion_radius' radius of explosion attack (defaults to 1)
|
'explosion_radius' radius of explosion attack (defaults to 1)
|
||||||
|
'explosion_timer' number of seconds before mob explodes while still inside view range.
|
||||||
'arrow' if the attack_type is "shoot" or "dogshoot" then the entity name of a pre-defined arrow is required, see below for arrow definition.
|
'arrow' if the attack_type is "shoot" or "dogshoot" then the entity name of a pre-defined arrow is required, see below for arrow definition.
|
||||||
'shoot_interval' the minimum shoot interval
|
'shoot_interval' the minimum shoot interval
|
||||||
'shoot_offset' +/- value to position arrow/fireball when fired
|
'shoot_offset' +/- value to position arrow/fireball when fired
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
Mobs Redo API (last updated 25th Sep 2017)
|
Mobs Redo API (last updated 13th Oct 2017)
|
||||||
==========================================
|
==========================================
|
||||||
|
|
||||||
Welcome to the world of mobs in minetest and hopefully an easy guide to defining
|
Welcome to the world of mobs in minetest and hopefully an easy guide to defining
|
||||||
@ -87,6 +87,8 @@ functions needed for the mob to work properly which contains the following:
|
|||||||
when inside view_range.
|
when inside view_range.
|
||||||
'explode' causes mob to explode when inside reach.
|
'explode' causes mob to explode when inside reach.
|
||||||
'explosion_radius' has the radius of the explosion which defaults to 1.
|
'explosion_radius' has the radius of the explosion which defaults to 1.
|
||||||
|
'explosion_timer' number of seconds before mob explodes while still
|
||||||
|
inside view range.
|
||||||
'arrow' holds the pre-defined arrow object to shoot when
|
'arrow' holds the pre-defined arrow object to shoot when
|
||||||
attacking.
|
attacking.
|
||||||
'dogshoot_switch' allows switching between attack types by using timers
|
'dogshoot_switch' allows switching between attack types by using timers
|
||||||
|
Loading…
Reference in New Issue
Block a user