Page MenuHomeFeedback Tracker

Please expose/add EOnParentChange
Closed, ResolvedPublic

Description

I have run into the requirement multiple times now that I need to know when an entity gets attached to another one (for inventory storage, weapon attachment, or scripted custom logic on vehicle attachment), and right now there is unfortunately no event to subscribe to the updates, only a few sparse ones for certain specific use-cases. The inventory events for example do not work at all for items on the ground because no manager is responsible there.

One solution for all of this is the exposure or addition of a new entity and component event called something like EOnParentChange. This would fire with the new parent instance if this entity is attached to another one through any means (so for inventory, weapon attachment, slot manager, etc) and fire with null for the parent parameter if removed from a hierarchy. If the hierarchy is transferred it would fire null first and then with the new parent it was assigned to.

In DayZ we had this event exposed and it as super useful. I hope we can do the same for AR/A4. Thank you

enum EntityEvent
{
	PARENT,
}
class IEntity
{
	/*!
	Event when the hierarchy if this entity changes
	\param owner The owner entity
	\param other New parent entity or null if no parent
	*/
	event protected void EOnParentChange(IEntity owner, IEntity parent);
}
class ScriptComponent
{
	/*!
	Event when the hierarchy if this entity changes
	\param owner The owner entity
	\param other New parent entity or null if no parent
	*/
	event protected void EOnParentChange(IEntity owner, IEntity parent);
}

Details

Severity
Major
Resolution
Open
Reproducibility
N/A
Operating System
Windows 10 x64
Category
General

Event Timeline

Arkensor created this task.Oct 3 2022, 10:31 AM
Geez changed the task status from New to Assigned.Oct 16 2022, 11:09 PM
Arkensor added a subscriber: Geez.Apr 27 2023, 6:15 PM

Resolved as of 0.9.8.50 with the introduction of ScriptComponent::OnAddedToParent etc. @Geez please close.

Geez closed this task as Resolved.Apr 28 2023, 9:20 AM
Geez claimed this task.