Move zombie visual size update to mcl_mobs

This commit is contained in:
cora 2022-09-15 21:30:41 +02:00
parent 5a5b83399c
commit ed8dc1d137
3 changed files with 10 additions and 8 deletions

View File

@ -3593,6 +3593,13 @@ local mob_activate = function(self, staticdata, def, dtime)
if not self.nametag then
self.nametag = def.nametag
end
if not self.custom_visual_size then
-- Remove saved visual_size on old existing entites.
-- Old entities were 3 now it's 1.
self.visual_size = nil
self.object:set_properties({visual_size = self.visual_size})
self.base_size = self.visual_size
end
-- set anything changed above
self.object:set_properties(self)

View File

@ -259,6 +259,7 @@ functions needed for the mob to work properly which contains the following:
that are bred in a different way.
'pick_up' table of itemstrings the mob will pick up (e.g. for breeding)
'on_pick_up' function that will be called on item pickup - return true to not pickup the item
'custom_visual_size' will not reset visual_size from the base class on reload
mobs:gopath(self,target,callback_arrived) pathfind a way to target and run callback on arrival
@ -433,7 +434,7 @@ true the mob will not spawn.
MineClone 2 extensions
----------------------
mobs:spawn_child(pos, mob_type)
mcl_mobs:spawn_child(pos, mob_type)
This function spawns a mob as a child. The parameter mob_type is the
entitystring of the new mob.
@ -443,6 +444,7 @@ mobs:death_effect(pos, collisionbox)
Create death particles at pos with the given collisionbox.
mcl_mobs.spawn(pos,name/entity name)
Making Arrows
-------------

View File

@ -94,13 +94,6 @@ local zombie = {
view_range = 16,
attack_type = "dogfight",
harmed_by_heal = true,
on_spawn = function(self)
-- Remove saved visual_size on old existing entites.
-- Old entities were 3 now it's 1.
self.visual_size = nil
self.object:set_properties({visual_size = self.visual_size})
self.base_size = self.visual_size
end,
attack_npcs = true,
}