Use typed item keys in behavior item refs

This commit is contained in:
Meta Vens 2026-06-14 23:31:54 +01:00
commit 95bd76ee91
10 changed files with 48 additions and 24 deletions

View file

@ -127,12 +127,12 @@ public class InstantWeapon : Weapon, IProgressBehavior, IEventBehavior
}
var hasAmmo = true;
if (_data.AmmoType != Guid.Empty)
if (!string.IsNullOrWhiteSpace(_data.AmmoItemKey))
{
var cargo = Entity.FindItemInCargo(_data.AmmoType);
var cargo = Entity.FindItemInCargo(_data.AmmoItemKey);
if (cargo != null)
{
var item = cargo.GetFirstItem(_data.AmmoType);
var item = cargo.GetFirstItem(_data.AmmoItemKey);
if (item is SimpleCommodity simpleCommodity)
cargo.Remove(simpleCommodity, 1);
}