Skip to content

OnEntitySnapshot

Usage

  • Return a non-null value to override default behavior

Example Autogenerated

csharp
private object OnEntitySnapshot( BaseNetworkable instance, Network.Connection connection )
{
    Puts( "OnEntitySnapshot works!" );
    return null;
}
csharp
private object OnEntitySnapshot( BaseNetworkable ent, Network.Connection connection )
{
    Puts( "OnEntitySnapshot works!" );
    return null;
}

Location

  • BaseNetworkable::SendAsSnapshot(Network.Connection connection, bool ordered)
  • BaseNetworkable::SendAsSnapshot(Network.Connection connection, Network.NetWrite write, bool ordered)
  • BasePlayer::SendEntitySnapshot(BaseNetworkable ent)
csharp
public void SendAsSnapshot(Connection connection, bool ordered = true)
{
	if (Interface.CallHook("OnEntitySnapshot", this, connection) == null)
	{
		NetWrite netWrite = Net.sv.StartWrite();
		uint val = (ordered ? (++connection.validate.entityUpdates) : uint.MaxValue);
		SaveInfo saveInfo = new SaveInfo
		{
//---
csharp
public void SendAsSnapshot(Connection connection, NetWrite write, bool ordered = true)
{
	uint val = (ordered ? (++connection.validate.entityUpdates) : uint.MaxValue);
	if (Interface.CallHook("OnEntitySnapshot", this, connection) == null)
	{
		SaveInfo saveInfo = new SaveInfo
		{
			forConnection = connection,
			forDisk = false
//---
csharp
private void SendEntitySnapshot(BaseNetworkable ent)
{
	if (Interface.CallHook("OnEntitySnapshot", ent, net.connection) != null)
	{
		return;
	}
	using (TimeWarning.New("SendEntitySnapshot"))
	{
//---

Released under the MIT License.