Merge pull request 'Move zombie visual size update to mcl_mobs' (#2664) from mobs_visual_size into master

Reviewed-on: MineClone2/MineClone2#2664
This commit is contained in:
cora 2022-09-16 16:23:58 +00:00
commit f3bee72796
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 and not self.child 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,
}