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
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user