Skip to content

OnEntityControl

Usage

  • Return a non-null value to override default behavior

Example Autogenerated

csharp
private void OnEntityControl( AutoTurret instance, ulong playerID )
{
    Puts( "OnEntityControl works!" );
}
csharp
private void OnEntityControl( PoweredRemoteControlEntity instance, ulong playerID )
{
    Puts( "OnEntityControl works!" );
}
csharp
private void OnEntityControl( RemoteControlEntity instance, ulong playerID )
{
    Puts( "OnEntityControl works!" );
}

Location

  • AutoTurret::CanControl(ulong playerID)
  • PoweredRemoteControlEntity::CanControl(ulong playerID)
  • RemoteControlEntity::CanControl(ulong playerID)
csharp
public virtual bool CanControl(ulong playerID)
{
	object returnvar = Interface.CallHook("OnEntityControl", this, playerID);
	if (returnvar is bool)
	{
		return (bool)returnvar;
	}
	return !this.booting && this.IsPowered() && !this.PeacekeeperMode();
//---
csharp
public virtual bool CanControl(ulong playerID)
{
	object returnvar = Interface.CallHook("OnEntityControl", this, playerID);
	if (returnvar is bool)
	{
		return (bool)returnvar;
	}
	return this.IsPowered() || this.IsStatic();
//---
csharp
public virtual bool CanControl(ulong playerID)
{
	object returnvar = Interface.CallHook("OnEntityControl", this, playerID);
	return !(returnvar is bool) || (bool)returnvar;
}

Released under the MIT License.