Use typed item keys in server item decisions
This commit is contained in:
parent
4891c7fafc
commit
c245538793
5 changed files with 6 additions and 7 deletions
|
|
@ -2,8 +2,6 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
using System;
|
||||
|
||||
public class HaulingTask : AgentTask
|
||||
{
|
||||
public override TaskType Type => TaskType.Haul;
|
||||
|
|
@ -12,7 +10,7 @@ public class HaulingTask : AgentTask
|
|||
|
||||
public Entity Target;
|
||||
|
||||
public Guid ItemType;
|
||||
public string ItemKey;
|
||||
|
||||
public int Quantity;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -404,7 +404,7 @@ public abstract class Entity
|
|||
public void GenerateWeaponGroups()
|
||||
{
|
||||
foreach (var group in Weapons
|
||||
.GroupBy(w => w.Item.EquippableItem.ItemId)
|
||||
.GroupBy(w => w.Item.EquippableItem.ItemKey)
|
||||
.OrderBy(wg=>wg.Average(w=>w.Range))
|
||||
.Select((weapons, index) => (weapons, index)))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -336,9 +336,7 @@ public class LoadoutGenerator
|
|||
var itemRow = previousItems.FirstOrDefault(i => FitsHardpoint(i, hardpoint));
|
||||
var previousItem = itemRow == null
|
||||
? null
|
||||
: Guid.TryParse(itemRow.LegacyId, out var previousItemId)
|
||||
? entity.Equipment.FirstOrDefault(item => item.EquippableItem.ItemId == previousItemId)
|
||||
: null;
|
||||
: entity.Equipment.FirstOrDefault(item => item.EquippableItem.ItemKey == itemRow.ItemKey);
|
||||
itemRow ??= RandomCatalogItem(RuntimeItemCandidateKind.Gear, hardpoint, 2);
|
||||
if (itemRow == null) ItemManager.Log($"No compatible item found for entity {hardpoint.Type} hardpoint!");
|
||||
else
|
||||
|
|
|
|||
Loading…
Reference in a new issue