Page MenuHomeFeedback Tracker

Exp. 1.3.0.84 - Huge Issue with Destructible Buildings
New, NormalPublic

Description

Exp. 1.3.0.84

Hey everyone,

I've just come across an issue with building destruction and I'm not sure how we should handle this in the future or if it was simply overlooked.

The problem concerns mission-related objects: If these objects are placed inside a building and that building is destroyed by gunfire, the objects inside are deleted as well.

This can break the mission entirely, making it impossible to complete.

We need a way to exclude certain buildings from being destroyed. Otherwise, integrating buildings into missions will no longer be feasible.

Example:
In my mission, I placed a laptop inside a building. Players need to find it and download important information. If the building is destroyed, the laptop disappears as well – which defeats the entire purpose of the mission.

Is there a solution for this, or is an adjustment planned?

Details

Severity
Major
Resolution
Open
Reproducibility
Always
Operating System
Windows 11 x64
Category
General
Steps To Reproduce

Please include reproduction steps here!!!!

Event Timeline

R34P3R created this task.Fri, Feb 28, 2:15 PM

Ok, this litte Entity will solve the problem. If placed close to a building, to destruction can be disabled. Maybe you can also include something like this in vanilla?

class REAPER_DisableDestructionHelperEntityClass : GenericEntityClass {}

class REAPER_DisableDestructionHelperEntity : GenericEntity
{
	[Attribute("10", uiwidget: UIWidgets.Auto, desc: "REAPER: Search radius for Buldings", category: "REAPER Disable Building Destruction Helper")]
	protected int m_SearchForBuildingsRadius;
	
	[Attribute("1", uiwidget: UIWidgets.Auto, desc: "REAPER: Only disable the first building, found in query", category: "REAPER Disable Building Destruction Helper")]
	protected bool m_OnlyDisableTheFirstBuilding;
	
	//------------------------------------------------------------------------------------------
	
	override event protected void EOnActivate(IEntity owner)
	{
		if(!Replication.IsServer()) return;
		
		BaseWorld world = GetGame().GetWorld();	
		world.QueryEntitiesBySphere(owner.GetOrigin(), m_SearchForBuildingsRadius, REAPER_GetNearBuildingsQuery, null, EQueryEntitiesFlags.STATIC);	
	}
	
	//------------------------------------------------------------------------------------------------
	
	protected bool REAPER_GetNearBuildingsQuery(IEntity ent)
	{		
		SCR_DestructibleBuildingEntity buildingEnt = SCR_DestructibleBuildingEntity.Cast(ent); 	
		if(buildingEnt) {
			
			SCR_DestructibleBuildingComponent destructComp = SCR_DestructibleBuildingComponent.Cast(buildingEnt.FindComponent(SCR_DestructibleBuildingComponent)); 
			if(destructComp) {
				
				destructComp.EnableDamageHandling(false); 
				if(m_OnlyDisableTheFirstBuilding) return false;
			}
		}
		// Keep looking
		return true;
	}	
}