OnLiquidVesselFill
OxideCarbonEntityCalled when a liquid vessel is filled.
object OnLiquidVesselFill(BaseLiquidVessel baseLiquidVessel, BasePlayer local0, LiquidContainer local3)Работает — метод игры в этой сборке тот же, под который написан хук.
Параметры
- baseLiquidVessel
- BaseLiquidVessel
- local0
- BasePlayer
- local3
- LiquidContainer
Возвращаемое значение
objectВерните не null, чтобы отменить действие игры.
Пример
object — можно повлиять на игру: вернуть значение, чтобы изменить или отменить действие.
private object OnLiquidVesselFill(BaseLiquidVessel baseLiquidVessel, BasePlayer local0, LiquidContainer local3)
{
Puts("OnLiquidVesselFill");
// ничего не меняем — игра продолжит как обычно
return null;
// повлиять на игру:
// return false; // не null — действие игры отменяется
}Работает и в Oxide, и в Carbon: Carbon загружает плагины Oxide без изменений.
Место встраивания
Rust.opj (Oxide)
void BaseLiquidVessel.FillCheck()
Передаёт: BaseLiquidVessel baseLiquidVessel, BasePlayer local0, LiquidContainer local3
РаботаетReturnBehavior: ExitWhenValidTypeArgumentBehavior: UseArgumentString (this, l0, l3)Assembly-CSharp.dll
Где вызывается (код игры этой ветки)
// …
BasePlayer ownerPlayer = GetOwnerPlayer();
if (!ownerPlayer)
{
return;
}
float f = (Time.realtimeSinceStartup - lastFillTime) * fillMlPerSec;
Vector3 pos = ownerPlayer.transform.position - new Vector3(0f, 1f, 0f);
LiquidContainer facingLiquidContainer = GetFacingLiquidContainer();
if (Interface.CallHook("OnLiquidVesselFill", this, ownerPlayer, facingLiquidContainer) != null)
{
return;
}
if (facingLiquidContainer == null && CanFillFromWorld())
{
Item contents = GetContents();
ItemDefinition itemDefinition = WaterResource.SV_GetAtPoint(pos);
if (contents != null && contents.info.itemid != itemDefinition.itemid)
// …Источники: Rust.opj из OxideMod/Oxide.Rust (MIT) и метаданные хуков документации Carbon (MIT). Код методов — декомпиляция сервера этой ветки.