Skip to content

OnWaterCollect

Usage

  • Return a non-null value to override default behavior

Example Autogenerated

csharp
private object OnWaterCollect( WaterCatcher instance )
{
    Puts( "OnWaterCollect works!" );
    return null;
}
csharp
private object OnWaterCollect( WaterPump instance, ItemDefinition itemDefinition )
{
    Puts( "OnWaterCollect works!" );
    return null;
}

Location

  • WaterCatcher::CollectWater()
  • WaterPump::CreateWater()
csharp
private void CollectWater()
{
	if (base.inventory != null && !IsFull() && Interface.CallHook("OnWaterCollect", this) == null)
	{
		float baseRate = collectionRates.baseRate;
		baseRate += Climate.GetFog(base.transform.position) * collectionRates.fogRate;
		if (TestIsOutside(base.transform, rainTestPosition, rainTestSize, 256f))
		{
//---
csharp
private void CreateWater()
{
	if (!IsFull())
	{
		ItemDefinition itemDefinition = WaterResource.SV_GetAtPoint(WaterResourceLocation.position);
		if (itemDefinition != null && Interface.CallHook("OnWaterCollect", this, itemDefinition) == null)
		{
			base.inventory.AddItem(itemDefinition, AmountPerPump, 0uL);
			UpdateOnFlag();
		}
	}
//---

Released under the MIT License.