chore: client/server guards
This commit is contained in:
parent
0e5a03336c
commit
49813a5edc
|
@ -211,24 +211,28 @@ export class Vulnerable extends Trait {
|
||||||
}
|
}
|
||||||
|
|
||||||
tick(elapsed) {
|
tick(elapsed) {
|
||||||
for (let i = 0; i < this.tookDamageActions.length; ++i) {
|
if (AVOCADO_CLIENT) {
|
||||||
const {context, actions} = this.tookDamageActions[i];
|
for (let i = 0; i < this.tookDamageActions.length; ++i) {
|
||||||
actions.tick(context, elapsed);
|
const {context, actions} = this.tookDamageActions[i];
|
||||||
}
|
actions.tick(context, elapsed);
|
||||||
if (Object.keys(this.damageList).length > 0) {
|
|
||||||
this.state = this.state.set('damageList', I.Map(this.damageList));
|
|
||||||
this.isDirty = true;
|
|
||||||
this.damageList = {};
|
|
||||||
}
|
|
||||||
const keys = Array.from(this.locks.keys());
|
|
||||||
for (let i = 0; i < keys.length; ++i) {
|
|
||||||
const key = keys[i];
|
|
||||||
const remaining = this.locks.get(key) - elapsed;
|
|
||||||
if (remaining <= 0) {
|
|
||||||
this.locks.delete(key);
|
|
||||||
}
|
}
|
||||||
else {
|
}
|
||||||
this.locks.set(key, remaining);
|
if (AVOCADO_SERVER) {
|
||||||
|
if (Object.keys(this.damageList).length > 0) {
|
||||||
|
this.state = this.state.set('damageList', I.Map(this.damageList));
|
||||||
|
this.isDirty = true;
|
||||||
|
this.damageList = {};
|
||||||
|
}
|
||||||
|
const keys = Array.from(this.locks.keys());
|
||||||
|
for (let i = 0; i < keys.length; ++i) {
|
||||||
|
const key = keys[i];
|
||||||
|
const remaining = this.locks.get(key) - elapsed;
|
||||||
|
if (remaining <= 0) {
|
||||||
|
this.locks.delete(key);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.locks.set(key, remaining);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user