From cfd7a3e452c9425dff06cb53c8f308e00f2d0f6f Mon Sep 17 00:00:00 2001 From: hbycyl <36418376+hbycyl@users.noreply.github.com> Date: Mon, 27 Jul 2020 12:49:45 +0800 Subject: [PATCH] Ammolathe recycling (#27190) * Changes how recycling is handled, now respects the machine's allowed_materials * Lets the ammolathe recycle things * Gives ammo and guns material values for recycling (50% of their build cost) * oop bloat to appease the robot overlord * adds typing to material_list * Revert "oop bloat to appease the robot overlord" This reverts commit a4c0409999851fae7b977af78121f219e6d11682. Co-authored-by: tianyou --- code/game/machinery/ammolathe.dm | 5 +++- code/game/machinery/autolathe.dm | 10 +++++-- code/modules/mining/materials.dm | 2 +- code/modules/projectiles/ammunition/boxes.dm | 1 + .../modules/projectiles/ammunition/bullets.dm | 26 +++++++++---------- .../projectiles/ammunition/magazines.dm | 2 ++ code/modules/projectiles/ammunition/rocket.dm | 8 +++--- .../projectiles/ammunition/speedloaders.dm | 2 +- code/modules/projectiles/guns/gun_parts.dm | 7 ++--- .../projectiles/guns/projectile/automatic.dm | 1 + .../projectiles/guns/projectile/pistol.dm | 1 + .../guns/projectile/rocketlauncher.dm | 2 +- .../projectiles/guns/projectile/shotgun.dm | 3 ++- 13 files changed, 43 insertions(+), 27 deletions(-) diff --git a/code/game/machinery/ammolathe.dm b/code/game/machinery/ammolathe.dm index 4d946c93e94..b9d67c89c18 100644 --- a/code/game/machinery/ammolathe.dm +++ b/code/game/machinery/ammolathe.dm @@ -15,7 +15,7 @@ light_color = LIGHT_COLOR_RED machine_flags = SCREWTOGGLE | CROWDESTROY | WRENCHMOVE | FIXED2WORK //| EMAGGABLE - research_flags = NANOTOUCH | TAKESMATIN | HASOUTPUT | IGNORE_CHEMS | HASMAT_OVER | LOCKBOXES + research_flags = NANOTOUCH | TAKESMATIN | HASOUTPUT | IGNORE_CHEMS | HASMAT_OVER | LOCKBOXES | FAB_RECYCLER one_part_set_only = 0 part_sets = list( @@ -96,3 +96,6 @@ ) RefreshParts() + + + \ No newline at end of file diff --git a/code/game/machinery/autolathe.dm b/code/game/machinery/autolathe.dm index 5e401ceff32..b245877c816 100644 --- a/code/game/machinery/autolathe.dm +++ b/code/game/machinery/autolathe.dm @@ -184,9 +184,15 @@ if(I.materials.getVolume() + src.materials.getVolume() > max_material_storage) to_chat(user, "\The [src]'s material bin is too full to recycle \the [I].") return 1 - else if(I.materials.getAmount(MAT_IRON) + I.materials.getAmount(MAT_GLASS) < I.materials.getVolume()) - to_chat(user, "\The [src] can only accept objects made out of metal and glass.") + + + else if(allowed_materials && !((I.materials.storage & allowed_materials) ~= I.materials.storage)) + var/output = "\The [src] can only accept objects made out of these: " + for(var/mat_id in allowed_materials) + output += (material_list[mat_id].processed_name + " ") + to_chat(user, output) return 1 + else if(isrobot(user)) if(isMoMMI(user)) var/mob/living/silicon/robot/mommi/M = user diff --git a/code/modules/mining/materials.dm b/code/modules/mining/materials.dm index 61fd6931711..d79f3436b82 100644 --- a/code/modules/mining/materials.dm +++ b/code/modules/mining/materials.dm @@ -18,7 +18,7 @@ proc/initialize_materials() continue initial_materials += list(mat.id = 0) // This is for machines in r&d who have a material holder. If you can't make sheets of the material, you can't put in an r_n_d machine to begin with. -var/global/list/material_list //Stores an instance of all the datums as an assoc with their matids +var/global/list/datum/material/material_list //Stores an instance of all the datums as an assoc with their matids var/global/list/initial_materials //Stores all the matids = 0 in helping New /datum/materials diff --git a/code/modules/projectiles/ammunition/boxes.dm b/code/modules/projectiles/ammunition/boxes.dm index fb9a6a09db1..99f5759ac90 100644 --- a/code/modules/projectiles/ammunition/boxes.dm +++ b/code/modules/projectiles/ammunition/boxes.dm @@ -4,6 +4,7 @@ /obj/item/ammo_storage/box exact = 1 + starting_materials = list(MAT_IRON = 2000) /obj/item/ammo_storage/box/a357 name = "ammo box (.357)" diff --git a/code/modules/projectiles/ammunition/bullets.dm b/code/modules/projectiles/ammunition/bullets.dm index 7bd2381609c..c94ef2a7e16 100644 --- a/code/modules/projectiles/ammunition/bullets.dm +++ b/code/modules/projectiles/ammunition/bullets.dm @@ -112,7 +112,7 @@ icon_state = "gshell" caliber = GAUGE12 projectile_type = /obj/item/projectile/bullet - starting_materials = list(MAT_IRON = 12500) + starting_materials = list(MAT_IRON = 250) w_type = RECYK_METAL /obj/item/ammo_casing/shotgun/update_icon() @@ -126,57 +126,57 @@ desc = "A blank shell. Does not contain any projectile material." icon_state = "blshell" projectile_type = /obj/item/projectile/bullet/blank - starting_materials = list(MAT_IRON = 250) + starting_materials = list(MAT_IRON = 125) /obj/item/ammo_casing/shotgun/beanbag name = "beanbag shell" desc = "A weak beanbag shell." icon_state = "bshell" projectile_type = /obj/item/projectile/bullet/weakbullet - starting_materials = list(MAT_IRON = 500) + starting_materials = list(MAT_IRON = 250) /obj/item/ammo_casing/shotgun/fakebeanbag name = "beanbag shell" desc = "A weak beanbag shell." icon_state = "bshell" projectile_type = /obj/item/projectile/bullet/weakbullet/booze - starting_materials = list(MAT_IRON = 12500) + starting_materials = list(MAT_IRON = 250) /obj/item/ammo_casing/shotgun/stunshell name = "stun shell" desc = "A stunning shell." icon_state = "stunshell" projectile_type = /obj/item/projectile/bullet/stunshot - starting_materials = list(MAT_IRON = 2500) + starting_materials = list(MAT_IRON = 250) /obj/item/ammo_casing/shotgun/dart name = "shotgun dart" desc = "A dart for use in shotguns." icon_state = "blshell" projectile_type = /obj/item/projectile/bullet/dart - starting_materials = list(MAT_IRON = 12500) + starting_materials = list(MAT_IRON = 250) /obj/item/ammo_casing/shotgun/buckshot name = "buckshot shell" desc = "A 12 gauge shell filled with standard double-aught buckshot." icon_state = "bsshell" projectile_type = /obj/item/projectile/bullet/buckshot - starting_materials = list(MAT_IRON = 12500) - + starting_materials = list(MAT_IRON = 250) + /obj/item/ammo_casing/shotgun/dragonsbreath name = "dragon's breath shell" desc = "A 12 gauge shell filled with an incendiary mixture, for lighting up dark areas or setting things on fire." icon_state = "bdbshell" projectile_type = /obj/item/projectile/bullet/fire_plume/dragonsbreath - starting_materials = list(MAT_IRON = 500, MAT_PLASMA = 2000) - + starting_materials = list(MAT_IRON = 250, MAT_PLASMA = 1000) + /obj/item/ammo_casing/shotgun/frag name = "explosive shell" desc = "A 12 gauge shell filled with a high-explosive mixture, for heavy anti-personnel usage." icon_state = "fragshell" projectile_type = /obj/item/projectile/bullet/boombullet - starting_materials = list(MAT_IRON = 500, MAT_PLASMA = 8000) - + starting_materials = list(MAT_IRON = 250, MAT_PLASMA = 4000) + /obj/item/ammo_casing/a762 desc = "A 7.62x51mm bullet casing." @@ -204,7 +204,7 @@ projectile_type = /obj/item/projectile/bullet/a762x55 w_type = RECYK_METAL icon_state = "762x55-casing-live" - starting_materials = list(MAT_IRON = 12500) + starting_materials = list(MAT_IRON = 125) /obj/item/ammo_casing/a762x55/update_icon() desc = "[initial(desc)][BB ? "" : " This one is spent"]" diff --git a/code/modules/projectiles/ammunition/magazines.dm b/code/modules/projectiles/ammunition/magazines.dm index 92f37723f84..097c6769305 100644 --- a/code/modules/projectiles/ammunition/magazines.dm +++ b/code/modules/projectiles/ammunition/magazines.dm @@ -4,6 +4,8 @@ /obj/item/ammo_storage/magazine desc = "A magazine capable of holding bullets. Can be loaded into certain weapons." exact = 1 //we only load the thing we want to load + materials = list(MAT_IRON = 200) + /obj/item/ammo_storage/magazine/mc9mm name = "magazine (9mm)" diff --git a/code/modules/projectiles/ammunition/rocket.dm b/code/modules/projectiles/ammunition/rocket.dm index 42bd11c245e..5e4b6c39109 100644 --- a/code/modules/projectiles/ammunition/rocket.dm +++ b/code/modules/projectiles/ammunition/rocket.dm @@ -16,25 +16,25 @@ name = "low yield rocket" desc = "Explosive supplement to Nanotrasen's rocket launchers." projectile_type = "/obj/item/projectile/rocket/lowyield" - starting_materials = list(MAT_IRON = 20000) + starting_materials = list(MAT_IRON = 10000) /obj/item/ammo_casing/rocket_rpg/blank name = "blank rocket" desc = "This rocket left intentionally blank." projectile_type = "/obj/item/projectile/rocket/blank" - starting_materials = list(MAT_IRON = 100) + starting_materials = list(MAT_IRON = 50) /obj/item/ammo_casing/rocket_rpg/emp name = "EMP rocket" desc = "EMP rocket for the Nanotrasen rocket launcher." projectile_type = "/obj/item/projectile/rocket/blank/emp" - starting_materials = list(MAT_IRON = 20000, MAT_URANIUM = 500) + starting_materials = list(MAT_IRON = 10000, MAT_URANIUM = 250) /obj/item/ammo_casing/rocket_rpg/stun name = "stun rocket" desc = "Stun rocket for the Nanotrasen rocket launcher. Not a flashbang." projectile_type = "/obj/item/projectile/rocket/blank/stun" - starting_materials = list(MAT_IRON = 50000, MAT_SILVER = 1000) + starting_materials = list(MAT_IRON = 25000, MAT_SILVER = 500) /obj/item/ammo_casing/rocket_rpg/extreme name = "extreme rocket" //don't even map or spawn this in or you'll be very sad diff --git a/code/modules/projectiles/ammunition/speedloaders.dm b/code/modules/projectiles/ammunition/speedloaders.dm index b02e34a4392..1fd465ec73a 100644 --- a/code/modules/projectiles/ammunition/speedloaders.dm +++ b/code/modules/projectiles/ammunition/speedloaders.dm @@ -5,7 +5,7 @@ /obj/item/ammo_storage/speedloader desc = "A speedloader, used to load a gun without any of that annoying fumbling." exact = 0 //load anything in the class! - + materials = list(MAT_IRON = 200) /obj/item/ammo_storage/speedloader/c38 name = "speed loader (.38)" icon_state = "38" diff --git a/code/modules/projectiles/guns/gun_parts.dm b/code/modules/projectiles/guns/gun_parts.dm index 54f6f0726bf..6a1d754aabe 100644 --- a/code/modules/projectiles/guns/gun_parts.dm +++ b/code/modules/projectiles/guns/gun_parts.dm @@ -21,7 +21,7 @@ icon = 'icons/obj/gun.dmi' icon_state = "scope" w_class = W_CLASS_SMALL - starting_materials = list(MAT_IRON = 400, MAT_GLASS = 2000) + starting_materials = list(MAT_IRON = 200, MAT_GLASS = 1000) /obj/item/gun_part/glock_auto_conversion_kit name = "glock full-auto conversion kit" @@ -29,7 +29,7 @@ icon = 'icons/obj/gun.dmi' icon_state = "fullautokit" w_class = W_CLASS_SMALL - starting_materials = list(MAT_IRON = 400) + starting_materials = list(MAT_IRON = 200) /obj/item/gun_part/universal_magwell_expansion_kit name = "universal magwell expansion kit" @@ -37,4 +37,5 @@ icon = 'icons/obj/gun.dmi' icon_state = "magwellkit" w_class = W_CLASS_SMALL - starting_materials = list(MAT_IRON = 400) \ No newline at end of file + starting_materials = list(MAT_IRON = 200) + diff --git a/code/modules/projectiles/guns/projectile/automatic.dm b/code/modules/projectiles/guns/projectile/automatic.dm index fff1f1075d9..a1c9df8469c 100644 --- a/code/modules/projectiles/guns/projectile/automatic.dm +++ b/code/modules/projectiles/guns/projectile/automatic.dm @@ -272,6 +272,7 @@ fire_sound = 'sound/weapons/Gunshot_c20.ogg' burst_count = 2 origin_tech = Tc_COMBAT + "=5;" + Tc_MATERIALS + "=1" + starting_materials = list(MAT_IRON = 6250, MAT_GLASS = 1500, MAT_PLASTIC = 2500) var/receiver /obj/item/weapon/gun/projectile/automatic/vector/isHandgun() diff --git a/code/modules/projectiles/guns/projectile/pistol.dm b/code/modules/projectiles/guns/projectile/pistol.dm index 2555cb265e6..3d4a98c9c56 100644 --- a/code/modules/projectiles/guns/projectile/pistol.dm +++ b/code/modules/projectiles/guns/projectile/pistol.dm @@ -157,6 +157,7 @@ fire_sound = 'sound/weapons/semiauto.ogg' load_method = 2 gun_flags = SILENCECOMP | EMPTYCASINGS + starting_materials = list(MAT_IRON = 5000, MAT_GLASS = 1000, MAT_PLASTIC = 2000) var/obj/item/gun_part/glock_auto_conversion_kit/conversionkit = null /obj/item/weapon/gun/projectile/glock/update_icon() diff --git a/code/modules/projectiles/guns/projectile/rocketlauncher.dm b/code/modules/projectiles/guns/projectile/rocketlauncher.dm index afe74be09a9..1ef78753397 100644 --- a/code/modules/projectiles/guns/projectile/rocketlauncher.dm +++ b/code/modules/projectiles/guns/projectile/rocketlauncher.dm @@ -6,7 +6,7 @@ item_state = "rpg" max_shells = 1 w_class = W_CLASS_LARGE - starting_materials = list(MAT_IRON = 5000) + starting_materials = list(MAT_IRON = 25000, MAT_GLASS = 7500, MAT_PLASTIC = 12500, MAT_GOLD = 3000) w_type = RECYK_METAL force = 10 recoil = 1 //The backblast isn't just decorative you know diff --git a/code/modules/projectiles/guns/projectile/shotgun.dm b/code/modules/projectiles/guns/projectile/shotgun.dm index e375a996c90..e914677e02f 100644 --- a/code/modules/projectiles/guns/projectile/shotgun.dm +++ b/code/modules/projectiles/guns/projectile/shotgun.dm @@ -28,6 +28,7 @@ var/pumped = 0 var/obj/item/ammo_casing/current_shell = null gun_flags = 0 + starting_materials = list(MAT_IRON = 7500, MAT_WOOD = 3750) /obj/item/weapon/gun/projectile/shotgun/pump/attack_self(mob/living/user as mob) if(recentpump) @@ -78,7 +79,7 @@ max_shells = 8 origin_tech = Tc_COMBAT + "=5;" + Tc_MATERIALS + "=2" ammo_type = "/obj/item/ammo_casing/shotgun" - + /obj/item/weapon/gun/projectile/shotgun/pump/combat/shorty //nuke op engineering special name = "combat shorty" desc = "Handy for close encounters."