[1.6.7] cloneActor recursively removes fields; many bugs

Make all T-Engine/ToME 4 bug reports here

Moderator: Moderator

Post Reply
Posts: 280
Joined: Fri Sep 07, 2012 1:34 am

[1.6.7] cloneActor recursively removes fields; many bugs

#1 Post 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?

Master of Eyal
Posts: 10738
Joined: Wed Jul 24, 2002 9:26 pm
Location: Angolwen

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

#2 Post by darkgod »

It probably should indeed! Thanks :)
[tome] joylove: You can't just release an expansion like one would release a Kraken XD
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning ;)

Post Reply