Page MenuHomeFeedback Tracker

Calling ProcessDirectDamage on a survivor NPC with source being a gas pump segfaults
Acknowledged, NormalPublic

Description

If the source parameter passed to a ProcessDirectDamage call on a survivor NPC (SurvivorBase/PlayerBase) is a gas pump (Land_FuelStation_Feed), the game segfaults.

Details

Severity
None
Resolution
Open
Reproducibility
N/A
Operating System
Windows 10 x64
Category
Modding
Steps To Reproduce

Quick and dirty reproduction steps that creates a survivor NPC at the fuel pump nearest (within 30 m) to the 1st player and tries to apply damage to it:

PlayerBase pb = PlayerBase.Cast(GetGame().GetPlayerByIndex(0));  //! Get 1st player

//! Find nearest fuel pump
Land_FuelStation_Feed source;
array<Object> objects = {};
array<CargoBase> proxyCargos = {};
Object target;
GetGame().GetObjectsAtPosition3D(pb.GetPosition(), 30, objects, proxyCargos);
foreach (Object obj: objects)
{
	if (Class.CastTo(source, obj))
	{
		//! Create survivor NPC
		target = GetGame().CreateObject("SurvivorM_Mirek", source.GetPosition());
		break;
	}
}

if (target)
{
	string dmgZone = "";
	string ammoType = "LandFuelFeed_Ammo";
	vector modelPos = source.GetPosition();
	float dmgCoef = 1;
	int directDamageFlags = ProcessDirectDamageFlags.ALL_TRANSFER;
	target.ProcessDirectDamage(DamageType.EXPLOSION, source, dmgZone, ammoType, modelPos, dmgCoef, directDamageFlags);  //! Segfault
}

Event Timeline

lava76 created this task.Fri, May 23, 12:48 PM

Also segfaults if target is a player, so creating an NPC is not even needed.

Further testing shows any static/baked entity used as source causes the same crash.

Geez changed the task status from New to Assigned.Fri, May 23, 1:41 PM
Geez changed the task status from Assigned to Acknowledged.Tue, May 27, 1:18 PM