@@ -11,28 +11,48 @@ namespace Celeste.Mod.CherryHelper
1111 public class NonReturnSokoban : Solid
1212 {
1313
14- public NonReturnSokoban ( Vector2 position , float width , float height , Axes axes , bool chillOut = false , bool altTexture = false ) : base ( position , width , height , false )
15- {
16- this . altTexture = altTexture ;
17- this . fill = altTexture ? Calc . HexToColor ( "C38A06" ) : Calc . HexToColor ( "242262" ) ;
18- altTextureString = ( altTexture ? "objects/noReturnSokoban/" : "objects/noReturnSokobanAlt/" ) ;
14+ private string spriteDirectory ;
15+ public NonReturnSokoban ( EntityData data , Vector2 offset ) : base ( data . Position + offset , data . Width , data . Height , false ) {
16+ axes = data . Enum ( "axes" , Axes . Both ) ;
17+ chillOut = data . Bool ( "chillOut" , false ) ;
18+
19+ if ( data . Bool ( "reskinnable" ) ) {
20+ P_Crushing = new ParticleType ( P_Crushing ) {
21+ Color = Calc . HexToColor ( data . Attr ( "crushParticleColor1" , "ff66e2" ) ) ,
22+ Color2 = Calc . HexToColor ( data . Attr ( "crushParticleColor2" , "68fcff" ) ) ,
23+ } ;
24+
25+ P_Activate = new ParticleType ( P_Activate ) {
26+ Color = Calc . HexToColor ( data . Attr ( "activateParticleColor1" , "5fcde4" ) ) ,
27+ Color2 = Calc . HexToColor ( data . Attr ( "activateParticleColor2" , "ffffff" ) ) ,
28+ } ;
29+
30+ spriteDirectory = data . Attr ( "spriteDirectory" , "objects/noReturnSokobanAlt" ) ;
31+ fill = Calc . HexToColor ( data . Attr ( "fillColor" , "242262" ) ) ;
32+ } else if ( data . Bool ( "altTexture" , true ) ) {
33+ spriteDirectory = data . Attr ( "spriteDirectory" , "objects/noReturnSokobanAlt" ) ;
34+ fill = Calc . HexToColor ( data . Attr ( "fillColor" , "242262" ) ) ;
35+ } else {
36+ spriteDirectory = "objects/noReturnSokoban" ;
37+ fill = Calc . HexToColor ( "c38a06" ) ;
38+ }
39+
40+
1941 this . idleImages = new List < Image > ( ) ;
2042 this . activeTopImages = new List < Image > ( ) ;
2143 this . activeRightImages = new List < Image > ( ) ;
2244 this . activeLeftImages = new List < Image > ( ) ;
2345 this . activeBottomImages = new List < Image > ( ) ;
2446 this . OnDashCollide = new DashCollision ( this . OnDashed ) ;
2547 this . returnStack = new List < NonReturnSokoban . MoveState > ( ) ;
26- this . chillOut = chillOut ;
2748 this . giant = ( Width >= 48f && Height >= 48f && chillOut ) ;
2849 this . canActivate = true ;
2950 this . attackCoroutine = new Coroutine ( true ) ;
3051 this . attackCoroutine . RemoveOnComplete = false ;
3152 Add ( this . attackCoroutine ) ;
32- List < MTexture > atlasSubtextures = GFX . Game . GetAtlasSubtextures ( altTextureString + "block" ) ;
53+ List < MTexture > atlasSubtextures = GFX . Game . GetAtlasSubtextures ( spriteDirectory + "/ block" ) ;
3354 MTexture idle ;
34- switch ( axes )
35- {
55+ switch ( axes ) {
3656 default :
3757 idle = atlasSubtextures [ 3 ] ;
3858 this . canMoveHorizontally = ( this . canMoveVertically = true ) ;
@@ -48,21 +68,43 @@ public NonReturnSokoban(Vector2 position, float width, float height, Axes axes,
4868 this . canMoveVertically = true ;
4969 break ;
5070 }
51- if ( ! altTexture )
52- {
53- Add ( this . face = GFX . SpriteBank . Create ( "NoReturnSokobanAlt_face" ) ) ;
54- }
55- else
56- {
57- Add ( this . face = GFX . SpriteBank . Create ( "NoReturnSokoban_face" ) ) ;
58- }
59- this . face . Position = new Vector2 ( Width , Height ) / 2f ;
60- this . face . Play ( "idle" , false , false ) ;
61- this . face . OnLastFrame = delegate ( string f )
62- {
71+ Add ( face = new Sprite ( GFX . Game , spriteDirectory + "/" ) ) ;
72+ face . Position = new Vector2 ( Width , Height ) / 2f ;
73+ if ( giant ) {
74+ /*
75+ <Loop id="idle" path="giant_block" frames="0" delay="0.08"/>
76+ <Anim id="hurt" path="giant_block" frames="8-12" delay="0.08" goto="idle"/>
77+ <Anim id="hit" path="giant_block" frames="0-5" delay="0.08"/>
78+ <Loop id="right" path="giant_block" frames="6,7" delay="0.08"/>
79+ */
80+ face . AddLoop ( "idle" , "giant_block" , 0.08f , 0 ) ;
81+ face . Add ( "hurt" , "giant_block" , 0.08f , "idle" , 8 , 9 , 10 , 11 , 12 ) ;
82+ face . Add ( "hit" , "giant_block" , 0.08f , 0 , 1 , 2 , 3 , 4 , 5 ) ;
83+ face . AddLoop ( "right" , "giant_block" , 0.08f , 6 , 7 ) ;
84+ } else {
85+ /*
86+ <Loop id="idle" path="idle_face" delay="0.08"/>
87+ <Anim id="hurt" path="hurt" frames="3-12" delay="0.08" goto="idle"/>
88+ <Anim id="hit" path="hit" delay="0.08"/>
89+ <Loop id="left" path="hit_left" delay="0.08"/>
90+ <Loop id="right" path="hit_right" delay="0.08"/>
91+ <Loop id="up" path="hit_up" delay="0.08"/>
92+ <Loop id="down" path="hit_down" delay="0.08"/>
93+ */
94+
95+ face . AddLoop ( "idle" , "idle_face" , 0.08f ) ;
96+ face . Add ( "hurt" , "hurt" , 0.08f , "idle" , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 ) ;
97+ face . Add ( "hit" , "hit" , 0.08f ) ;
98+ face . AddLoop ( "left" , "hit_left" , 0.08f ) ;
99+ face . AddLoop ( "right" , "hit_right" , 0.08f ) ;
100+ face . AddLoop ( "up" , "hit_up" , 0.08f ) ;
101+ face . AddLoop ( "down" , "hit_down" , 0.08f ) ;
102+ }
103+ face . CenterOrigin ( ) ;
104+ face . Play ( "idle" ) ;
105+ this . face . OnLastFrame = delegate ( string f ) {
63106 bool flag = f == "hit" ;
64- if ( flag )
65- {
107+ if ( flag ) {
66108 this . face . Play ( this . nextFaceDirection , false , false ) ;
67109 }
68110 } ;
@@ -72,13 +114,11 @@ public NonReturnSokoban(Vector2 position, float width, float height, Axes axes,
72114 this . AddImage ( idle , num , 0 , 3 , 0 , 1 , - 1 ) ;
73115 this . AddImage ( idle , 0 , num2 , 0 , 3 , - 1 , 1 ) ;
74116 this . AddImage ( idle , num , num2 , 3 , 3 , 1 , 1 ) ;
75- for ( int i = 1 ; i < num ; i ++ )
76- {
117+ for ( int i = 1 ; i < num ; i ++ ) {
77118 this . AddImage ( idle , i , 0 , Calc . Random . Choose ( 1 , 2 ) , 0 , 0 , - 1 ) ;
78119 this . AddImage ( idle , i , num2 , Calc . Random . Choose ( 1 , 2 ) , 3 , 0 , 1 ) ;
79120 }
80- for ( int j = 1 ; j < num2 ; j ++ )
81- {
121+ for ( int j = 1 ; j < num2 ; j ++ ) {
82122 this . AddImage ( idle , 0 , j , 0 , Calc . Random . Choose ( 1 , 2 ) , - 1 , 0 ) ;
83123 this . AddImage ( idle , num , j , 3 , Calc . Random . Choose ( 1 , 2 ) , 1 , 0 ) ;
84124 }
@@ -87,10 +127,6 @@ public NonReturnSokoban(Vector2 position, float width, float height, Axes axes,
87127 Add ( new WaterInteraction ( ( ) => this . crushDir != Vector2 . Zero ) ) ;
88128 }
89129
90- public NonReturnSokoban ( EntityData data , Vector2 offset ) : this ( data . Position + offset , ( float ) data . Width , ( float ) data . Height , data . Enum < NonReturnSokoban . Axes > ( "axes" , Axes . Both ) , data . Bool ( "chillout" , false ) , data . Bool ( "altTexture" , false ) )
91- {
92- }
93-
94130 public override void Added ( Scene scene )
95131 {
96132 base . Added ( scene ) ;
@@ -191,7 +227,7 @@ public void AddImage(MTexture idle, int x, int y, int tx, int ty, int borderX =
191227 bool flag4 = borderX < 0 ;
192228 if ( flag4 )
193229 {
194- Image image2 = new Image ( GFX . Game [ altTextureString + "lit_left" ] . GetSubtexture ( 0 , ty * 8 , 8 , 8 , null ) ) ;
230+ Image image2 = new Image ( GFX . Game [ spriteDirectory + "/ lit_left" ] . GetSubtexture ( 0 , ty * 8 , 8 , 8 , null ) ) ;
195231 this . activeLeftImages . Add ( image2 ) ;
196232 image2 . Position = vector ;
197233 image2 . Visible = false ;
@@ -202,7 +238,7 @@ public void AddImage(MTexture idle, int x, int y, int tx, int ty, int borderX =
202238 bool flag5 = borderX > 0 ;
203239 if ( flag5 )
204240 {
205- Image image3 = new Image ( GFX . Game [ altTextureString + "lit_right" ] . GetSubtexture ( 0 , ty * 8 , 8 , 8 , null ) ) ;
241+ Image image3 = new Image ( GFX . Game [ spriteDirectory + "/ lit_right" ] . GetSubtexture ( 0 , ty * 8 , 8 , 8 , null ) ) ;
206242 this . activeRightImages . Add ( image3 ) ;
207243 image3 . Position = vector ;
208244 image3 . Visible = false ;
@@ -212,7 +248,7 @@ public void AddImage(MTexture idle, int x, int y, int tx, int ty, int borderX =
212248 bool flag6 = borderY < 0 ;
213249 if ( flag6 )
214250 {
215- Image image4 = new Image ( GFX . Game [ altTextureString + "lit_top" ] . GetSubtexture ( tx * 8 , 0 , 8 , 8 , null ) ) ;
251+ Image image4 = new Image ( GFX . Game [ spriteDirectory + "/ lit_top" ] . GetSubtexture ( tx * 8 , 0 , 8 , 8 , null ) ) ;
216252 this . activeTopImages . Add ( image4 ) ;
217253 image4 . Position = vector ;
218254 image4 . Visible = false ;
@@ -223,7 +259,7 @@ public void AddImage(MTexture idle, int x, int y, int tx, int ty, int borderX =
223259 bool flag7 = borderY > 0 ;
224260 if ( flag7 )
225261 {
226- Image image5 = new Image ( GFX . Game [ altTextureString + "lit_bottom" ] . GetSubtexture ( tx * 8 , 0 , 8 , 8 , null ) ) ;
262+ Image image5 = new Image ( GFX . Game [ spriteDirectory + "/ lit_bottom" ] . GetSubtexture ( tx * 8 , 0 , 8 , 8 , null ) ) ;
227263 this . activeBottomImages . Add ( image5 ) ;
228264 image5 . Position = vector ;
229265 image5 . Visible = false ;
@@ -431,7 +467,7 @@ private void ActivateParticles(Vector2 dir)
431467 }
432468 }
433469 num += 2 ;
434- this . level . Particles . Emit ( CrushBlock . P_Activate , num , position , positionRange , direction ) ;
470+ this . level . Particles . Emit ( P_Activate , num , position , positionRange , direction ) ;
435471 }
436472
437473 private IEnumerator AttackSequence ( )
@@ -647,7 +683,7 @@ private IEnumerator AttackSequence()
647683 } , Alarm . AlarmMode . Oneshot ) ;
648684 this . crushDir = Vector2 . Zero ;
649685 this . TurnOffImages ( ) ;
650- this . face . Play ( "hurt" , false , false ) ;
686+ yield return this . face . PlayRoutine ( "hurt" , false ) ;
651687 this . face . Play ( "idle" , false , false ) ;
652688 yield break ;
653689 }
@@ -767,8 +803,8 @@ private bool MoveVCheck(float amount)
767803
768804 // Token: 0x040007F0 RID: 2032
769805 public Color fill ;
806+ public Axes axes ;
770807 private bool altTexture ;
771- public string altTextureString ;
772808
773809 // Token: 0x040007F1 RID: 2033
774810 private Level level ;
0 commit comments