Ship Building & Drydock

Made it possible to turn new hulls into drones which can then be outfitted and activated for service
Missing blueprint ingredients no longer crash the game and gracefully log what's broken
Loadout cargo is now stored entirely separate from gear
This commit is contained in:
hyperion51 2020-06-11 02:55:11 +01:00
commit a901a8e829
17 changed files with 167 additions and 226 deletions

View file

@ -21,113 +21,10 @@ public class Ship : Entity
{
}
// public Gear GetEquipped(HardpointType type)
// {
// return Hardpoints.FirstOrDefault(hp => hp.HardpointData.Type == type)?.Item;
// }
//
// public T GetEquipped<T>() where T : EquippableItemData
// {
// var data = Hardpoints.FirstOrDefault(hp => Context.GetData(hp.Item) is T);
// if (data != null)
// return Context.GetData(data.Item) as T;
// return null;
// }
//
// public void Hydrate()
// {
// GenerateBehaviors();
//
// //HullHardpointCount = Hardpoints.Count(hp => hp.HardpointData.Type == HardpointType.Hull);
// }
//
// private void GenerateBehaviors()
// {
// }
// public void GenerateBindings()
// {
// Bindings = new Dictionary<KeyCode, Guid>();
//
// var bindables =
// ItemBindings.Select(id => new {id=id.Key, eq = id.Value.First().Hardpoint.Item.ItemData}).ToList();
//
// var weapons = bindables.Where(i => i.eq.HardpointType.IsWeapon()).ToArray();
//
// var mouseButtons = Enumerable.Range((int) KeyCode.Mouse0, 3).Cast<KeyCode>();
// foreach (var x in weapons.Zip(mouseButtons, (binding, key) => new {binding,key}))
// {
// Bindings.Add(x.key, x.binding.id);
// bindables.Remove(x.binding);
// }
//
// var thruster = bindables.FirstOrDefault(x => x.eq.HardpointType == HardpointType.Thruster);
// if (thruster != null)
// {
// Bindings.Add(KeyCode.LeftShift, thruster.id);
// bindables.Remove(thruster);
// }
//
// var utility = bindables.FirstOrDefault(x => !x.eq.HardpointType.IsWeapon());
// if (utility != null)
// {
// Bindings.Add(KeyCode.Space, utility.id);
// bindables.Remove(utility);
// }
//
// var numKeys = Enumerable.Range((int) KeyCode.Alpha1, 9).Cast<KeyCode>();
// foreach (var x in bindables.Zip(numKeys, (binding, key) => new {binding,key}))
// {
// Bindings.Add(x.key, x.binding.id);
// }
//
// }
// public void Activate(KeyCode binding)
// {
// if (Bindings.ContainsKey(binding))
// foreach (var behavior in ItemBindings[Bindings[binding]])
// {
// behavior.Activate();
// if(behavior.Hardpoint.ActionBarButton!=null)
// behavior.Hardpoint.ActionBarButton.Background.color = Color.yellow;
// }
// }
//
// public void Deactivate(KeyCode binding)
// {
// if(Bindings.ContainsKey(binding))
// foreach (var behavior in ItemBindings[Bindings[binding]])
// {
// behavior.Deactivate();
// if(behavior.Hardpoint.ActionBarButton!=null)
// behavior.Hardpoint.ActionBarButton.Background.color = GlobalData.Instance.UnselectedElementColor;
// }
// }
public override void Update(float delta)
{
Position += Velocity * delta;
base.Update(delta);
// foreach (var kvp in Contacts.ToArray())
// if (kvp.Key == null || Time.time - kvp.Value > GlobalData.Instance.TargetPersistenceDuration)
// {
// Contacts.Remove(kvp.Key);
// if (kvp.Key == Target)
// Target = null;
// }
}
// public void UpdateInput(float delta)
// {
// foreach (var key in Bindings.Keys)
// {
// if(Input.GetKeyDown(key))
// Activate(key);
// if(Input.GetKeyUp(key))
// Deactivate(key);
// }
//
// }
}