@@ -87,13 +87,74 @@ package com.ankamagames.atouin.entities.behaviours.movements
8787 Atouin. getInstance (). handler. process(new EntityMovementStartMessage(entity));
8888 }
8989
90- public function synchroniseSubEntitiesPosition (entityRef :IMovable , subEntityContainer :DisplayObject = null ) : void {
91- /*
92- * Decompilation error
93- * Code may be obfuscated
94- * Error type: TranslateException
95- */
96- throw new IllegalOperationError ("Not decompiled due to error" );
90+ public function synchroniseSubEntitiesPosition (entityRef :IMovable , subEntityContainer :DisplayObject = null ) : void {
91+ var ts: TiphonSprite = null ;
92+ var carriedEntity: IMovable = null ;
93+ var subEntities: Array = null ;
94+ var subEntity:* = undefined ;
95+ var mount: TiphonSprite = null ;
96+ var subSubEntities: Array = null ;
97+ var subSubEntity:* = undefined ;
98+ if (entityRef is TiphonSprite)
99+ {
100+ ts = entityRef as TiphonSprite;
101+ if ((subEntityContainer) && (subEntityContainer is TiphonSprite))
102+ {
103+ ts = TiphonSprite(subEntityContainer);
104+ }
105+ if (ts. carriedEntity)
106+ {
107+ carriedEntity = ts. carriedEntity as IMovable;
108+ }
109+ else
110+ {
111+ mount = ts. getSubEntitySlot(2 ,0 ) as TiphonSprite;
112+ if ((mount) && (mount. carriedEntity))
113+ {
114+ carriedEntity = mount. carriedEntity as IMovable;
115+ }
116+ }
117+ while (carriedEntity)
118+ {
119+ if ((carriedEntity. position ) && (entityRef. position ))
120+ {
121+ carriedEntity. position . x = entityRef. position . x ;
122+ carriedEntity. position . y = entityRef. position . y ;
123+ carriedEntity. position . cellId = entityRef. position . cellId;
124+ }
125+ carriedEntity = (carriedEntity as TiphonSprite). carriedEntity as IMovable;
126+ }
127+ subEntities = ts. getSubEntitiesList();
128+ for each (subEntity in subEntities)
129+ {
130+ if (subEntity is IMovable)
131+ {
132+ if ((subEntity. position ) && (entityRef. position ))
133+ {
134+ subEntity. position . x = entityRef. position . x ;
135+ subEntity. position . y = entityRef. position . y ;
136+ }
137+ if ((subEntity. movementBehavior) && (! (subEntity == entityRef)))
138+ {
139+ subEntity. movementBehavior. synchroniseSubEntitiesPosition(subEntity);
140+ }
141+ }
142+ else
143+ {
144+ if (subEntity is TiphonSprite)
145+ {
146+ subSubEntities = TiphonSprite(subEntity). getSubEntitiesList();
147+ for each (subSubEntity in subSubEntities)
148+ {
149+ if ((subSubEntity is IMovable) && (subSubEntity. movementBehavior) && (! (subSubEntity == entityRef)))
150+ {
151+ IMovable(subSubEntity). movementBehavior. synchroniseSubEntitiesPosition(entityRef,subEntity);
152+ }
153+ }
154+ }
155+ }
156+ }
157+ }
97158 }
98159
99160 public function jump (entity :IMovable , newPosition :MapPoint ) : void {
0 commit comments