mirror of
https://github.com/ElCeejo/animalia.git
synced 2025-04-30 05:21:40 -04:00
Merge c5ce85e802
into 8954aa3493
This commit is contained in:
commit
73dda9435b
2 changed files with 12 additions and 8 deletions
|
@ -527,9 +527,9 @@ function animalia.action_wander_walk(self, timer, pos2, speed, anim)
|
|||
local check_timer = 0.25
|
||||
timer = timer or 2
|
||||
pos2 = pos2 or {
|
||||
x = pos.x + random(width, -width),
|
||||
x = pos.x + random(-width, width),
|
||||
y = pos.y,
|
||||
z = pos.z + random(width, -width)
|
||||
z = pos.z + random(-width, width)
|
||||
}
|
||||
local function func(_self)
|
||||
pos = _self.object:get_pos()
|
||||
|
@ -573,9 +573,9 @@ function animalia.action_wander_fly(self, timer, pos2)
|
|||
local check_timer = 0.25
|
||||
timer = timer or 2
|
||||
pos2 = pos2 or {
|
||||
x = pos.x + random(width, -width),
|
||||
y = pos.y + random(width, -width),
|
||||
z = pos.z + random(width, -width)
|
||||
x = pos.x + random(-width, width),
|
||||
y = pos.y + random(-width, width),
|
||||
z = pos.z + random(-width, width)
|
||||
}
|
||||
local function func(_self)
|
||||
pos = _self.object:get_pos()
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
-----------
|
||||
|
||||
local random = math.random
|
||||
-- Like `random`, but swaps `from` and `to` if needed.
|
||||
local function randint(from, to)
|
||||
return random(math.min(from, to), math.max(from, to))
|
||||
end
|
||||
|
||||
local follows = {}
|
||||
|
||||
|
@ -266,9 +270,9 @@ creatura.register_mob("animalia:horse", {
|
|||
tex_no = mate_ent.texture_no
|
||||
end
|
||||
ent:memorize("texture_no", tex_no)
|
||||
ent:memorize("speed", random(mate_ent.speed, self.speed))
|
||||
ent:memorize("jump_power", random(mate_ent.jump_power, self.jump_power))
|
||||
ent:memorize("max_health", random(mate_ent.max_health, self.max_health))
|
||||
ent:memorize("speed", randint(mate_ent.speed, self.speed))
|
||||
ent:memorize("jump_power", randint(mate_ent.jump_power, self.jump_power))
|
||||
ent:memorize("max_health", randint(mate_ent.max_health, self.max_health))
|
||||
ent.speed = ent:recall("speed")
|
||||
ent.jump_power = ent:recall("jump_power")
|
||||
ent.max_health = ent:recall("max_health")
|
||||
|
|
Loading…
Add table
Reference in a new issue