Various Fixes

Newly created drones now register their origin colony correctly
Hauling behavior fixed for multiple items
Buttons can't be dragged unless explicitly enabled
Inspecting a colony with lots of compound commodities no longer sets your computer on fire
This commit is contained in:
hyperion51 2020-07-03 01:33:42 +01:00
commit 1e2b474fc1
11 changed files with 133 additions and 47 deletions

View file

@ -28,7 +28,7 @@ public abstract class ControllerData : BehaviorData
public abstract class ControllerBase : IBehavior, IController, IInitializableBehavior
{
public Guid HomeEntity;
protected Guid HomeEntity => (_entity as Ship)?.HomeEntity ?? Guid.Empty;
public bool Available => _spaceworthy && Task == Guid.Empty;
public abstract TaskType TaskType { get; }
public Guid Zone => _entity.Zone;
@ -59,15 +59,24 @@ public abstract class ControllerBase : IBehavior, IController, IInitializableBeh
_context = context;
_controllerData = data;
_entity = entity;
entity.GearEvent.OnChanged += () => _spaceworthy = entity.GetBehavior<Thruster>() != null && entity.GetBehavior<Reactor>() != null;
entity.GearEvent.OnChanged += () =>
{
_spaceworthy = entity.GetBehavior<Thruster>() != null && entity.GetBehavior<Reactor>() != null;
if(_spaceworthy)
CreateBehaviors();
};
}
public void Initialize()
public void CreateBehaviors()
{
Locomotion = new Locomotion(_context, _entity, _controllerData);
VelocityMatch = new VelocityMatch(_context, _entity, _controllerData);
Aim = new Aim(_context, _entity, _controllerData);
}
public void Initialize()
{
CreateBehaviors();
_context.CorporationControllers[_entity.Corporation].Add(this);
}