Skip to content

Commit fc8aa77

Browse files
committed
ratnap fix
1 parent 94db727 commit fc8aa77

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

client/src/playback/Actions.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -189,12 +189,19 @@ export const ACTION_DEFINITIONS: Record<schema.Action, typeof Action<ActionUnion
189189
const src = round.bodies.getById(this.robotId)
190190
const target = round.bodies.getById(this.actionData.id()) // rat getting napped
191191

192-
target.carriedRobot = undefined
193-
src.carriedRobot = target.id
192+
if(src.carriedRobot === target.id) {
193+
// drop the target
194+
src.carriedRobot = undefined
195+
target.size = 1
196+
} else {
197+
// pick up the target
198+
src.carriedRobot = target.id
199+
target.carriedRobot = undefined
194200

195-
target.lastPos = { ...target.pos }
196-
target.pos = { x: src.pos.x + RatNapAction.OFFSET.x, y: src.pos.y + RatNapAction.OFFSET.y }
197-
target.size = 0.6
201+
target.lastPos = { ...target.pos }
202+
target.pos = { x: src.pos.x + RatNapAction.OFFSET.x, y: src.pos.y + RatNapAction.OFFSET.y }
203+
target.size = 0.6
204+
}
198205
}
199206
draw(match: Match, ctx: CanvasRenderingContext2D): void {
200207
//target rat moves onto src rat, circle around carried group thing

0 commit comments

Comments
 (0)