Enable deleting characters when there is no controller attached.
Increase !save timeout to 5 mintues
This commit is contained in:
@@ -4,14 +4,24 @@ namespace Torch.Server.ViewModels.Entities
|
|||||||
{
|
{
|
||||||
public class CharacterViewModel : EntityViewModel
|
public class CharacterViewModel : EntityViewModel
|
||||||
{
|
{
|
||||||
|
private MyCharacter _character;
|
||||||
public CharacterViewModel(MyCharacter character, EntityTreeViewModel tree) : base(character, tree)
|
public CharacterViewModel(MyCharacter character, EntityTreeViewModel tree) : base(character, tree)
|
||||||
{
|
{
|
||||||
character.ControllerInfo.ControlAcquired += (x) => { OnPropertyChanged(nameof(Name)); };
|
_character = character;
|
||||||
character.ControllerInfo.ControlReleased += (x) => { OnPropertyChanged(nameof(Name)); };
|
character.ControllerInfo.ControlAcquired += ControllerInfo_ControlAcquired;
|
||||||
|
character.ControllerInfo.ControlReleased += ControllerInfo_ControlAcquired;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ControllerInfo_ControlAcquired(Sandbox.Game.World.MyEntityController obj)
|
||||||
|
{
|
||||||
|
OnPropertyChanged(nameof(Name));
|
||||||
|
OnPropertyChanged(nameof(CanDelete));
|
||||||
}
|
}
|
||||||
|
|
||||||
public CharacterViewModel()
|
public CharacterViewModel()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override bool CanDelete => _character.ControllerInfo?.Controller?.Player == null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -136,7 +136,7 @@ namespace Torch.Server.ViewModels.Entities
|
|||||||
|
|
||||||
public virtual bool CanStop => Entity.Physics?.Enabled ?? false;
|
public virtual bool CanStop => Entity.Physics?.Enabled ?? false;
|
||||||
|
|
||||||
public virtual bool CanDelete => !(Entity is IMyCharacter);
|
public virtual bool CanDelete => true;
|
||||||
|
|
||||||
public virtual void Delete()
|
public virtual void Delete()
|
||||||
{
|
{
|
||||||
|
@@ -261,7 +261,7 @@ namespace Torch.Commands
|
|||||||
|
|
||||||
private Task DoSave()
|
private Task DoSave()
|
||||||
{
|
{
|
||||||
Task<GameSaveResult> task = Context.Torch.Save(60 * 1000, true);
|
Task<GameSaveResult> task = Context.Torch.Save(300 * 1000, true);
|
||||||
if (task == null)
|
if (task == null)
|
||||||
{
|
{
|
||||||
Context.Respond("Save failed, a save is already in progress");
|
Context.Respond("Save failed, a save is already in progress");
|
||||||
|
Reference in New Issue
Block a user