ammobox
Vars | |
ammo_count | Positive Integer. The amount on ammunition currently in this box. Generally, you should not modify directly. See insert_casing() and remove_casing() . |
---|---|
ammo_max | Positive Integer. The maximum amount of ammunition this box can hold. |
ammo_spent | Boolean. Whether or not the box is carrying spent or unspent rounds. |
ammo_type | Path (Subtypes of /obj/item/ammo_casing ). The ammo type this ammo box holds. Generally, you should not modify directly. See set_ammo_type() |
Procs | |
can_insert_casing | Checks if the casing can be added to the box. |
insert_casing | Adds ammo_casing to the ammo box's inventory. Checks can_insert_casing() . |
remove_casing | Removes a casing and places it in target . |
set_ammo_type | Sets the box's ammo_type to the given type, updating its name in the process. |
Var Details
ammo_count
Positive Integer. The amount on ammunition currently in this box. Generally, you should not modify directly. See insert_casing()
and remove_casing()
.
ammo_max
Positive Integer. The maximum amount of ammunition this box can hold.
ammo_spent
Boolean. Whether or not the box is carrying spent or unspent rounds.
ammo_type
Path (Subtypes of /obj/item/ammo_casing
). The ammo type this ammo box holds. Generally, you should not modify directly. See set_ammo_type()
Proc Details
can_insert_casing
Checks if the casing can be added to the box.
Provides user feedback messages on failure.
Parameters:
ammo_casing
(Object or path. Subtypes of/obj/item/ammo_casing
) - The casing to insert. Has to be the same type asammo_type
, unlessammo_count
is0
.user
- The mob attempting to insert the casing. Used for feedback messages. If not set, no feedback messages are sent.casing_spent
(Boolean). Only used ifammo_casing
is a path. Whether or not the casing is considered spent.
Returns boolean. TRUE
if the casing was successfully inserted, FALSE
otherwise.
insert_casing
Adds ammo_casing
to the ammo box's inventory. Checks can_insert_casing()
.
Parameters:
ammo_casing
- The casing to insert. Has to be the same type asammo_type
, unlessammo_count
is0
.user
- The mob attempting to insert the casing. Used for feedback messages. If not set, no feedback messages are sent.skip_check
(Boolean, defaultFALSE
) - If set, skipscan_insert_casing()
checks. Useful if you're already checking outside this proc, or simply want to force a casing. Be warned this will also force update the ammoboxe's ammo type to the new casing.
Returns boolean. TRUE
if the casing was successfully inserted, FALSE
otherwise.
remove_casing
Removes a casing and places it in target
.
Provides user feedback messages on failure.
Parameters:
user
- The mob removing the casing. If not set, there will be no feedback messages.target
- The atom to place the casing in. If not set, the casing is not spawned and the round is simply removed.
Returns the removed casing if one was created or null
.
set_ammo_type
Sets the box's ammo_type
to the given type, updating its name in the process.
Parameters:
new_ammo_type
(Path - Subtype ofobj/item/ammo_casing
).casing_spent
(Boolean). Only used ifnew_ammo_type
is a path. Whether or not the casing is considered spent.
Has no return value.