diff --git a/server/fixtures/rock-projectile.entity.js b/server/fixtures/rock-projectile.entity.js index 953efe0..a2bc39a 100644 --- a/server/fixtures/rock-projectile.entity.js +++ b/server/fixtures/rock-projectile.entity.js @@ -28,15 +28,35 @@ export function rockProjectileJSON() { ['entity', 'direction'], buildTraversal(['wielder', 'direction']), ); - const move = buildInvoke(['entity', 'moveFor'], [ - buildInvoke( - ['Vector', 'fromDirection'], - [ - buildTraversal(['entity', 'direction']), - ], - ), - 0.5, - ]); + const move = buildInvoke( + ['entity', 'moveFor'], + [ + buildInvoke( + ['Vector', 'fromDirection'], + [ + buildTraversal(['entity', 'direction']), + ], + ), + 0.5, + ], + ); + const setIsNotDamaging = buildTraversal( + ['entity', 'isDamaging'], + false, + ); + const reflect = buildInvoke( + ['entity', 'moveFor'], + [ + buildInvoke( + ['Vector', 'sub'], + [ + buildTraversal(['entity', 'position']), + buildTraversal(['obstacle', 'position']), + ], + ), + 0.05, + ], + ); // Destroy. const destroy = buildInvoke( ['entity', 'destroy'], @@ -62,11 +82,15 @@ export function rockProjectileJSON() { ], }, }, - dry: { + reflect: { type: 'routine', routine: { type: 'actions', - traversals: [], + traversals: [ + setIsNotDamaging, + reflect, + destroy, + ], }, }, }, @@ -78,12 +102,22 @@ export function rockProjectileJSON() { }, collider: { params: { - // collisionStartActions: { - // type: 'actions', - // traversals: [ - // buildInvoke(['entity', 'destroy']), - // ], - // }, + collisionStartActions: { + type: 'actions', + traversals: [ + buildInvoke( + ['entity', 'context', 'set'], + [ + 'obstacle', + buildTraversal(['other']), + ], + ), + buildTraversal( + ['entity', 'currentRoutine'], + 'reflect', + ), + ], + }, isSensor: true, }, }, @@ -93,7 +127,7 @@ export function rockProjectileJSON() { { affinity: AFFINITY_NONE, knockback: 500, - lock: 0.25, + lock: 1, power: 50, variance: 0.1, },