Enable deleting characters when there is no controller attached.

Increase !save timeout to 5 mintues
This commit is contained in:
Brant Martin
2019-06-02 11:15:16 -04:00
parent 91ceb0aa22
commit 7036a4da81
3 changed files with 14 additions and 4 deletions

View File

@@ -4,14 +4,24 @@ namespace Torch.Server.ViewModels.Entities
{
public class CharacterViewModel : EntityViewModel
{
private MyCharacter _character;
public CharacterViewModel(MyCharacter character, EntityTreeViewModel tree) : base(character, tree)
{
character.ControllerInfo.ControlAcquired += (x) => { OnPropertyChanged(nameof(Name)); };
character.ControllerInfo.ControlReleased += (x) => { OnPropertyChanged(nameof(Name)); };
_character = character;
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 override bool CanDelete => _character.ControllerInfo?.Controller?.Player == null;
}
}