Page MenuHomeFeedback Tracker

Script code in EOn* should not call super
Closed, ResolvedPublic

Description

There are a few instances in 1.16 and current 1.17 Experimental where EOnInit, EOnFrame and EOnPostSimulate in derived classes call super. This is unneeded and causes additional calls, as the classes in the hierarchy receive the events regardless, and might be unintended. It is therefore proposed to remove these unneeded super calls.

1.16:

./4_World/Entities/ItemBase/Spotlight.c:85:		super.EOnInit(other, extra);
./4_World/Entities/ScriptedEntities/Triggers/EffectTrigger.c:65:		super.EOnFrame(other, timeSlice);

1.17 Experimental (April 2th):

./4_World/Entities/ItemBase/Spotlight.c:85:		super.EOnInit(other, extra);
./4_World/Entities/ScriptedEntities/Triggers/EffectTrigger.c:65:		super.EOnFrame(other, timeSlice);
./4_World/Entities/Vehicles/InheritedCars/CivilianSedan.c:64:		super.EOnPostSimulate(other, timeSlice);
./4_World/Entities/Vehicles/InheritedCars/Hatchback_02.c:64:		super.EOnPostSimulate(other, timeSlice);
./4_World/Entities/Vehicles/InheritedCars/OffroadHatchback.c:64:		super.EOnPostSimulate(other, timeSlice);
./4_World/Entities/Vehicles/InheritedCars/Sedan_02.c:64:		super.EOnPostSimulate(other, timeSlice);
./4_World/Entities/Vehicles/InheritedCars/Truck_01_Base.c:65:		super.EOnPostSimulate(other, timeSlice);
./4_World/Entities/Vehicles/InheritedCars/Truck_02.c:54:		super.EOnPostSimulate(other, timeSlice);
./4_World/Entities/Vehicles/InheritedCars/Van_01.c:53:		super.EOnPostSimulate(other, timeSlice);

Details

Severity
None
Resolution
Open
Reproducibility
Always
Operating System
Windows 10 x64
Category
Scripting
Steps To Reproduce

Example:

modded class DayZPlayerImplement
{
	protected override void EOnInit(IEntity other, int extra)
	{
		Print("[DayZPlayerImplement] " + ToString() + "::EOnInit");
	}
}

modded class PlayerBase
{
	protected override void EOnInit(IEntity other, int extra)
	{
		Print("[PlayerBase] " + ToString() + "::EOnInit");
		Print("[PlayerBase] " + ToString() + "::EOnInit - calling super");
		super.EOnInit(other, extra);  // This super call is superfluous :-)
	}
}

Output:

[DayZPlayerImplement] SurvivorBase<e0f9550>::EOnInit
[PlayerBase] SurvivorBase<e0f9550>::EOnInit
[PlayerBase] SurvivorBase<e0f9550>::EOnInit - calling super
[DayZPlayerImplement] SurvivorBase<e0f9550>::EOnInit

Event Timeline

lava76 created this task.Apr 2 2022, 8:05 PM
lava76 edited Steps To Reproduce. (Show Details)
lava76 added a comment.EditedAug 10 2022, 6:02 PM

Follow-up: Because all vanilla inherited cars call super in EOnPostSimulate, this also means they have double the fuel leakage than intended.

Geez changed the task status from New to Acknowledged.Dec 2 2022, 12:55 PM
Geez closed this task as Resolved.Dec 7 2022, 9:54 AM
Geez claimed this task.
Geez added a subscriber: Geez.

Resolved for 1.20 update.
Regards,
Geez