I am trying to determine via the OnEntityTakeDamage hook when the damage is caused by a RF triggered "c4". On the OxideMox & Umod discord it was suggested that I try checking for RFTimedExplosive as the HitInfo.Weapon value. However HitInfo.Weapon is empty:
private object OnEntityTakeDamage(BaseCombatEntity entity, HitInfo info)
{
if (info.Initiator is BasePlayer)
{
Puts("OnEntityTakeDamage called, initiator is BasePlayer");
Puts($"info.Weapon value: {info.Weapon}");
if (info.Weapon is RFTimedExplosive)
{
info.damageTypes.ScaleAll(0f);
}
}
return null;
}When RF explosive is detonated, this is what shows up in my console.
(20:51:54) | [devPlugin] OnEntityTakeDamage called, initiator is BasePlayer
(20:51:54) | [devPlugin] info.Weapon value:
(20:51:54) | [devPlugin] OnEntityTakeDamage called, initiator is BasePlayer
(20:51:54) | [devPlugin] info.Weapon value:
I'm looking at the DLLs with dnSpy. I don't understand why the AttackEntity class Weapon property is empty. I have updated the server and oxide to the latest stable. Any suggestions are appreciated.