Hemlock: eating looks like eating by ngcoding10 · Pull Request #430 · ASCoding11/ASCoding11.github.io · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 29 additions & 2 deletions e63334287a3deaa3/hemlock/js/body.js
8 changes: 5 additions & 3 deletions e63334287a3deaa3/hemlock/js/net.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
* Same shape as the site's other online games: a room is rooms/hk-<code> in the shared Firebase Realtime Database and
* every player writes ONLY their own node, rooms/hk-<code>/players/<uid> (the shared database rules allow just that,
* and expect n, c, x, z, h and ts to be there). Everything else rides in that node:
* st your character: height, aim, stance flags, health, what you hold, and the action you are in (which cut, when)
* st your character: height, aim, stance flags, health, what you hold, and the action you are in (which cut, when,
* what is being eaten)
* ev your last few events as JSON: hits you claim, results you decided, drops, pick-up requests, arrows, deaths
* ms (host) the match: id, phase, start time, seed, who is in it, the bots, and where each arena event landed (az)
* np (host) the bots and animals, one short string each
Expand Down Expand Up @@ -341,7 +342,7 @@
if (c.alive && (f[6] !== c.act.seq || type !== c.act.type)) {
const clip = f[8] >= 0 ? CLIPS[f[8]] : null;
if (type === 'recoil') C.recoil(c, f[12] / 1000, !!(f[9] & 2));
else c.act = { type, t: 0, clip, heavy: !!(f[9] & 1), w: f[10] / 1000, r: f[11] / 1000, rc: f[12] / 1000, dur: f[12] / 1000, from: new Float64Array(c.up), hit: [] };
else c.act = { type, t: 0, clip, heavy: !!(f[9] & 1), w: f[10] / 1000, r: f[11] / 1000, rc: f[12] / 1000, dur: f[12] / 1000, from: new Float64Array(c.up), hit: [], what: f[16] >= 0 ? Items.TYPES[f[16]] : undefined };
c.act.seq = f[6]; c.act.t0 = f[7]; c.actSeq = f[6];
}
c.drawK = f[13] / 100; c.arrowsN = f[14]; c.kills = f[15];
Expand All @@ -350,7 +351,8 @@
const a = c.act;
const flags = (c.crouch ? 1 : 0) | (c.sprinting ? 2 : 0) | (c.grounded ? 4 : 0) | (c.swimming ? 8 : 0) | (c.sleeping ? 16 : 0) | (!c.alive ? 32 : 0) | (c.aiming ? 64 : 0) | (c.hasPack ? 128 : 0) | (c.climb ? 256 : 0) | (!c.alive && c.lieSide < 0 ? 512 : 0);
return [r2(c.pos.y), r2(c.pitch), flags, Math.ceil(c.hp), c.item ? HK.ITEMS[c.item].idx : -1, Math.max(0, ACTS.indexOf(a.type)), a.seq, Math.round(a.t0 || 0), a.clip ? CLIPS.indexOf(a.clip) : -1,
(a.heavy ? 1 : 0) | (a.stag ? 2 : 0), Math.round((a.w || 0) * 1000), Math.round((a.r || 0) * 1000), Math.round((a.rc || a.dur || 0) * 1000), Math.round((c.drawK || 0) * 100), c.arrowsN, c.kills].join(',');
(a.heavy ? 1 : 0) | (a.stag ? 2 : 0), Math.round((a.w || 0) * 1000), Math.round((a.r || 0) * 1000), Math.round((a.rc || a.dur || 0) * 1000), Math.round((c.drawK || 0) * 100), c.arrowsN, c.kills,
a.what && HK.ITEMS[a.what] ? HK.ITEMS[a.what].idx : -1].join(',');
}
function showOutcome(out, x, y, z, dx, dy, dz) {
if (out === 'hit') { HK.emit('fx', 'blood', x, y, z, dx, dy, dz); HK.emit('sfx', 'hit', x, y, z); }
Expand Down
62 changes: 53 additions & 9 deletions e63334287a3deaa3/hemlock/js/rig.js