fun: reflect on hit!

This commit is contained in:
cha0s 2019-06-05 23:40:20 -05:00
parent 3fa0f7b8c9
commit ad290f6e6a

View File

@ -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,
},