Upload from upload_mods.ps1
This commit is contained in:
67
Scripts/Network/NetPackageSetGuardPositionRebirth.cs
Normal file
67
Scripts/Network/NetPackageSetGuardPositionRebirth.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
public class NetPackageSetGuardPositionRebirth : NetPackage
|
||||
{
|
||||
private int entityToUpdate;
|
||||
private int positionEntityID;
|
||||
|
||||
public NetPackageSetGuardPositionRebirth Setup(int _entityToUpdate, int _positionEntityID)
|
||||
{
|
||||
this.entityToUpdate = _entityToUpdate;
|
||||
this.positionEntityID = _positionEntityID;
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _br)
|
||||
{
|
||||
this.entityToUpdate = _br.ReadInt32();
|
||||
this.positionEntityID = _br.ReadInt32();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _bw)
|
||||
{
|
||||
base.write(_bw);
|
||||
_bw.Write(this.entityToUpdate);
|
||||
_bw.Write(this.positionEntityID);
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageSetGuardPositionRebirth-ProcessPackage START");
|
||||
if (_world == null)
|
||||
{
|
||||
//Log.Out("NetPackageSetGuardPositionRebirth-ProcessPackage 1");
|
||||
return;
|
||||
}
|
||||
|
||||
/*if (!_world.IsRemote())
|
||||
{
|
||||
Log.Out("NetPackageSetGuardPositionRebirth-ProcessPackage 2");
|
||||
return;
|
||||
}*/
|
||||
|
||||
EntityAliveV2 myEntity = (EntityAliveV2)_world.GetEntity(this.entityToUpdate);
|
||||
if (myEntity != null)
|
||||
{
|
||||
EntityAlive positionEntity = (EntityAlive)_world.GetEntity(this.positionEntityID);
|
||||
if (positionEntity != null)
|
||||
{
|
||||
if (entityToUpdate == positionEntityID)
|
||||
{
|
||||
myEntity.guardPosition = positionEntity.position;
|
||||
}
|
||||
else
|
||||
{
|
||||
myEntity.guardPosition = EntityUtilities.CenterPosition(positionEntity.position);
|
||||
}
|
||||
myEntity.guardPosition = EntityUtilities.CenterPosition(positionEntity.position);
|
||||
myEntity.bWillRespawn = true;
|
||||
myEntity.guardLookPosition = positionEntity.position + positionEntity.GetLookVector();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user