Upload from upload_mods.ps1

This commit is contained in:
Nathaniel Cosford
2025-06-04 16:44:53 +09:30
commit f1fbbe67bb
1722 changed files with 165268 additions and 0 deletions

View File

@@ -0,0 +1,189 @@
using Platform;
using System.Collections.Generic;
public class TileEntitySecureLootContainerRebirth : TileEntityLootContainer, ILockable
{
public int EntityId { get; set; }
public TileEntitySecureLootContainerRebirth(Chunk _chunk) : base(_chunk)
{
//Log.Out("TileEntitySecureLootContainerRebirth-TileEntitySecureLootContainerRebirth START");
this.allowedUserIds = new List<PlatformUserIdentifierAbs>();
this.isLocked = true;
this.ownerID = null;
this.password = "";
this.bPlayerPlaced = false;
this.isLootGatheringActivated = false;
}
public bool IsLocked()
{
//Log.Out("TileEntitySecureLootContainerRebirth-IsLocked START");
return this.isLocked;
}
public void SetLootGatheringActivated(bool _isLootGatheringActivated)
{
this.isLootGatheringActivated = _isLootGatheringActivated;
//Log.Out("TileEntitySecureLootContainerRebirth-SetLootGatheringActivated this.isLootGatheringActivated: " + this.isLootGatheringActivated);
this.setModified();
}
public void SetLocked(bool _isLocked)
{
//Log.Out("TileEntitySecureLootContainerRebirth-SetLocked START");
this.isLocked = _isLocked;
this.setModified();
}
public void SetOwner(PlatformUserIdentifierAbs _userIdentifier)
{
//Log.Out("TileEntitySecureLootContainerRebirth-SetOwner START");
this.ownerID = _userIdentifier;
this.setModified();
}
public bool IsUserAllowed(PlatformUserIdentifierAbs _userIdentifier)
{
//Log.Out("TileEntitySecureLootContainerRebirth-IsUserAllowed START");
return (_userIdentifier != null && _userIdentifier.Equals(this.ownerID)) || this.allowedUserIds.Contains(_userIdentifier);
}
public bool LocalPlayerIsOwner()
{
//Log.Out("TileEntitySecureLootContainerRebirth-LocalPlayerIsOwner START");
return this.IsOwner(PlatformManager.InternalLocalUserIdentifier);
}
public bool IsOwner(PlatformUserIdentifierAbs _userIdentifier)
{
//Log.Out("TileEntitySecureLootContainerRebirth-IsOwner START");
return _userIdentifier != null && _userIdentifier.Equals(this.ownerID);
}
public PlatformUserIdentifierAbs GetOwner()
{
//Log.Out("TileEntitySecureLootContainerRebirth-GetOwner START");
return this.ownerID;
}
public bool HasPassword()
{
//Log.Out("TileEntitySecureLootContainerRebirth-HasPassword START");
return !string.IsNullOrEmpty(this.password);
}
public string GetPassword()
{
//Log.Out("TileEntitySecureLootContainerRebirth-GetPassword START");
return this.password;
}
public bool CheckPassword(string _password, PlatformUserIdentifierAbs _userIdentifier, out bool changed)
{
//Log.Out("TileEntitySecureLootContainerRebirth-CheckPassword START");
changed = false;
if (_userIdentifier != null && _userIdentifier.Equals(this.ownerID))
{
if (Utils.HashString(_password) != this.password)
{
changed = true;
this.password = Utils.HashString(_password);
this.allowedUserIds.Clear();
this.setModified();
}
return true;
}
if (Utils.HashString(_password) == this.password)
{
this.allowedUserIds.Add(_userIdentifier);
this.setModified();
return true;
}
return false;
}
public override TileEntityType GetTileEntityType()
{
//Log.Out("TileEntitySecureLootContainerRebirth-GetTileEntityType START");
return (TileEntityType)RebirthUtilities.TileEntityRebirth.TileEntitySecureLootContainerRebirth;
}
public override void read(PooledBinaryReader _br, TileEntity.StreamModeRead _eStreamMode)
{
//Log.Out("TileEntitySecureLootContainerRebirth-read START");
base.read(_br, _eStreamMode);
_br.ReadInt32();
this.isLootGatheringActivated = _br.ReadBoolean();
this.bPlayerPlaced = _br.ReadBoolean();
this.isLocked = _br.ReadBoolean();
this.ownerID = PlatformUserIdentifierAbs.FromStream(_br, false, false);
this.password = _br.ReadString();
this.allowedUserIds = new List<PlatformUserIdentifierAbs>();
int num = _br.ReadInt32();
for (int i = 0; i < num; i++)
{
this.allowedUserIds.Add(PlatformUserIdentifierAbs.FromStream(_br, false, false));
}
}
public override void write(PooledBinaryWriter _bw, TileEntity.StreamModeWrite _eStreamMode)
{
//Log.Out("TileEntitySecureLootContainerRebirth-write START");
base.write(_bw, _eStreamMode);
_bw.Write(1);
_bw.Write(this.isLootGatheringActivated);
_bw.Write(this.bPlayerPlaced);
_bw.Write(this.isLocked);
this.ownerID.ToStream(_bw, false);
_bw.Write(this.password);
_bw.Write(this.allowedUserIds.Count);
for (int i = 0; i < this.allowedUserIds.Count; i++)
{
this.allowedUserIds[i].ToStream(_bw, false);
}
}
public int GetEntityID()
{
//Log.Out("TileEntitySecureLootContainerRebirth-GetEntityID START");
return this.entityId;
}
public void SetEntityID(int _entityID)
{
//Log.Out("TileEntitySecureLootContainerRebirth-SetEntityID START");
this.entityId = _entityID;
}
public override void UpgradeDowngradeFrom(TileEntity _other)
{
//Log.Out("TileEntitySecureLootContainerRebirth-UpgradeDowngradeFrom START");
base.UpgradeDowngradeFrom(_other);
if (_other is ILockable)
{
ILockable lockable = _other as ILockable;
this.SetEntityID(lockable.EntityId);
this.SetLocked(lockable.IsLocked());
this.SetOwner(lockable.GetOwner());
this.allowedUserIds = new List<PlatformUserIdentifierAbs>(lockable.GetUsers());
this.password = lockable.GetPassword();
this.setModified();
}
}
public List<PlatformUserIdentifierAbs> GetUsers()
{
//Log.Out("TileEntitySecureLootContainerRebirth-GetUsers START");
return this.allowedUserIds;
}
private const int ver = 1;
protected bool isLocked;
protected PlatformUserIdentifierAbs ownerID;
protected List<PlatformUserIdentifierAbs> allowedUserIds;
public float PickTimeLeft = -1f;
protected string password;
protected bool bPlayerPlaced;
public bool isLootGatheringActivated = false;
}