1
0
mirror of https://codeberg.org/tenplus1/mobs_redo.git synced 2025-07-29 13:30:22 +02:00

Compare commits

...

4 Commits

Author SHA1 Message Date
1271570780 nil check in do_states 2020-07-20 18:10:08 +01:00
ec3c6fb518 update api.txt 2020-07-20 07:36:39 +01:00
c4f56f4204 nill check for follow_flop 2020-07-20 07:32:24 +01:00
4814f53885 nil check for get_distance 2020-07-20 07:27:55 +01:00
2 changed files with 5 additions and 5 deletions

View File

@ -6,7 +6,7 @@ local use_cmi = minetest.global_exists("cmi")
mobs = {
mod = "redo",
version = "20200717",
version = "20200720",
intllib = S,
invis = minetest.global_exists("invisibility") and invisibility or {}
}
@ -195,7 +195,7 @@ end
-- calculate distance
local get_distance = function(a, b)
if not a or not b then return 50 end -- nil check
local x, y, z = a.x - b.x, a.y - b.y, a.z - b.z
return square(x * x + y * y + z * z)
@ -2001,7 +2001,7 @@ function mob_class:follow_flop()
and self.state ~= "attack"
and self.state ~= "runaway" then
local s = self.object:get_pos()
local s = self.object:get_pos() ; if not s then return end
local players = minetest.get_connected_players()
for n = 1, #players do
@ -2132,7 +2132,7 @@ end
-- execute current state (stand, walk, run, attacks)
function mob_class:do_states(dtime)
local yaw = self.object:get_yaw() or 0
local yaw = self.object:get_yaw() ; if not yaw then return end
if self.state == "stand" then

View File

@ -31,7 +31,7 @@ functions needed for the mob to work properly which contains the following:
'hp_max' has the maximum health value the mob can spawn with.
'armor' holds strength of mob, 100 is normal, lower is more powerful
and needs more hits and better weapons to kill.
'passive' when true allows animals to defend themselves when hit,
'passive' when false allows animals to defend themselves when hit,
otherwise they amble onwards.
'walk_velocity' is the speed that your mob can walk around.
'run_velocity' is the speed your mob can run with, usually when attacking.