Failed to compile: 'HelicopterDebris' does not contain a definition for 'tooHotUntil' and no accessible extension method 'tooHotUntil' accepting a first argument of type 'HelicopterDebris' could be found (are you missing a using directive or an assembly reference?) | Line: 74, Pos: 28
Need update
The robots helped fix the plugin again. August doesn't seem to be doing plugins anymore, he hasn't responded anywhere for three years now.
using System;
using System.Collections.Generic;
using UnityEngine;
using System.Reflection;
namespace Oxide.Plugins
{
[Info("Instant Heli Loot", "August", "1.0.7")]
[Description("Instantly makes the wreckage of the helicopter and Bradley looted after destruction.")]
class InstantHeliLoot : CovalencePlugin
{
private const string UNLOCK_BRADLEY = "UnlockBradleyCrates";
private const string UNLOCK_HELI_CRATES = "UnlockHelicopterCrates";
private const string UNLOCK_HELI_GIBS = "UnlockHelicopterGibs";
private const string REMOVE_FIREBALLS = "RemoveFireballs";
private const string GIB_DELAY = "GibCheckDelay";
private const string GIB_RADIUS = "GibCheckRadius";
protected override void LoadDefaultConfig()
{
Config[UNLOCK_BRADLEY] = true;
Config[UNLOCK_HELI_CRATES] = true;
Config[UNLOCK_HELI_GIBS] = true;
Config[REMOVE_FIREBALLS] = true;
Config[GIB_DELAY] = 0.5f;
Config[GIB_RADIUS] = 30f;
}
private void Init()
{
if (!(bool)Config[UNLOCK_BRADLEY] && !(bool)Config[UNLOCK_HELI_CRATES])
Unsubscribe(nameof(OnEntityDeath));
}
private void OnServerShutdown() => SaveConfig();
private void UnlockCrates(Vector3 pos)
{
List<LockedByEntCrate> crates = new List<LockedByEntCrate>();
Vis.Entities(pos, 20f, crates);
foreach (var crate in crates) crate.SetLocked(false);
}
private void KillFire(Vector3 pos)
{
List<FireBall> fireBalls = new List<FireBall>();
Vis.Entities(pos, 20f, fireBalls);
foreach (FireBall fb in fireBalls) fb.Kill();
}
private void ForceCoolAllDebris(Vector3 position)
{
if (!(bool)Config[UNLOCK_HELI_GIBS]) return;
float delay = (float)Config[GIB_DELAY];
float radius = (float)Config[GIB_RADIUS];
timer.Once(delay, () =>
{
List<HelicopterDebris> debrisList = new List<HelicopterDebris>();
Vis.Entities(position, radius, debrisList);
foreach (var debris in debrisList)
{
if (debris == null || debris.IsDestroyed) continue;
try
{
// Method 1: We are trying to set the internal field _isHot
var isHotField = debris.GetType().GetField("_isHot", BindingFlags.NonPublic | BindingFlags.Instance);
if (isHotField != null)
{
isHotField.SetValue(debris, false);
Puts($"[Debris] Installed _isHot=false for {debris.net.ID}");
continue;
}
// Method 2: Trying the method SetIsHot
var setIsHot = debris.GetType().GetMethod("SetIsHot", BindingFlags.Instance | BindingFlags.Public);
if (setIsHot != null)
{
setIsHot.Invoke(debris, new object[] { false });
Puts($"[Debris] Called SetIsHot(false) for {debris.net.ID}");
continue;
}
// Method 3: Radical - disable all child objects with the component Fire
foreach (Transform child in debris.transform)
{
var fireComponent = child.GetComponent<Component>();
if (fireComponent != null && fireComponent.name.Contains("fire", StringComparison.OrdinalIgnoreCase))
{
child.gameObject.SetActive(false);
}
}
Puts($"[Debris] Disabled child objects with fire у {debris.net.ID}");
}
catch (Exception ex)
{
Puts($"[ERROR] Couldn't cool down {debris.net.ID}: {ex.Message}");
}
}
});
}
private void OnEntityDeath(BradleyAPC apc, HitInfo info)
{
var pos = apc.transform.position;
if ((bool)Config[UNLOCK_BRADLEY]) NextTick(() => UnlockCrates(pos));
if ((bool)Config[REMOVE_FIREBALLS]) NextTick(() => KillFire(pos));
}
private void OnEntityDeath(BaseHelicopter heli, HitInfo info)
{
var pos = heli.transform.position;
if ((bool)Config[UNLOCK_HELI_CRATES]) NextTick(() => UnlockCrates(pos)); // Fixed: UnlockCrates Instead of UnlinkCrates
if ((bool)Config[REMOVE_FIREBALLS]) NextTick(() => KillFire(pos));
ForceCoolAllDebris(pos);
}
private void OnEntitySpawned(HelicopterDebris debris)
{
if (!(bool)Config[UNLOCK_HELI_GIBS]) return;
timer.In(0.1f, () =>
{
if (debris == null || debris.IsDestroyed) return;
try
{
// We use all cooling methods
var isHotField = debris.GetType().GetField("_isHot", BindingFlags.NonPublic | BindingFlags.Instance);
if (isHotField != null) isHotField.SetValue(debris, false);
var setIsHot = debris.GetType().GetMethod("SetIsHot", BindingFlags.Instance | BindingFlags.Public);
if (setIsHot != null) setIsHot.Invoke(debris, new object[] { false });
// Method 3: Disabling child objects with fire
foreach (Transform child in debris.transform)
{
if (child.name.Contains("fire", StringComparison.OrdinalIgnoreCase))
{
child.gameObject.SetActive(false);
}
}
Puts($"[SPAWN] The debris has been cooled {debris.net.ID}");
}
catch (Exception ex)
{
Puts($"[SPAWN ERROR] {debris.net.ID}: {ex.Message}");
}
});
}
}
}