-
-
Notifications
You must be signed in to change notification settings - Fork 547
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generic ammo boxes and printable ammo cans (#2940)
<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may not be viewable. --> <!-- You can view Contributing.MD for a detailed description of the pull request process. --> ## About The Pull Request <!-- Describe The Pull Request. Please be sure every change is documented or this can delay review and even discourage maintainers from merging your PR! --> Adds generic ammo boxes, printable in the autolathe. They can be set to hold any ammo type by using a bullet on it, and the capacity changes depending on the bullet type. Also makes ammo cans autolathe printable. Replaces a few instances of update_appearence with update_ammo_count in ammo box code so the materials properly update. Thanks to FalloutFalcon for the idea ## Why It's Good For The Game <!-- Please add a short description of why you think these changes would benefit the game. If you can't justify it in words, it might not be worth adding. --> Basically a redo of my other PR, #2868 intentwise. This PR aims to make ammo storage more practical by adding these generic ammo boxes to prevent having loose rounds everywhere if you don't have a compatible ammo box with space. Ammo cans are basically just themed toolboxes, so they're just nice to have thematically as well. Also some bug fixes I guess, that's good. ## Changelog :cl: add: Generic Ammo Boxes, printable in the autolathe add: Ammo cans are printable in the autolathe fix: Ammo boxes sometimes not properly updating their materials /:cl: <!-- Both :cl:'s are required for the changelog to work! You can put your name to the right of the first :cl: if you want to overwrite your GitHub username as author ingame. --> <!-- You can use multiple of the same prefix (they're only used for the icon ingame) and delete the unneeded ones. Despite some of the tags, changelogs should generally represent how a player might be affected by the changes rather than a summary of the PR's contents. -->
- Loading branch information
1 parent
2e3d566
commit 01cb1c1
Showing
14 changed files
with
100 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
code/modules/projectiles/boxes_magazines/generic_ammo_box.dm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/obj/item/ammo_box/generic | ||
name = "generic ammo box" | ||
desc = "A generic, unbranded box of ammo. It doesn't have great capacity, but it can hold a variety of different calibers." | ||
max_ammo = 20 | ||
start_empty = TRUE | ||
icon_state = "generic-ammo" | ||
/// Does the box currently have an ammo type set? | ||
var/ammo_set = FALSE | ||
/// Name of the currently set ammo type | ||
var/ammo_name | ||
|
||
/obj/item/ammo_box/generic/update_ammo_count() | ||
. = ..() | ||
if(LAZYLEN(stored_ammo) == 0) | ||
ammo_set = FALSE | ||
ammo_type = /obj/item/ammo_casing | ||
|
||
/obj/item/ammo_box/generic/proc/update_max_ammo(obj/item/ammo_casing/ammo) | ||
if(ammo.bullet_per_box) | ||
max_ammo = round(ammo.bullet_per_box) | ||
else | ||
max_ammo = 10 | ||
|
||
return | ||
|
||
/obj/item/ammo_box/generic/attackby(obj/item/attacking_obj, mob/user, params, silent, replace_spent) | ||
. = ..() | ||
|
||
if(!ammo_set && istype(attacking_obj, /obj/item/ammo_casing)) | ||
var/obj/item/ammo_casing/ammo_load = attacking_obj.type | ||
ammo_type = ammo_load | ||
ammo_set = TRUE | ||
ammo_name = attacking_obj.name | ||
update_max_ammo(attacking_obj) | ||
to_chat(user, span_notice("You set the box to hold [attacking_obj]!")) | ||
|
||
if(istype(attacking_obj, /obj/item/pen)) | ||
if(!user.is_literate()) | ||
to_chat(user, span_notice("You scribble illegibly on the cover of [src]!")) | ||
return | ||
var/inputvalue = stripped_input(user, "What would you like to label the box?", "Box Labelling", "", MAX_NAME_LEN) | ||
|
||
if(!inputvalue) | ||
return | ||
|
||
if(user.canUseTopic(src, BE_CLOSE)) | ||
name = "[initial(src.name)][(inputvalue ? " - '[inputvalue]'" : null)]" | ||
|
||
/obj/item/ammo_box/generic/examine(mob/user) | ||
. = ..() | ||
. += span_notice("[ammo_set ? "It's set to hold [ammo_name]\s. The box can hold up to [max_ammo] rounds." : "It doesn't have an ammo type set. Use a bullet on the box to set it."]") | ||
. += span_notice("You can use a pen on it to rename the box.") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters