Upload from upload_mods.ps1
This commit is contained in:
58
Scripts/Network/NPCs/NetPackageMoveToBedroll.cs
Normal file
58
Scripts/Network/NPCs/NetPackageMoveToBedroll.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
using static SleeperVolume;
|
||||
|
||||
public class NetPackageMoveToBedroll : NetPackage
|
||||
{
|
||||
private int entityID;
|
||||
public Vector3 position;
|
||||
|
||||
public NetPackageMoveToBedroll Setup(int _entityID, Vector3 _position)
|
||||
{
|
||||
this.entityID = _entityID;
|
||||
this.position = _position;
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _br)
|
||||
{
|
||||
this.entityID = _br.ReadInt32();
|
||||
this.position = StreamUtils.ReadVector3(_br);
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _bw)
|
||||
{
|
||||
base.write(_bw);
|
||||
_bw.Write(this.entityID);
|
||||
StreamUtils.Write(_bw, this.position);
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 6;
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageTeleporTo-ProcessPackage START");
|
||||
if (_world == null)
|
||||
{
|
||||
//Log.Out("NetPackageTeleporTo-ProcessPackage 1");
|
||||
return;
|
||||
}
|
||||
|
||||
Entity myEntity = _world.GetEntity(this.entityID);
|
||||
if (myEntity is EntityNPCRebirth hiredNPC)
|
||||
{
|
||||
hiredNPC.HideNPC(false);
|
||||
hiredNPC.guardPosition = Vector3.zero;
|
||||
hiredNPC.attackTarget = null;
|
||||
RebirthManager.UpdateHireInfo(hiredNPC.entityId, "order", "stay", position.ToString(), new Vector3(0, hiredNPC.rotation.y, 0).ToString());
|
||||
hiredNPC.Buffs.SetCustomVar("CurrentOrder", (int)EntityUtilities.Orders.Stay);
|
||||
RebirthManager.UpdateHireInfo(hiredNPC.entityId, "reSpawnPosition", "", Vector3.zero.ToString(), new Vector3(0, hiredNPC.rotation.y, 0).ToString());
|
||||
RebirthManager.UpdateHireInfo(hiredNPC.entityId, "spawnPosition", "", position.ToString(), new Vector3(0, hiredNPC.rotation.y, 0).ToString());
|
||||
RebirthManager.UpdateHireInfo(hiredNPC.entityId, "order", "guard", Vector3.zero.ToString(), Vector3.zero.ToString());
|
||||
hiredNPC.SetPosition(new Vector3(position.x, position.y + 1f, position.z));
|
||||
GameManager.Instance.StartCoroutine(RebirthUtilities.pauseSleep(hiredNPC, 1f));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user