Skip to content

Sites: Stop zone soft lock when a player 'steals' site objects. - #180

Open
dijksterhuis wants to merge 6 commits into
Savage-Game-Design:developmentfrom
dijksterhuis:sites-stop-soft-locks-when-players-steal-assets
Open

Sites: Stop zone soft lock when a player 'steals' site objects.#180
dijksterhuis wants to merge 6 commits into
Savage-Game-Design:developmentfrom
dijksterhuis:sites-stop-soft-locks-when-players-steal-assets

Conversation

@dijksterhuis

@dijksterhuis dijksterhuis commented Jun 18, 2024

Copy link
Copy Markdown
Contributor

Some newer players think it's a good idea to steal PAVN mortars/zpus etc and take them back to their FOB.

Repurposing enemy assets is a legit strategy, but it causes a zone to become soft locked as the site will not complete unless the objects are destroyed (not alive).


There's also a case where loading the mortar/zpu into a vehicle with advanced logistics will cause a soft lock. This change also solves that case -- don't allow critical site objects to be loaded into vehicles.

I can't quite remember what happens if the player dies within the search radius while the object is still attached to their character model via advanced logistics. My intuition tells me it would not being a good thing.

I can include some of the logic from #178 to cover that additional case.

@dijksterhuis
dijksterhuis force-pushed the sites-stop-soft-locks-when-players-steal-assets branch from d22fc56 to dec52c4 Compare June 18, 2024 15:57
@dijksterhuis

dijksterhuis commented Oct 5, 2024

Copy link
Copy Markdown
Contributor Author

i can extract the logic for this out to a separate script and call that function 3x. would be a cleaner approach as it's basically the code in 3x files atm.

Comment thread mission/functions/systems/sites/fn_sites_create_aa_site.sqf Outdated
Comment on lines +91 to +105

private _pos = getPos _siteStore;
private _objects = _siteStore getVariable ["aaGuns", []];

/*
Teardown when all guns are either
- destroyed
- no longer with 20m radius of site centre point
*/

private _objectsAreAliveInRadius = _objects findIf {
(alive _x) && (count ([_x] inAreaArray [_pos, 20, 20, 0, false]) > 0)
};

_objectsAreAliveInRadius == -1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be way faster to execute inAreaArray once, it also accepts an object as a centre pos, which I understand the _siteStore is (not familiar with MF internals).

Below code should be faster on average:

Suggested change
private _pos = getPos _siteStore;
private _objects = _siteStore getVariable ["aaGuns", []];
/*
Teardown when all guns are either
- destroyed
- no longer with 20m radius of site centre point
*/
private _objectsAreAliveInRadius = _objects findIf {
(alive _x) && (count ([_x] inAreaArray [_pos, 20, 20, 0, false]) > 0)
};
_objectsAreAliveInRadius == -1
/*
Teardown when all guns are either
- destroyed
- no longer with 20m radius of site centre point
*/
((_siteStore getVariable "aaGuns") inAreaArray [_siteStore, 20, 20, 0, false]) findIf {alive _x} == -1

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aye i see what you're saying, will do.

@dijksterhuis dijksterhuis Oct 8, 2024

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@veteran29


I was working on an additional check for when players have loaded the site object into a vehicle with the Advanced Logistics module, as that can causes site/zone soft-locks too -- see: cd97f17

But there's at least three downstream edge cases to take into account, beyond the teardown condition check

  • do not delete object when player is carrying object (object deletion in front of player)
  • do not delete object when in a vehicle logistics inventory (object will no longer exist in logistics inventory)
  • do not delete object if ever has been in a vehicle logistics inventory (object deletion in front of player)

Simplest / cleanest option seems to be to just to disable the ability to load these objects into vehicles, so that's the latest version.

@veteran29 veteran29 added the enhancement New feature or request label Oct 6, 2024
@dijksterhuis
dijksterhuis force-pushed the sites-stop-soft-locks-when-players-steal-assets branch from 3e8d588 to cc4ddfd Compare October 8, 2024 13:17
@dijksterhuis
dijksterhuis force-pushed the sites-stop-soft-locks-when-players-steal-assets branch from cc4ddfd to 46f90a4 Compare October 8, 2024 13:18
@dijksterhuis dijksterhuis self-assigned this Apr 14, 2025
@dijksterhuis dijksterhuis added the priority merge Priority to be reviewed and merged label May 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request priority merge Priority to be reviewed and merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants