fun: rock!
This commit is contained in:
parent
b4ea803367
commit
92907d02e2
1
resource/rock.entity.json
Normal file
1
resource/rock.entity.json
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"traits":{"collider":{"params":{"isSensor":true}},"damaging":{"params":{"damageSpecs":[{"affinity":0,"lock":0.25,"power":50,"variance":0.1}]}},"directional":{"params":{"directionCount":4}},"existent":{"state":{"name":"Rock"}},"item":{"params":{"itemActions":{"type":"actions","traversals":[{"type":"traversal","steps":[{"type":"key","key":"item"},{"type":"key","key":"setDoesNotDamage"},{"type":"invoke","args":[{"type":"traversal","steps":[{"type":"key","key":"user"}]}]}]},{"type":"traversal","steps":[{"type":"key","key":"user"},{"type":"key","key":"list"},{"type":"key","key":"addEntity"},{"type":"invoke","args":[{"type":"traversal","steps":[{"type":"key","key":"item"}]}]}]},{"type":"traversal","steps":[{"type":"key","key":"item"},{"type":"key","key":"setPosition"},{"type":"invoke","args":[{"type":"traversal","steps":[{"type":"key","key":"user"},{"type":"key","key":"position"}]}]}]},{"type":"traversal","steps":[{"type":"key","key":"item"},{"type":"key","key":"direction"}],"value":{"type":"traversal","steps":[{"type":"key","key":"user"},{"type":"key","key":"direction"}]}},{"type":"traversal","steps":[{"type":"key","key":"item"},{"type":"key","key":"moveFor"},{"type":"invoke","args":[{"type":"literal","value":0.5}]}]},{"type":"traversal","steps":[{"type":"key","key":"user"},{"type":"key","key":"list"},{"type":"key","key":"removeEntity"},{"type":"invoke","args":[{"type":"traversal","steps":[{"type":"key","key":"item"}]}]}]}]},"slotImages":{"default":"/rock.png"}}},"layered":{},"listed":{},"mobile":{"state":{"speed":200}},"physical":{},"pictured":{"params":{"images":{"initial":{"offset":[0,0],"size":[12,12],"uri":"/rock.png"}}}},"positioned":{},"roomed":{},"shaped":{"params":{"shape":{"type":"rectangle","position":[0,0],"size":[12,12]}}},"visible":{}}}
|
BIN
resource/rock.png
Normal file
BIN
resource/rock.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 441 B |
|
@ -28,6 +28,8 @@ writeFixture('mama-kitty.entity.json', mamaKittyJSON());
|
||||||
// Write items.
|
// Write items.
|
||||||
import {potionJSON} from './fixtures/potion.entity';
|
import {potionJSON} from './fixtures/potion.entity';
|
||||||
writeFixture('potion.entity.json', potionJSON());
|
writeFixture('potion.entity.json', potionJSON());
|
||||||
|
import {rockJSON} from './fixtures/rock.entity';
|
||||||
|
writeFixture('rock.entity.json', rockJSON());
|
||||||
// Write rooms.
|
// Write rooms.
|
||||||
import {kittyFireJSON} from './fixtures/kitty-fire.room';
|
import {kittyFireJSON} from './fixtures/kitty-fire.room';
|
||||||
writeFixture('kitty-fire.room.json', kittyFireJSON());
|
writeFixture('kitty-fire.room.json', kittyFireJSON());
|
||||||
|
|
123
server/fixtures/rock.entity.js
Normal file
123
server/fixtures/rock.entity.js
Normal file
|
@ -0,0 +1,123 @@
|
||||||
|
import {buildInvoke, buildTraversal} from '@avocado/behavior';
|
||||||
|
|
||||||
|
import {AFFINITY_NONE} from '../../common/combat/constants';
|
||||||
|
|
||||||
|
// Healing potion.
|
||||||
|
export function rockJSON() {
|
||||||
|
// Set as not damaging to user.
|
||||||
|
const setDoesNotDamageUser = buildInvoke(
|
||||||
|
['item', 'setDoesNotDamage'],
|
||||||
|
[
|
||||||
|
buildTraversal(['user']),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
// Add item to list.
|
||||||
|
const addToList = buildInvoke(
|
||||||
|
['user', 'list', 'addEntity'],
|
||||||
|
[
|
||||||
|
buildTraversal(['item']),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
// Set item to user position.
|
||||||
|
const setToUserPosition = buildInvoke(
|
||||||
|
['item', 'setPosition'],
|
||||||
|
[
|
||||||
|
buildTraversal(['user', 'position']),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
// Move in direction user is facing for 1 second.
|
||||||
|
const turn = buildTraversal(
|
||||||
|
['item', 'direction'],
|
||||||
|
buildTraversal(['user', 'direction']),
|
||||||
|
);
|
||||||
|
const move = buildInvoke(['item', 'moveFor'], [
|
||||||
|
0.5,
|
||||||
|
]);
|
||||||
|
// Remove from list.
|
||||||
|
const removeFromList = buildInvoke(
|
||||||
|
['user', 'list', 'removeEntity'],
|
||||||
|
[
|
||||||
|
buildTraversal(['item']),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
return {
|
||||||
|
traits: {
|
||||||
|
collider: {
|
||||||
|
params: {
|
||||||
|
isSensor: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
damaging: {
|
||||||
|
params: {
|
||||||
|
damageSpecs: [
|
||||||
|
{
|
||||||
|
affinity: AFFINITY_NONE,
|
||||||
|
lock: 0.25,
|
||||||
|
power: 50,
|
||||||
|
variance: 0.1,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
directional: {
|
||||||
|
params: {
|
||||||
|
directionCount: 4,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
existent: {
|
||||||
|
state: {
|
||||||
|
name: 'Rock',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
item: {
|
||||||
|
params: {
|
||||||
|
itemActions: {
|
||||||
|
type: 'actions',
|
||||||
|
traversals: [
|
||||||
|
setDoesNotDamageUser,
|
||||||
|
addToList,
|
||||||
|
setToUserPosition,
|
||||||
|
turn,
|
||||||
|
move,
|
||||||
|
removeFromList,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
slotImages: {
|
||||||
|
default: '/rock.png',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
layered: {},
|
||||||
|
listed: {},
|
||||||
|
mobile: {
|
||||||
|
state: {
|
||||||
|
speed: 200,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
physical: {},
|
||||||
|
pictured: {
|
||||||
|
params: {
|
||||||
|
images: {
|
||||||
|
initial: {
|
||||||
|
offset: [0, 0],
|
||||||
|
size: [12, 12], // Derive?
|
||||||
|
uri: '/rock.png',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
positioned: {},
|
||||||
|
roomed: {},
|
||||||
|
shaped: {
|
||||||
|
params: {
|
||||||
|
shape: {
|
||||||
|
type: 'rectangle',
|
||||||
|
position: [0, 0],
|
||||||
|
size: [12, 12],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
visible: {},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user