@@ -88,34 +88,40 @@ export const createCollisionMap = createSyncThunk<void>(
8888 )
8989 }
9090
91- // Helper to add shot collision with optional wrapping
92- const addShotCollision = (
93- shot : ( typeof state . shots . bunkshots ) [ 0 ] ,
94- screenOffsetX : number
95- ) : void => {
96- const shotX = shot . x - screenOffsetX
97- const shotY = shot . y - state . screen . screeny
98- const shotItem : CollisionItem = [
99- { x : shotX , y : shotY , collision : Collision . LETHAL } ,
100- { x : shotX + 1 , y : shotY , collision : Collision . LETHAL } ,
101- { x : shotX , y : shotY + 1 , collision : Collision . LETHAL } ,
102- { x : shotX + 1 , y : shotY + 1 , collision : Collision . LETHAL }
103- ]
104- extra . collisionService . addItem ( shotItem )
105- }
106-
107- // Add bunker shots at normal position
108- state . shots . bunkshots
109- . filter ( shot => shot . lifecount > 0 )
110- . forEach ( shot => addShotCollision ( shot , state . screen . screenx ) )
91+ // only add bunker shots to collision map if ship is not shielding
92+ if ( ! state . ship . shielding ) {
93+ // Helper to add shot collision with optional wrapping
94+ const addShotCollision = (
95+ shot : ( typeof state . shots . bunkshots ) [ 0 ] ,
96+ screenOffsetX : number
97+ ) : void => {
98+ const shotX = shot . x - screenOffsetX
99+ const shotY = shot . y - state . screen . screeny
100+ const shotItem : CollisionItem = [
101+ { x : shotX , y : shotY , collision : Collision . LETHAL } ,
102+ { x : shotX + 1 , y : shotY , collision : Collision . LETHAL } ,
103+ { x : shotX , y : shotY + 1 , collision : Collision . LETHAL } ,
104+ { x : shotX + 1 , y : shotY + 1 , collision : Collision . LETHAL }
105+ ]
106+ extra . collisionService . addItem ( shotItem )
107+ }
111108
112- // Add bunker shots at wrapped position
113- if ( on_right_side && worldwrap ) {
109+ // Add bunker shots at normal position
114110 state . shots . bunkshots
115111 . filter ( shot => shot . lifecount > 0 )
116- . forEach ( shot =>
117- addShotCollision ( shot , state . screen . screenx - state . planet . worldwidth )
118- )
112+ . forEach ( shot => addShotCollision ( shot , state . screen . screenx ) )
113+
114+ // Add bunker shots at wrapped position
115+ if ( on_right_side && worldwrap ) {
116+ state . shots . bunkshots
117+ . filter ( shot => shot . lifecount > 0 )
118+ . forEach ( shot =>
119+ addShotCollision (
120+ shot ,
121+ state . screen . screenx - state . planet . worldwidth
122+ )
123+ )
124+ }
119125 }
120126 }
121127)
0 commit comments