Skip to content

Commit 4d42fbe

Browse files
committed
simulation: fix shooting to dead players
1 parent 74617d5 commit 4d42fbe

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/hyperspace/library/simulation.clj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,11 @@
4545
player
4646
heading
4747
power]
48-
(trace "fire" world player heading power)
4948
(let [players (->> world
5049
:players
51-
(remove #(= % player)))]
50+
; Sometimes game will pass players with wrong states here (dead vs alive), so
51+
; just compare positions here.
52+
(remove #(= (:position %) (:position player))))]
5253
(loop [bullet {:position (:position player)
5354
:velocity [(* (Math/cos heading) power)
5455
(* (Math/sin heading) power)]

0 commit comments

Comments
 (0)