Skip to content

OnTurretToggle

Usage

  • Return a non-null value to override default behavior

Example Autogenerated

csharp
private object OnTurretToggle( AutoTurret instance )
{
    Puts( "OnTurretToggle works!" );
    return null;
}

Location

  • AutoTurret::SetIsOnline(bool online)
csharp
//---
	BaseProjectile attachedWeapon = GetAttachedWeapon();
	if ((bool)attachedWeapon && attachedWeapon is ITurretNotify turretNotify)
	{
		turretNotify.OnAddedRemovedToTurret(online);
	}
	if (online != IsOn() && Interface.CallHook("OnTurretToggle", this) == null)
	{
		using (FlagsUpdateScope flagsUpdateScope = StartSetFlags(FlagsUpdateMode.SendNetworkUpdate))
		{
			flagsUpdateScope.Set(Flags.On, online);
		}
//---

Released under the MIT License.