OnExcavatorGather
OxideCarbonResourceCalled when an excavator gathers.
object OnExcavatorGather(ExcavatorArm excavatorArm, Item local8)Работает — метод игры в этой сборке тот же, под который написан хук.
Параметры
- excavatorArm
- ExcavatorArm
- local8
- Item
Возвращаемое значение
objectВерните не null, чтобы отменить действие игры.
Пример
object — можно повлиять на игру: вернуть значение, чтобы изменить или отменить действие.
private object OnExcavatorGather(ExcavatorArm excavatorArm, Item local8)
{
Puts("OnExcavatorGather");
// ничего не меняем — игра продолжит как обычно
return null;
// повлиять на игру:
// return false; // не null — действие игры отменяется
}Работает и в Oxide, и в Carbon: Carbon загружает плагины Oxide без изменений.
Место встраивания
Rust.opj (Oxide)
void ExcavatorArm.ProduceResources()
Передаёт: ExcavatorArm excavatorArm, Item local8
РаботаетReturnBehavior: ExitWhenValidTypeArgumentBehavior: UseArgumentString (this, l8)Assembly-CSharp.dll
Где вызывается (код игры этой ветки)
// …
{
continue;
}
int num3 = Mathf.FloorToInt(itemAmount.amount / (float)outputPiles.Count);
itemAmount.amount -= num3 * 2;
foreach (ExcavatorOutputPile outputPile in outputPiles)
{
Item item = ItemManager.Create(resourcesToMine[resourceMiningIndex].itemDef, num3, 0uL, isServerSide: true, 0uL);
if (Interface.CallHook("OnExcavatorGather", this, item) != null)
{
return;
}
Analytics.Azure.OnExcavatorProduceItem(item, this);
if (!item.MoveToContainer(outputPile.inventory))
{
item.Drop(outputPile.GetDropPosition(), outputPile.GetDropVelocity());
}
// …Источники: Rust.opj из OxideMod/Oxide.Rust (MIT) и метаданные хуков документации Carbon (MIT). Код методов — декомпиляция сервера этой ветки.