ToME: the Tales of Maj'Eyal

[1.6.7] cloneActor recursively removes fields; many bugs
Page 1 of 1

Author:  minmay [ Wed Jun 03, 2020 10:35 am ]
Post subject:  [1.6.7] cloneActor recursively removes fields; many bugs

So the Actor:cloneActor() method has a bunch of fields that it sets to nil on the cloned actor:
-- 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)
_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?

Author:  darkgod [ Wed Jun 03, 2020 2:46 pm ]
Post subject:  Re: [1.6.7] cloneActor recursively removes fields; many bugs

It probably should indeed! Thanks :)

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group