Skip to content

OnPayForPlacement

Usage

  • Return a non-null value to override default behavior

Example Autogenerated

csharp
private object OnPayForPlacement( BasePlayer player, Planner instance, Construction component )
{
    Puts( "OnPayForPlacement works!" );
    return null;
}
csharp
private object OnPayForPlacement( BasePlayer player, WallpaperPlanner instance, Construction component )
{
    Puts( "OnPayForPlacement works!" );
    return null;
}

Location

  • Planner::PayForPlacement(BasePlayer player, Construction component)
  • WallpaperPlanner::PayForPlacement(BasePlayer player, Construction component)
csharp
public virtual void PayForPlacement(BasePlayer player, Construction component)
{
	if (Interface.CallHook("OnPayForPlacement", player, this, component) != null || (player.IsInCreativeMode && Creative.freeBuild))
	{
		return;
	}
	if (player.IsInTutorial)
	{
//---
csharp
public override void PayForPlacement(BasePlayer player, Construction component)
{
	if (Interface.CallHook("OnPayForPlacement", player, this, component) == null && (!player.IsInCreativeMode || !Creative.freeBuild))
	{
		player.inventory.Take(null, placementPrice.itemid, (int)placementPrice.amount);
		player.Command("note.inv", placementPrice.itemid, (int)placementPrice.amount * -1);
	}
}

Released under the MIT License.