Skip to content

Commit

Permalink
feat: WIP parse bombs
Browse files Browse the repository at this point in the history
  • Loading branch information
octfx committed Mar 2, 2024
1 parent 2d1046c commit b49337e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
16 changes: 15 additions & 1 deletion Loader/ItemBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public StandardisedItem BuildItem(EntityClassDefinition entity)
stdItem.Weapon = BuildWeaponInfo(entity);
stdItem.Ammunition = BuildAmmunitionInfo(entity);
stdItem.Missile = BuildMissileInfo(entity);
stdItem.Bomb = BuildBombInfo(entity);
stdItem.Scanner = BuildScannerInfo(entity);
stdItem.Radar = BuildRadarInfo(entity);
stdItem.Ping = BuildPingInfo(entity);
Expand Down Expand Up @@ -546,7 +547,7 @@ StandardisedAmmunition BuildAmmunitionInfo(EntityClassDefinition item)
Size = ammo.size,
ImpactDamage = ConvertDamage(impactDamage),
DetonationDamage = ConvertDamage(detonationDamage),
Capacity = item.Components.SAmmoContainerComponentParams?.maxAmmoCount
Capacity = item.Components.SAmmoContainerComponentParams?.maxAmmoCount ?? item.Components.SAmmoContainerComponentParams?.maxRestockCount
};
}

Expand Down Expand Up @@ -623,6 +624,19 @@ StandardisedMissile BuildMissileInfo(EntityClassDefinition item)
return info;
}

StandardisedMissile BuildBombInfo(EntityClassDefinition item)
{
var missile = item.Components.SCItemBombParams;
if (missile == null) return null;

var info = new StandardisedMissile
{
Damage = ConvertDamage(missile.explosionParams.damage[0])
};

return info;
}

StandardisedScanner BuildScannerInfo(EntityClassDefinition item)
{
var scanner = item.Components.SSCItemScannerComponentParams;
Expand Down
1 change: 1 addition & 0 deletions Loader/Json/StandardisedItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public class StandardisedItem
public StandardisedWeapon Weapon { get; set; }
public StandardisedAmmunition Ammunition { get; set; }
public StandardisedMissile Missile { get; set; }
public StandardisedMissile Bomb { get; set; }
public StandardisedScanner Scanner { get; set; }
public StandardisedRadar Radar { get; set; }
public StandardisedPing Ping { get; set; }
Expand Down
1 change: 1 addition & 0 deletions Loader/scdb.Xml/Entities/Components.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public class Components
public SCItemTurretParams SCItemTurretParams;
public SCItemEMPParams SCItemEMPParams;
public SCItemMissileParams SCItemMissileParams;
public SCItemMissileParams SCItemBombParams;
public SEntityComponentMiningLaserParams SEntityComponentMiningLaserParams;
public CommodityComponentParams CommodityComponentParams;
public SEntityInteractableParams SEntityInteractableParams;
Expand Down

0 comments on commit b49337e

Please sign in to comment.