Page 1 of 1

[1.6.7] cloneActor recursively removes fields; many bugs

Posted: Wed Jun 03, 2020 10:35 am
by minmay
So the Actor:cloneActor() method has a bunch of fields that it sets to nil on the cloned actor:

Code: Select all

-- alt_node fields (controls fields copied with cloneActor by default)
_M.clone_nodes = table.merge({running_fov=false, running_prev=false,
	-- spawning/death fields:
	make_escort=false, escort_quest=false, summon=false, on_added_to_level=false, on_added=false, clone_on_hit=false, on_die=false, die=false, self_ressurect=false,
	-- AI fields:
	on_acquire_target=false, seen_by=false,
	-- NPC interaction:
	on_take_hit=false,  can_talk=false,
	-- player fields:
	puuid=false, quests=false, random_escort_levels=false, achievements=false, achievement_data=false, game_ender=false,
	last_learnt_talents = false, died=false, died_times=false, killedBy=false, all_kills=false,     all_kills_kind=false,
},_M.clone_nodes, true)

Code: Select all

_M.clone_nodes = {player=false, x=false, y=false,
	fov_computed=false,     fov={v={actors={}, actors_dist={}}}, distance_map={v={}},
	_mo=false, _last_mo=false, add_displays=false,
	shader=false, shader_args=false,
}
This is nice. However, what's not nice is it also removes these fields from any tables in the actor, and any tables in those tables, and...

So here are a couple things that causes:
- When the recursive cloning reaches Corpathus, it removes the "summon" field on Corpathus - that field stores the function Corpathus uses to summon blightspawn. So when your Warden's Call clone tries to summon a blightspawn it gets an error instead.
- When it reaches Wintertide it removes the "x" and "y" fields of its "winterStorm" table, resulting in errors if you (or Greater Mummy Lord) have a winter storm going and then you use Forgery of Haze or whatever.

And probably a bunch more difficult-to-track-down bugs. Shouldn't it only remove these fields from the actor themselves?

Re: [1.6.7] cloneActor recursively removes fields; many bugs

Posted: Wed Jun 03, 2020 2:46 pm
by darkgod
It probably should indeed! Thanks :)