IOnBaseCombatEntityHurt
OxideEntityobject IOnBaseCombatEntityHurt(BaseCombatEntity baseCombatEntity, HitInfo info)Method changed — check — the game method differs from the one the hook is recorded for in Oxide. The hook is still called, but its place may have shifted — worth checking after an update.
Parameters
- baseCombatEntity
- BaseCombatEntity
- info
- HitInfo
Return value
objectReturn a value of the method's result type and the game returns it immediately; null continues as usual.
Example
object — you can affect the game: return a value to change or cancel the action.
private object IOnBaseCombatEntityHurt(BaseCombatEntity baseCombatEntity, HitInfo info)
{
Puts("IOnBaseCombatEntityHurt");
// change nothing — the game continues as usual
return null;
// to affect the game:
// return null; // null — the game continues as usual
}Works in both Oxide and Carbon: Carbon loads Oxide plugins as is.
Injection point
Rust.opj (Oxide)
void BaseCombatEntity.Hurt(HitInfo)
Passes: BaseCombatEntity baseCombatEntity, HitInfo info
Method changed — checkReturnBehavior: ExitWhenValidTypeArgumentBehavior: UseArgumentString (this, a0)Assembly-CSharp.dll
Where it is called (this branch's game code)
// …
}
else
{
num2 = 0f;
}
info.damageTypes.Scale(DamageType.Paintball, num2);
}
DebugHurt(info);
if (Interface.CallHook("IOnBaseCombatEntityHurt", this, info) != null)
{
return;
}
float num4 = info.damageTypes.Total();
health = num - num4;
SendNetworkUpdate();
LogEntry(RustLog.EntryType.Combat, 2, "hurt {0}/{1} - {2} health left", info.damageTypes.GetMajorityDamageType(), num4, health);
lastDamage = info.damageTypes.GetMajorityDamageType();
// …Sources: Rust.opj from OxideMod/Oxide.Rust (MIT) and hook metadata of the Carbon documentation (MIT). Method code is decompiled from this branch's server.