OnPayForPlacement
OxidePlayerobject OnPayForPlacement(BasePlayer player, Planner planner, Construction component)
object OnPayForPlacement(BasePlayer player, WallpaperPlanner wallpaperPlanner, Construction component)Работает — метод игры в этой сборке тот же, под который написан хук.
Параметры
- player
- BasePlayer
- planner
- Planner
- component
- Construction
Возвращаемое значение
objectЕсли вернуть значение типа результата метода, игра сразу вернёт его; null — продолжит как обычно.
Пример
object — можно повлиять на игру: вернуть значение, чтобы изменить или отменить действие.
private object OnPayForPlacement(BasePlayer player, Planner planner, Construction component)
{
Puts("OnPayForPlacement");
// ничего не меняем — игра продолжит как обычно
return null;
// повлиять на игру:
// return null; // null — игра продолжит как обычно
}Работает и в Oxide, и в Carbon: Carbon загружает плагины Oxide без изменений.
Место встраивания 1
Rust.opj (Oxide)
void Planner.PayForPlacement(BasePlayer, Construction)
Передаёт: BasePlayer player, Planner planner, Construction component
РаботаетReturnBehavior: ExitWhenValidTypeArgumentBehavior: UseArgumentString (a0, this, a1)Assembly-CSharp.dll
Где вызывается (код игры этой ветки)
public virtual void PayForPlacement(BasePlayer player, Construction component)
{
if (Interface.CallHook("OnPayForPlacement", player, this, component) != null)
{
return;
}
if (player.IsInCreativeMode && Creative.freeBuild)
{
return;
}
if (player.IsInTutorial)
// …Место встраивания 2
Rust.opj (Oxide)
void WallpaperPlanner.PayForPlacement(BasePlayer, Construction)
Передаёт: BasePlayer player, WallpaperPlanner wallpaperPlanner, Construction component
РаботаетReturnBehavior: ExitWhenValidTypeArgumentBehavior: UseArgumentString (a0, this, a1)Assembly-CSharp.dll
Где вызывается (код игры этой ветки)
public override void PayForPlacement(BasePlayer player, Construction component)
{
if (Interface.CallHook("OnPayForPlacement", player, this, component) != null)
{
return;
}
if (!player.IsInCreativeMode || !Creative.freeBuild)
{
player.inventory.Take(null, placementPrice.itemid, (int)placementPrice.amount);
player.Command("note.inv", placementPrice.itemid, (int)placementPrice.amount * -1);
}
// …Источники: Rust.opj из OxideMod/Oxide.Rust (MIT) и метаданные хуков документации Carbon (MIT). Код методов — декомпиляция сервера этой ветки.