OnApartmentRoomCheckout
OxideCarbonApartmentsobject OnApartmentRoomCheckout(BasePlayer player, ApartmentRoom apartmentRoom, ApartmentBuilding apartmentBuilding)Works — the game method in this build is the one the hook was written for.
Parameters
- player
- BasePlayer
- apartmentRoom
- ApartmentRoom
- apartmentBuilding
- ApartmentBuilding
Return value
objectThe result is checked in a special way — see the call code below.
Example
object — you can affect the game: return a value to change or cancel the action.
private object OnApartmentRoomCheckout(BasePlayer player, ApartmentRoom apartmentRoom, ApartmentBuilding apartmentBuilding)
{
Puts("OnApartmentRoomCheckout");
// 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 ApartmentBuilding.TryCheckout(BasePlayer)
Passes: BasePlayer player, ApartmentRoom apartmentRoom, ApartmentBuilding apartmentBuilding
WorksReturnBehavior: CustomAssembly-CSharp.dll
Where it is called (this branch's game code)
public bool TryCheckout(BasePlayer player)
{
if (GetPlayerApartmentSize(player) == ApartmentSize.None)
{
return false;
}
ApartmentRoom playerApartment = GetPlayerApartment(player);
object result = Interface.CallHook("OnApartmentRoomCheckout", player, playerApartment, this);
// … проверка результата (Modify-хук, см. Rust.opj)
Analytics.Azure.OnApartmentCheckOut(player, playerApartment);
Checkout(playerApartment);
return true;
}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.