Skip to content

Building Markers - Set negative draw priority for markers - #733

Merged
mharis001 merged 15 commits into
zen-mod:masterfrom
ampersand38:building-marker-priority
Oct 22, 2026
Merged

mharis001 merged 15 commits into
zen-mod:masterfrom
ampersand38:building-marker-priority

Conversation

@ampersand38

Copy link
Copy Markdown
Member

When merged this pull request will:

  • Prevent Building Markers from covering player placed markers
  • Add setMarkerDrawPriority event
  • Call event after building marker creation
  • image

@ampersand38 ampersand38 added enhancement Improves an existing feature 2.14 Arma 3 2.14 labels Apr 23, 2023
_marker setMarkerDir getDir _object;
_object setVariable [QGVAR(marker), _marker, true];

[QEGVAR(common,setMarkerDrawPriority), [_marker, -1], _marker] call CBA_fnc_globalEventJIP;

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.

Need to handle removing the JIP event if the marker is deleted.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should building markers be removable for other reasons than building deletion?
Do building markers remain global or should local changes be permitted?

If not, I imagine it's possible to replace the removed marker by detecting when a marker has been deleted with this EH:

  • You could add this EH on all clients and they would raise an event on the server which would handle the deletion or replacement of the marker, depending if the marker was deleted because the building was deleted or for another reason.
  • You could add this EH on the server only and have it deal with the marker deletion or replacement. This assumes that all building marker deletions would be global though.

If building markers should be removable, I guess the EH linked above still can be used, but it would be a bit more tricky: What if deleteMarkerLocal is used on building markers? Should the marker be replaced, so that you force people to use deleteMarker instead, or should the marker be editable on each client individually, as in permit different marker settings (existence, visibility, size, direction, etc)?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

nice one 3ea5c51
I don't think any mod can be so protective of its stuff.
What use case is there for building markers showing differently between clients?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nice one 3ea5c51 I don't think any mod can be so protective of its stuff. What use case is there for building markers showing differently between clients?

I agree that a mod shouldn't be that overprotective. As for the use case of building markers showing differently on clients, I don't really know, I'm not a mission maker. I was mostly thinking of how badly the marker system could/would break if you started messing with markers on a per client basis.

_marker setMarkerDir getDir _object;
_object setVariable [QGVAR(marker), _marker, true];

[QEGVAR(common,setMarkerDrawPriority), [_marker, -1], _marker] call CBA_fnc_globalEventJIP;

@rautamiekka rautamiekka May 12, 2023 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Interestingly, CBA_fnc_removeGlobalEventJIP can be told to wait for the object (in this case the marker) to be deleted before actually proceeding with deleting the JIP order, so this should work, adding some inherent sleep by spawn:

Suggested change
[QEGVAR(common,setMarkerDrawPriority), [_marker, -1], _marker] call CBA_fnc_globalEventJIP;
private _jipID = [QEGVAR(common,setMarkerDrawPriority), [_marker, -1], _marker] call CBA_fnc_globalEventJIP;
[_jipID, _marker] spawn CBA_fnc_removeGlobalEventJIP;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Very cool indeed. It would probably need to be _object not _marker I think, looking at the params?

@rautamiekka rautamiekka May 16, 2023 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe, I dunno; just interpreted this line.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Comment on lines +64 to +65
private _jipID = [QEGVAR(common,setMarkerDrawPriority), [_marker, -1], _marker] call CBA_fnc_globalEventJIP;
[_jipID, _object] call CBA_fnc_removeGlobalEventJIP;

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.

Does not handle the marker being removed without the object being deleted.

@mharis001 mharis001 added this to the 1.15.0 milestone Oct 5, 2023
That just creates another Deleted EH on the object with no saved ID. Repeated set and remove markers would result in multiple such events.
_marker setMarkerSizeLocal _size;
_marker setMarkerDir getDir _object;
_object setVariable [QGVAR(marker), _marker, true];
missionNamespace setVariable [_marker, _object];

@johnb432 johnb432 Oct 12, 2023 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I really wouldn't use the marker value in a "raw" format. I'm certain there are mods out there that already do that.

I would use something like this:

Suggested change
missionNamespace setVariable [_marker, _object];
missionNamespace setVariable [format [QGVAR(object_), _marker], _object];

I haven't checked if it works, but it would be safer to use imo.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I should have just used netID.
_marker is already format [QGVAR(%1), _object call BIS_fnc_netId] "zen_building_markers_0:1".
incidentally,
allMapMarkers apply {isNil {missionnamespace getVariable _x}} // [true,true]

ampersand38 and others added 4 commits October 12, 2023 15:03
Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>

@rautamiekka rautamiekka left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

+1 level of indentation.

Co-authored-by: Jouni Järvinen <rautamiekka@users.noreply.github.com>
@mharis001 mharis001 modified the milestones: 1.15.0, 1.16.0 Jul 18, 2024
@mharis001 mharis001 changed the title Set negative draw priority for Building Markers Building Markers - Set negative draw priority for markers Oct 19, 2026
@mharis001

Copy link
Copy Markdown
Member

I just did some clean up and tested in MP, everything looks to work as expected. Notes:

  • Changed to using netId and objectFromNetId directly (works in SP since 2.18).
  • Use mission "EntityDeleted" event handler instead of adding to individual objects (also available since 2.18).
  • Changed the marker priority we set to -999 instead of -1 - no good reason other than to "extra ensure" that they are drawn behind everything.
  • Regarding the discussion about whether markers should be deletable or local deletion should be supported, I think deleting a marker being treated the same as being disabled for a building is the most straightforward approach. There also does not seem to be a use case to support the case for local deletion, so if someone breaks things by messing with ZEN markers locally, then that is unsupported behaviour.

@mharis001
mharis001 merged commit f42dc42 into zen-mod:master Oct 22, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2.14 Arma 3 2.14 enhancement Improves an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants