Skip to content

Commit

Permalink
Merge latest dev changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Neloreck committed Aug 21, 2023
1 parent 15c0a1e commit dade51f
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/engine/core/database/objects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,6 @@ export function registerWoundedObject(object: ClientObject): void {
* todo;
*/
export function unRegisterWoundedObject(object: ClientObject): void {
setPortableStoreValue(object, HELPING_WOUNDED_OBJECT_KEY, null);
setPortableStoreValue(object.id(), HELPING_WOUNDED_OBJECT_KEY, null);
registry.objectsWounded.delete(object.id());
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export class EvaluatorCorpseDetect extends property_evaluator {
freeSelectedLootedObjectSpot(this.state.selectedCorpseId);
}

setPortableStoreValue(corpseObject, LOOTING_DEAD_OBJECT_KEY, this.object.id());
setPortableStoreValue(corpseId, LOOTING_DEAD_OBJECT_KEY, this.object.id());

// Link looting state for current object and looted object.
this.state.selectedCorpseId = corpseId;
Expand Down
2 changes: 1 addition & 1 deletion src/engine/core/schemes/corpse_detection/utils/loot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ export function freeSelectedLootedObjectSpot(lootedObject: TNumberId): void {
const lootedObjectState: Optional<IRegistryObjectState> = registry.objects.get(lootedObject);

if (lootedObjectState !== null) {
setPortableStoreValue(lootedObjectState.object, LOOTING_DEAD_OBJECT_KEY, null);
setPortableStoreValue(lootedObject, LOOTING_DEAD_OBJECT_KEY, null);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export class EvaluatorWoundedExist extends property_evaluator {
}

// Block others from healing current target.
setPortableStoreValue(nearestObject as ClientObject, HELPING_WOUNDED_OBJECT_KEY, this.object.id());
setPortableStoreValue(nearestObjectId, HELPING_WOUNDED_OBJECT_KEY, this.object.id());

this.state.selectedWoundedId = nearestObjectId;
this.state.selectedWoundedVertexId = nearestVertexId;
Expand Down
4 changes: 1 addition & 3 deletions src/engine/core/schemes/help_wounded/utils/help_wounded.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ export function finishObjectHelpWounded(object: ClientObject): void {
*/
export function freeSelectedWoundedStalkerSpot(helpingId: Optional<TNumberId>): void {
if (helpingId !== null) {
const state: IRegistryObjectState = registry.objects.get(helpingId);

setPortableStoreValue(state.object, HELPING_WOUNDED_OBJECT_KEY, null);
setPortableStoreValue(helpingId, HELPING_WOUNDED_OBJECT_KEY, null);
}
}
2 changes: 1 addition & 1 deletion src/engine/core/schemes/wounded/actions/ActionWounded.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export class ActionWounded extends action_base {

// Handle healing up by objects after some timeout.
if (this.state.autoheal && !woundManager.canUseMedkit) {
const woundedAt: TTimestamp = getPortableStoreValue(this.object, "begin_wounded")!;
const woundedAt: TTimestamp = getPortableStoreValue(this.object.id(), "begin_wounded")!;

if (woundedAt === null) {
setPortableStoreValue(this.object.id(), "begin_wounded", now);
Expand Down
2 changes: 1 addition & 1 deletion src/engine/core/utils/object/object_loot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export function findNearestCorpseToLoot(

// Is registered in client side.
if (corpseObject) {
const isLootedBy: Optional<TNumberId> = getPortableStoreValue(corpseObject, LOOTING_DEAD_OBJECT_KEY);
const isLootedBy: Optional<TNumberId> = getPortableStoreValue(id, LOOTING_DEAD_OBJECT_KEY);

if (
// Is not looted by anyone or looted by current object.
Expand Down
3 changes: 2 additions & 1 deletion src/engine/core/utils/object/object_wounds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ export function findNearestWoundedObjectToHelp(
// Iterate all active wounded objects.
for (const [, woundedObjectState] of registry.objectsWounded) {
const woundedObject: Optional<ClientObject> = woundedObjectState.object;
const objectHealedBy: Optional<TNumberId> = getPortableStoreValue(woundedObject, HELPING_WOUNDED_OBJECT_KEY);
const objectHealedBy: Optional<TNumberId> =
woundedObject && getPortableStoreValue(woundedObject.id(), HELPING_WOUNDED_OBJECT_KEY);

if (
// Do not check self.
Expand Down

0 comments on commit dade51f

Please sign in to comment.