From bbcfb3fdb171053e3142854f658860e7693f31d1 Mon Sep 17 00:00:00 2001 From: jordan4ibanez Date: Thu, 15 Apr 2021 11:33:09 -0400 Subject: [PATCH] Randomize walking or standing on spawn in --- mods/ENTITIES/mcl_mobs/api.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index 58fee205f..102e07c7c 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -373,6 +373,8 @@ end +local state_randomization = {"stand", "walk"} + -- get entity staticdata local mob_staticdata = function(self) @@ -394,7 +396,7 @@ local mob_staticdata = function(self) self.remove_ok = true self.attack = nil self.following = nil - self.state = "stand" + self.state = state_randomization[math.random(1,#state_randomization)] if use_cmi then self.serialized_cmi_components = cmi.serialize_components(self._cmi_components) @@ -1043,6 +1045,8 @@ minetest.register_entity(name, { automatic_face_movement_dir = def.rotate or 0, -- 0=front, 90=side, 180=back, 270=side2 automatic_face_movement_max_rotation_per_sec = 270, --degrees backface_culling = true, + walk_timer = 0, + stand_timer = 0, --end j4i stuff -- MCL2 extensions