AmmoMagazine Definition

From Space Engineers Wiki
Jump to navigation Jump to search

An inventory item that can hold rounds (ammo).
Referenced by Weapon Definition (section AmmoMagazines) and of course anywhere else that where an item can be referenced.

Elements

AmmoDefinitionId

<AmmoDefinitionId>
Type: AmmoDefinitionDefault(invalid)
Required. The ammo that this magazine holds.

Expects SubtypeId of either a ProjectileAmmo Definition or MissileAmmo Definition.

Usage example:
<AmmoDefinitionId Subtype="PistolCaliber" />

Capacity

<Capacity>
Type: Int32Default0
Amount of rounds this magazine holds.
Needs at least 1 to function properly.

(Top) | From PhysicalItem Definition:

Model

<Model>
Type: StringDefaultModels\Components\Sphere.mwm
Shown for this item when it's a floating object, unless <Models> is defined in which case this is ignored.

Path to a .mwm file relative to current mod's folder. Falls back to game folder if not found in current mod.

Referencing assets in other mods

Models

<Models>
Type: String[]Defaultnull
A list of paths to .mwm files where the game will pick one randomly when the item spawns as a floating object.

Relative path to current mod's folder. Falls back to game folder if not found in current mod.
The <Model>...</Model> inside this can be declared multiple times to have more models.

<Models>
  <Model>Models\SomeModel1.mwm</Model>
  <!-- ... -->
</Models>
If this is defined it also replaces the use of DebrisModels.sbc, see <VoxelMaterial> section for details.

Volume

<Volume>
Type: Nullable<Single>Defaultnull
How much space it occupies in an inventory, in liters.
If undefined, uses <Size>'s volume (x*y*z).

Size

<Size>
Type: Vector3Default{X:0 Y:0 Z:0}
Used in a few places:
  • If any of the axes are higher than 0.25 then this item cannot be conveyored through small ports. Exceptions are PhysicalGunObject types which are always allowed.
  • ShipConnector uses this to know how far ahead to place the item when ejecting it, uses half of the largest number.
  • As fallback if <Volume> is not defined, where the axes are multiplied with eachother (x*y*z).
Usage:
<Size>
  <X>0.5</X>
  <Y>0.5</Y>
  <Z>0.01</Z>
</Size>

Health

<Health>
Type: Int32Default100
Hit points when this item is a floating item. It also takes 10x the damage therefore this should be 10 times larger than it needs to be.

Note: not used for Ore or Ingot item types, those will instead lose amount from the stack equal to the damage taken.

Hardcoded to spawn Smoke_Construction particle when it's destroyed (on all types).

Mass

<Mass>
Type: SingleDefault0
In kg, the mass of the item.

Note: if this is an Ore type you should leave this to 1 to avoid problems, volume can vary however.

Affects mass of cargo it's placed in, and if it's a Component type used for building a block it affects the block's base mass (unless <HasPhysics> is false on the block).

IconSymbol

<IconSymbol>
Type: StringDefaultnull
Text shown top-right in the item's icon.

MaxStackAmount

<MaxStackAmount>
Type: MyFixedPointDefault9223372036854.775807
Max number of items that can be stacked into one inventory slot.

CanSpawnFromScreen

<CanSpawnFromScreen>
Type: BooleanDefaulttrue
Whether this item appears in the admin spawn menu and in the conveyor sorter's filter list.

RotateOnSpawnX

<RotateOnSpawnX>
Type: BooleanDefaultfalse
Whether to spawn the item facing 90deg up.

RotateOnSpawnY

<RotateOnSpawnY>
Type: BooleanDefaultfalse
Whether to spawn the item facing 90deg right. It rotates after <RotateOnSpawnX>'s rotation.

RotateOnSpawnZ

<RotateOnSpawnZ>
Type: BooleanDefaultfalse
Whether to spawn the item rolled 90deg left. It should not be used with <RotateOnSpawnY> enabled.

DestroyedPieceId

<DestroyedPieceId>
Type: SerializableDefinitionId?Defaultnull
When this item is destroyed as a floating object, it spawns the given Id, with <DestroyedPieces> amount.
Usage:
<DestroyedPieceId Type="Ore" Subtype="Stone" />

If left null it will not spawn anything.

Note: This won't function for items with the Scrap SubtypeId (of any type).

DestroyedPieces

<DestroyedPieces>
Type: Int32Default0
How many of <DestroyedPieceId> to spawn.

DestroySound

<DestroySound>
Type: StringDefaultnull
Only used if the item explodes, for the explosion sound.
See Explosive Items for details.

ExtraInventoryTooltipLine

<ExtraInventoryTooltipLine>
Type: StringDefaultnull
Text to be added to the item's tooltip seen in inventory screens.

ExtraInventoryTooltipLineId

<ExtraInventoryTooltipLineId>
Type: StringDefaultnull
Localization key for text to be added to the item's tooltip. It likely will also print the raw text if the key does not exist.
If defined, this overrides <ExtraInventoryTooltipLine>.

CanPlayerOrder

<CanPlayerOrder>
Type: BooleanDefaultfalse
Whether this item can be used in player's StoreBlocks.

MinimalPricePerUnit

<MinimalPricePerUnit>
Type: Int32Default-1
The minimum Space Credits that this item should cost.

If set to -1 the minimum price is instead calculated from the minimal price of the items that create this item which in turn will use this element from those items or calculated from those items' blueprints, and so on deeper and deeper. Also the calculated price includes the blueprint time divided by the world's refinery speed multiplier if the resulting item is an Ingot type, or assembler speed multiplier for anything else.
The minimal price is used in all sorts of places by the economy system, for example to restrict how low an item can be sold for by players at Store blocks and in calculating price of a ship sold at trade stations.

More details in: Deep Overview of NPC Economy

MinimumOfferAmount

<MinimumOfferAmount>
Type: Int32Default0
See <MaximumOfferAmount>.

MaximumOfferAmount

<MaximumOfferAmount>
Type: Int32Default0
For Economy trade stations sold items (FactionTypes.sbc), picks a random number between <MinimumOfferAmount> and this when the trade station refreshes its stock.
More details in: Deep Overview of NPC Economy

MinimumOrderAmount

<MinimumOrderAmount>
Type: Int32Default0
See <MaximumOrderAmount>.

MaximumOrderAmount

<MaximumOrderAmount>
Type: Int32Default0
For Economy trade stations buy requests (FactionTypes.sbc), picks a random number between <MinimumOrderAmount> and this when the trade station refreshes its stock.
More details in: Deep Overview of NPC Economy

MinimumAcquisitionAmount

<MinimumAcquisitionAmount>
Type: Int32Default10
See <MaximumAcquisitionAmount>.

MaximumAcquisitionAmount

<MaximumAcquisitionAmount>
Type: Int32Default100
Only if this item is used in an obtain and deliver's <AvailableItems>.
Random amount between <MinimumAcquisitionAmount> and this (both included) would be required for the contract if this item is picked.

PhysicalMaterial

<PhysicalMaterial>
Type: StringDefaultnull
SubtypeId of a PhysicalMaterial Definition (PhysicalMaterials.sbc).

Visit Collision Effects for more details on what it's used for in general.

If <VoxelMaterial> is assigned (can self-assign, see there for details) this will be ignored and will use Rock for the floating object instead.

VoxelMaterial

<VoxelMaterial>
Type: StringDefaultnull
A subtypeId for a voxel material (VoxelMaterials*.sbc).

Note: If undefined it can still get a material assigned automatically if the item type is Ore and any voxel material's <MinedOre> points to this item's SubtypeId.
If this has a material assigned, changes a few things:

  • If this is an Ore type, the visual model used for the floating object will be automatically picked from Debris definition (DebrisModels.sbc; only <Type>Voxel</Type> ones) based on amount stacked.
  • Floating object's physical collider is a sphere the size of the radius of a sphere encasing the model's boundingbox, normally it's a box using model's boundingbox.
  • Floating object's physical material will use Rock instead of whatever is assigned to <PhysicalMaterial>.
  • Stores the floating object internally as a "Floating Ore" instead of "Floating Item", has some consequences to how soon they vanish when the floating objects limit is reached.
  • If using custom models, the game will crash if the model has any textures assigned to its material. See RockDebris .fbx and .xml from the SDK. The game will assign the textures from the voxel material to your textureless model.

(Top) | From DefinitionBase:

Common

Id

<Id>
Type: SerializableDefinitionIdDefault(invalid)
The type and subtype combined make up a unique identifier for this definition.

If two definitions use the same Type+Subtype (Subtypes are only unique per Type), then the last to load will override the first one(s). For more details see Things to know about SBC.

<TypeId>Type: stringDefault(invalid)
Must be an existing type with or without the "MyObjectBuilder_" prefix.

Some types require an xsi:type, refer to the vanilla files for the exact pairing.

TypeId vs xsi:type
<SubtypeId>Type: stringDefault(empty)
This can be invented and only needs to be unique per TypeId.

Vanilla game re-uses some subtypes over multiple types (e.g. Iron is used for Ore type and Ingot type).

An empty value is also a valid subtype (which vanilla also uses on at least 5 blocks).
Type (attribute[1])Type: stringDefault(invalid)
Same behavior as <TypeId>, do not define both.
Subtype (attribute[1])Type: stringDefault(empty)
Same behavior as <SubtypeId>, do not define both.
Example:
<Id>
  <TypeId>CubeBlock</TypeId>
  <SubtypeId>FancyTable</SubtypeId>
</Id>

Because it has attribute alternatives it can also be declared as:

<Id Type="CubeBlock" Subtype="FancyTable" />

DisplayName

<DisplayName>
Type: StringDefaultnull
If the object defined here is visible anywhere in the game GUI, this would be the name shown for it. In cases where it is used, it is very much required.

Can be plain-text.
If the text contains DisplayName_ then:

Description

<Description>
Type: StringDefaultnull
Optional. If the object defined here is shown with a description in the game GUI (Hotbar/G-menu, HUD, etc) then this is the place to write it.

Can be plain-text.
If the text contains Description_ then:

If the final text (plain, localized or variable-replaced) contains {0}, {1}, etc, then they will replaced by kb&m control binds defined in <DescriptionArgs>.

DescriptionArgs

<DescriptionArgs>
Type: StringDefaultnull
Optional. A comma-separated list of control IDs which are referenced in <Description> by {number} tags, which then get replaced by the keyboard or mouse bind that the viewer has for those controls.
Example:
<Description>Press {0} to fire, {1} to change color, {2} to interact.</description>
<DescriptionArgs>PRIMARY_TOOL_ACTION,CUBE_COLOR_CHANGE,USE</DescriptionArgs>

And each player will see their current binds for those actions.

The control IDs can be found in your %appdata%/SpaceEngineers/SpaceEngineers.cfg at the ControlsButtons section.

Icon

<Icon>
Type: String[]Defaultnull
Icon(s) for the definition which may or may not be used depending on the definition type.

Path to a .dds or .png file relative to current mod's folder. Falls back to game folder if not found in current mod. Referencing assets in other mods

Can be declared multiple times which will stack icons on top of eachother, however it will not work for all definitions.

Known definitions to work or not work with multiple icons
  • Working: Blocks, BlockVariantGroups and component items seen in G-menu, BlockInfo (HUD right side) and toolbars; Blueprints in terminal production tab; Blocks and PhysicalItems in gamepad HUD.
  • Partial: Blocks seen in terminal.
  • Not working: HandItems (uses PhysicalItem's icon instead); Blocks and BlockVariantGroups seen in build planner, radial menu and some economy GUIs; PhysicalItems in economy GUIs and stores; Prefabs in stores; BlueprintClass (tabs) in terminal production tab; Voxel materials (voxel hand); BankingSystemDefinition (Game\BankingSystem.sbc); Emotes (both kinds of definitions) in gamepad HUD; Block skins; RespawnShips.
  • Special cases: Economy contracts, FactionIcons Definition.

DLC

<DLC>
Type: String[]Defaultnull
Optional. The DLC subtypeId that this definition will require.

For the IDs, refer to <SE>\Content\Data\Game\DLCs.sbc.
Can be declared multiple times to require multiple DLCs.

Most definition types won't check for this, the ones that do: blocks, emotes and possibly anything else that can be placed in the toolbar.

AvailableInSurvival

<AvailableInSurvival>
Type: BooleanDefaulttrue
Depends on the definition if it uses this, and if it does then this determines whether it can be accessible in survival game mode.

Currently known definitions that do use this:

Public

<Public>
Type: BooleanDefaulttrue
If the definition is visible or accessible in some cases.
For blocks, this only hides them and they can still be built using projectors and other means.

Enabled

Enabled (attribute[1])
Type: BooleanDefaulttrue
If set to false it will remove the definition after it's been loaded.
Example usage:
<Definition Enabled="false">

The "Definition" above is the opening element that for the entire definition, not an inner node like <DisplayName> is.

The opening node can have a different name for other definitions, some examples <Component>, <Blueprint>, etc.

Obsolete Elements

Elements that exist in the game code or vanilla SBC, but do nothing

Note: this list only contains root-level from this definition only, nothing from inherited ones.

<Category>Type: MyAmmoCategoryEnumDefaultSmallCaliber
Obsolete. Was replaced by <AmmoDefinitionId>.
Available options: LargeCaliber, SmallCaliber, Missile - which will look up that exact subtype of ammo.