From 6d56fb07d7a08e26620ffd97908b5c53f8d48fa6 Mon Sep 17 00:00:00 2001 From: Hatterhat <31829017+Hatterhat@users.noreply.github.com> Date: Thu, 24 Aug 2023 17:01:37 -0500 Subject: [PATCH] another day another ammo-related pr: RMB ejects, killing off a runtime, fixing an ammo issue (#23072) * fixes and qol * homing ammo (hilarious) * i hate the black mesa gateway * free code Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com> * me? gongaga * forgot to check if it compiled lol * the part where i hit spacebar * forgot to hit spacebar again * it compiled this time i swear --------- Co-authored-by: Hatterhat Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com> Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com> --- _maps/RandomZLevels/blackmesa.dmm | 6 +- code/__DEFINES/~skyrat_defines/projectiles.dm | 6 +- .../modules/aesthetics/guns/code/guns.dm | 97 ++++++++++++++----- .../ammo_workbench/code/ammo_workbench.dm | 37 ++++--- .../modules/black_mesa/code/m16_variations.dm | 23 +++-- .../black_mesa/code/mobs/human_mobs.dm | 2 +- .../modules/black_mesa/code/projectiles.dm | 6 +- .../modules/gunsgalore/code/guns/m16.dm | 8 +- .../code/modular_projectiles.dm | 20 ++-- 9 files changed, 127 insertions(+), 78 deletions(-) diff --git a/_maps/RandomZLevels/blackmesa.dmm b/_maps/RandomZLevels/blackmesa.dmm index f8829ea92a2..4fa20220832 100644 --- a/_maps/RandomZLevels/blackmesa.dmm +++ b/_maps/RandomZLevels/blackmesa.dmm @@ -4676,7 +4676,7 @@ /turf/open/floor/iron/textured, /area/awaymission/black_mesa/hecu_zone_atrium) "ciB" = ( -/obj/item/ammo_casing/a277/weak, +/obj/item/ammo_casing/a223/weak, /turf/open/floor/iron/textured, /area/awaymission/black_mesa/black_ops_entrance) "ciK" = ( @@ -5570,8 +5570,8 @@ /turf/open/floor/iron/smooth_large, /area/awaymission/black_mesa/high_security_surgery) "dPS" = ( -/obj/item/ammo_casing/a277/weak, -/obj/item/ammo_casing/a277/weak, +/obj/item/ammo_casing/a223/weak, +/obj/item/ammo_casing/a223/weak, /turf/open/floor/iron/textured, /area/awaymission/black_mesa/black_ops_entrance) "dQa" = ( diff --git a/code/__DEFINES/~skyrat_defines/projectiles.dm b/code/__DEFINES/~skyrat_defines/projectiles.dm index ac0085001cc..dd08d26514e 100644 --- a/code/__DEFINES/~skyrat_defines/projectiles.dm +++ b/code/__DEFINES/~skyrat_defines/projectiles.dm @@ -22,10 +22,8 @@ /// The caliber used by the Ripper gen2 #define CALIBER_B577 ".577 Snider" -/// The caliber used by the Oldarms 'Mk.11.4 rifle' -#define CALIBER_223 ".223 Stinger" +/// The caliber used by the Oldarms 'Mk.11.4 rifle', designed to be worse .223. +#define CALIBER_223S ".223 Stinger" /// Caliber used by the giant anti materiel rifle in guncargo #define CALIBER_60STRELA ".60 Strela" - -#define CALIBER_A277 "a277" diff --git a/modular_skyrat/modules/aesthetics/guns/code/guns.dm b/modular_skyrat/modules/aesthetics/guns/code/guns.dm index 8c36dcb255a..ccc43793c33 100644 --- a/modular_skyrat/modules/aesthetics/guns/code/guns.dm +++ b/modular_skyrat/modules/aesthetics/guns/code/guns.dm @@ -10,27 +10,50 @@ * these updated, more consistent defines make it so that a single round's total materials should total 20% of a sheet, or 2 SMALL_MATERIAL_AMOUNT */ -#define AMMO_MATS_BASIC list(/datum/material/iron = SMALL_MATERIAL_AMOUNT * 2) +#define AMMO_MATS_BASIC list( \ + /datum/material/iron = SMALL_MATERIAL_AMOUNT * 2, \ +) -#define AMMO_MATS_AP list(/datum/material/iron = SMALL_MATERIAL_AMOUNT * 1.6,\ - /datum/material/titanium = SMALL_MATERIAL_AMOUNT * 0.4) +#define AMMO_MATS_AP list( \ + /datum/material/iron = SMALL_MATERIAL_AMOUNT * 1.6, \ + /datum/material/titanium = SMALL_MATERIAL_AMOUNT * 0.4, \ +) -#define AMMO_MATS_TEMP list(/datum/material/iron = SMALL_MATERIAL_AMOUNT * 1.6,\ - /datum/material/plasma = SMALL_MATERIAL_AMOUNT * 0.4) +#define AMMO_MATS_TEMP list( \ + /datum/material/iron = SMALL_MATERIAL_AMOUNT * 1.6, \ + /datum/material/plasma = SMALL_MATERIAL_AMOUNT * 0.4, \ +) -#define AMMO_MATS_EMP list(/datum/material/iron = SMALL_MATERIAL_AMOUNT * 1.6,\ - /datum/material/uranium = SMALL_MATERIAL_AMOUNT * 0.4) +#define AMMO_MATS_EMP list( \ + /datum/material/iron = SMALL_MATERIAL_AMOUNT * 1.6, \ + /datum/material/uranium = SMALL_MATERIAL_AMOUNT * 0.4, \ +) -#define AMMO_MATS_PHASIC list(/datum/material/iron = SMALL_MATERIAL_AMOUNT * 1.6,\ - /datum/material/bluespace = SMALL_MATERIAL_AMOUNT * 0.4) +#define AMMO_MATS_PHASIC list( \ + /datum/material/iron = SMALL_MATERIAL_AMOUNT * 1.6, \ + /datum/material/bluespace = SMALL_MATERIAL_AMOUNT * 0.4, \ +) -#define AMMO_MATS_TRAC list(/datum/material/iron = SMALL_MATERIAL_AMOUNT * 1.6,\ - /datum/material/silver = SMALL_MATERIAL_AMOUNT * 0.2,\ - /datum/material/gold = SMALL_MATERIAL_AMOUNT * 0.2) +#define AMMO_MATS_TRAC list( \ + /datum/material/iron = SMALL_MATERIAL_AMOUNT * 1.6, \ + /datum/material/silver = SMALL_MATERIAL_AMOUNT * 0.2, \ + /datum/material/gold = SMALL_MATERIAL_AMOUNT * 0.2, \ +) + +#define AMMO_MATS_HOMING list( \ + /datum/material/iron = SMALL_MATERIAL_AMOUNT * 1, \ + /datum/material/silver = SMALL_MATERIAL_AMOUNT * 0.2, \ + /datum/material/gold = SMALL_MATERIAL_AMOUNT * 0.2, \ + /datum/material/plasma = SMALL_MATERIAL_AMOUNT * 0.2, \ + /datum/material/diamond = SMALL_MATERIAL_AMOUNT * 0.2, \ + /datum/material/bluespace = SMALL_MATERIAL_AMOUNT * 0.2, \ +) // for .35 Sol Ripper. one day, anon. one day -#define AMMO_MATS_RIPPER list(/datum/material/iron = SMALL_MATERIAL_AMOUNT * 1.6,\ - /datum/material/glass = SMALL_MATERIAL_AMOUNT * 0.4) +#define AMMO_MATS_RIPPER list( \ + /datum/material/iron = SMALL_MATERIAL_AMOUNT * 1.6, \ + /datum/material/glass = SMALL_MATERIAL_AMOUNT * 0.4, \ +) /obj/item/ammo_casing custom_materials = AMMO_MATS_BASIC @@ -327,13 +350,23 @@ max_ammo = 20 // GUBMAN3 - FULL BULLET RENAME +// i loathe the above -/obj/item/ammo_casing/a277 +// overrides for .310 Strilka-derived ammo, e.g. lionhunter ammo, because you don't want to give security the ability to print infinite wallhack ammo, right? +/obj/item/ammo_casing/strilka310/lionhunter + name = "hunter's rifle round" + can_be_printed = FALSE // trust me bro you dont wanna give security homing wallhack Better Rubbers + +/obj/item/ammo_casing/strilka310/enchanted + name = "enchanted rifle round" + can_be_printed = FALSE // these are Really Really Better Rubbers + +// overrides for tgcode's .223 (formerly 5.56), used in the M90-gl - renamed to .277 Aestus +/obj/item/ammo_casing/a223 name = ".277 Aestus casing" desc = "A .277 bullet casing." - caliber = CALIBER_A277 -/obj/item/ammo_casing/a277/phasic +/obj/item/ammo_casing/a223/phasic name = ".277 Aestus phasic casing" desc = "A .277 Aestus bullet casing.\

\ @@ -343,9 +376,7 @@ // shotgun ammo overrides moved to modular_skyrat\modules\shotgunrebalance\code\shotgun.dm -// i'd've put more can_be_printed overrides for the cargo shells but, like... some of them actually do have defined materials so you can't just shit them out with metal? -// kinda weird that none of these others do but, whatever?? - +// overrides for tgcode .50cal, used in their sniper/anti-materiel rifles /obj/item/ammo_casing/p50 name = ".416 Stabilis polymer casing" desc = "A .416 bullet casing." @@ -365,6 +396,7 @@

\ PENETRATOR: Goes through every surface, and every mob. Goes through everything. Yes, really." +// overrides for tgcode 4.6x30mm, used in the WT-550 /obj/item/ammo_casing/c46x30mm name = "8mm Usurpator bullet casing" desc = "An 8mm bullet casing." @@ -385,6 +417,7 @@ custom_materials = AMMO_MATS_TEMP advanced_print_req = TRUE +// overrides for tgcode .45, used in the M1911 and C20-r /obj/item/ammo_casing/c45 name = ".460 Ceres bullet casing" desc = "A .460 bullet casing." @@ -405,12 +438,14 @@ custom_materials = AMMO_MATS_TEMP advanced_print_req = TRUE +// overrides for .50AE, used in the deagle /obj/item/ammo_casing/a50ae name = ".454 Trucidator bullet casing" desc = "A .454 Trucidator bullet casing. Extremely powerful.\

\ HAND CANNON: Fired out of a handgun, deals disproportionately large damage." +// overrides for .357, used in the .357 revolver /obj/item/ammo_casing/a357 //We can keep the Magnum classic. name = ".357 bullet casing" desc = "A .357 bullet casing.\ @@ -418,11 +453,25 @@ HAND CANNON: Fired out of a handgun, deals disproportionately large damage." /obj/item/ammo_casing/a357/match - name = ".357 match bullet casing" desc = "A .357 bullet casing, manufactured to exceedingly high standards.\

\ MATCH: Ricochets everywhere. Like crazy." +/obj/item/ammo_casing/a357/phasic + desc = "A .357 phasic bullet casing.\ +

\ + PHASIC: Ignores all surfaces except organic matter." + advanced_print_req = TRUE + custom_materials = AMMO_MATS_PHASIC + +/obj/item/ammo_casing/a357/heartseeker + desc = "A .357 heartseeker bullet casing.\ +

\ + HEARTSEEKER: Has homing capabilities, methodology unknown." + advanced_print_req = TRUE + custom_materials = AMMO_MATS_HOMING // meme ammo. meme print cost + +// overrides for .38 Special, used in the .38 revolvers, including the det's /obj/item/ammo_box/c38 caliber = CALIBER_38 @@ -443,11 +492,11 @@ // The ones above are the casings for the ammo, whereas the ones below are the actual projectiles that give you feedback when you're shot -/obj/projectile/bullet/a277 +/obj/projectile/bullet/a223 name = ".277 Aestus bullet" -/obj/projectile/bullet/a277/phasic - name = ".277 PHASE bullet" +/obj/projectile/bullet/a223/phasic + name = ".277 phasic bullet" /obj/projectile/bullet/c9mm name = "9x25mm bullet" diff --git a/modular_skyrat/modules/ammo_workbench/code/ammo_workbench.dm b/modular_skyrat/modules/ammo_workbench/code/ammo_workbench.dm index 2b5ceef309d..6aef270c3de 100644 --- a/modular_skyrat/modules/ammo_workbench/code/ammo_workbench.dm +++ b/modular_skyrat/modules/ammo_workbench/code/ammo_workbench.dm @@ -72,7 +72,6 @@ 200000, \ MATCONTAINER_EXAMINE, \ allowed_items = /obj/item/stack, \ - container_signals = list(COMSIG_MATCONTAINER_ITEM_CONSUMED = TYPE_PROC_REF(/obj/machinery/autolathe, AfterMaterialInsert)) \ ) . = ..() set_wires(new /datum/wires/ammo_workbench(src)) @@ -275,9 +274,13 @@ creation_efficiency = base_efficiency update_ammotypes() -/obj/machinery/ammo_workbench/proc/ejectItem() +/obj/machinery/ammo_workbench/proc/ejectItem(mob/living/user) if(loaded_magazine) loaded_magazine.forceMove(drop_location()) + + if(user) + try_put_in_hand(loaded_magazine, user) + loaded_magazine = null busy = FALSE error_message = "" @@ -452,7 +455,7 @@ var/mat_capacity = 0 for(var/datum/stock_part/matter_bin/new_matter_bin in component_parts) - mat_capacity += new_matter_bin.tier * 75000 + mat_capacity += new_matter_bin.tier * (40 * SHEET_MATERIAL_AMOUNT) var/datum/component/material_container/materials = GetComponent(/datum/component/material_container) materials.max_amount = mat_capacity @@ -463,17 +466,6 @@ if(loaded_magazine) . += "ammobench_loaded" -/obj/machinery/ammo_workbench/proc/AfterMaterialInsert(obj/item/item_inserted, id_inserted, amount_inserted) - if(istype(item_inserted, /obj/item/stack/ore/bluespace_crystal)) - use_power(SHEET_MATERIAL_AMOUNT / 10) - else if(item_inserted.has_material_type(/datum/material/glass)) - flick("autolathe_r", src)//plays glass insertion animation by default otherwise - else - flick("autolathe_o", src)//plays metal insertion animation - - use_power(min(1000, amount_inserted / 100)) - updateUsrDialog() - /obj/machinery/ammo_workbench/Destroy() QDEL_NULL(wires) if(timer_id) @@ -511,6 +503,23 @@ else return ..() +/obj/machinery/ammo_workbench/attack_hand_secondary(mob/user, list/modifiers) + . = ..() + + if(. == SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN) + return + + if(!can_interact(user) || !user.can_perform_action(src, ALLOW_SILICON_REACH | FORBID_TELEKINESIS_REACH)) + return + + ejectItem(user) + return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN + +/obj/machinery/ammo_workbench/attack_robot_secondary(mob/user, list/modifiers) + return attack_hand_secondary(user, modifiers) + +/obj/machinery/ammo_workbench/attack_ai_secondary(mob/user, list/modifiers) + return attack_hand_secondary(user, modifiers) /obj/machinery/ammo_workbench/proc/Insert_Item(obj/item/O, mob/living/user) if(user.combat_mode) diff --git a/modular_skyrat/modules/black_mesa/code/m16_variations.dm b/modular_skyrat/modules/black_mesa/code/m16_variations.dm index 7b548db9035..b8eaf9f38bb 100644 --- a/modular_skyrat/modules/black_mesa/code/m16_variations.dm +++ b/modular_skyrat/modules/black_mesa/code/m16_variations.dm @@ -33,31 +33,30 @@ desc = "A double-stack solid magazine that looks rather dated. Holds 20 rounds of .223 Stinger." icon = 'modular_skyrat/modules/gunsgalore/icons/guns/gunsgalore_items.dmi' icon_state = "m16" - ammo_type = /obj/item/ammo_casing/oldarms/a223 - caliber = CALIBER_223 + ammo_type = /obj/item/ammo_casing/oldarms/a223s + caliber = CALIBER_223S max_ammo = 20 multiple_sprites = AMMO_BOX_FULL_EMPTY -/obj/item/ammo_casing/oldarms/a223 +/obj/item/ammo_casing/oldarms/a223s name = ".223 Stinger bullet casing" - desc = "A cheaply made .233 Stinger bullet casing." - caliber = CALIBER_223 - projectile_type = /obj/projectile/bullet/oldarms/a223 + desc = "A cheaply made .223 Stinger bullet casing." + caliber = CALIBER_223S + projectile_type = /obj/projectile/bullet/oldarms/a223s -/obj/projectile/bullet/oldarms/a223 +/obj/projectile/bullet/oldarms/a223s name = ".223 bullet" damage = 26 armour_penetration = 5 wound_bonus = -20 -/obj/item/ammo_casing/oldarms/a223/rubber +/obj/item/ammo_casing/oldarms/a223s/rubber name = ".223 Stinger rubber bullet casing" desc = "A cheaply made .233 Stinger bullet casing, now in rubber." - caliber = CALIBER_223 - projectile_type = /obj/projectile/bullet/oldarms/a223/rubber + projectile_type = /obj/projectile/bullet/oldarms/a223s/rubber -/obj/projectile/bullet/oldarms/a223/rubber - name = ".223 Rubber" +/obj/projectile/bullet/oldarms/a223s/rubber + name = ".223 Rubber bullet" damage = 5 stamina = 25 ricochets_max = 3 diff --git a/modular_skyrat/modules/black_mesa/code/mobs/human_mobs.dm b/modular_skyrat/modules/black_mesa/code/mobs/human_mobs.dm index f597e8201c5..b83e961a701 100644 --- a/modular_skyrat/modules/black_mesa/code/mobs/human_mobs.dm +++ b/modular_skyrat/modules/black_mesa/code/mobs/human_mobs.dm @@ -219,7 +219,7 @@ minimum_distance = 5 icon_state = "blackops_ranged" icon_living = "blackops_ranged" - casingtype = /obj/item/ammo_casing/a277/weak + casingtype = /obj/item/ammo_casing/a223/weak projectilesound = 'modular_skyrat/modules/gunsgalore/sound/guns/fire/m16_fire.ogg' attack_sound = 'sound/weapons/punch1.ogg' loot = list(/obj/effect/gibspawner/human, /obj/item/ammo_box/magazine/m16) diff --git a/modular_skyrat/modules/black_mesa/code/projectiles.dm b/modular_skyrat/modules/black_mesa/code/projectiles.dm index 8457ceb205b..2a0c77fa02e 100644 --- a/modular_skyrat/modules/black_mesa/code/projectiles.dm +++ b/modular_skyrat/modules/black_mesa/code/projectiles.dm @@ -1,10 +1,10 @@ -/obj/projectile/bullet/a277/weak +/obj/projectile/bullet/a223/weak name = "surplus .277 bullet" damage = 25 armour_penetration = 10 wound_bonus = -40 -/obj/item/ammo_casing/a277/weak +/obj/item/ammo_casing/a223/weak name = ".277 surplus bullet casing" desc = "A .277 surplus bullet casing." - projectile_type = /obj/projectile/bullet/a277/weak + projectile_type = /obj/projectile/bullet/a223/weak diff --git a/modular_skyrat/modules/gunsgalore/code/guns/m16.dm b/modular_skyrat/modules/gunsgalore/code/guns/m16.dm index 1cdd023c80b..9251c7aee70 100644 --- a/modular_skyrat/modules/gunsgalore/code/guns/m16.dm +++ b/modular_skyrat/modules/gunsgalore/code/guns/m16.dm @@ -28,8 +28,8 @@ desc = "A double-stack translucent polymer magazine for use with the XM-2537 rifles. Holds 30 rounds of .277 Aestus." icon = 'modular_skyrat/modules/gunsgalore/icons/guns/gunsgalore_items.dmi' icon_state = "m16e" - ammo_type = /obj/item/ammo_casing/a277 - caliber = CALIBER_A277 + ammo_type = /obj/item/ammo_casing/a223 + caliber = CALIBER_A223 max_ammo = 30 multiple_sprites = AMMO_BOX_FULL_EMPTY @@ -38,8 +38,6 @@ desc = "A double-stack solid magazine that looks rather dated. Holds 20 rounds of .277 Aestus." icon = 'modular_skyrat/modules/gunsgalore/icons/guns/gunsgalore_items.dmi' icon_state = "m16" - ammo_type = /obj/item/ammo_casing/a277 - caliber = CALIBER_A277 max_ammo = 20 multiple_sprites = AMMO_BOX_FULL_EMPTY @@ -73,7 +71,5 @@ desc = "A double-stack solid polymer drum made for use with the Amans Patriae rifle. Holds 50 rounds of .277 ammo." icon = 'modular_skyrat/modules/gunsgalore/icons/guns/gunsgalore_items.dmi' icon_state = "m16" - ammo_type = /obj/item/ammo_casing/a277 - caliber = CALIBER_A277 max_ammo = 50 multiple_sprites = AMMO_BOX_FULL_EMPTY diff --git a/modular_skyrat/modules/modular_weapons/code/modular_projectiles.dm b/modular_skyrat/modules/modular_weapons/code/modular_projectiles.dm index 8edfcc4b5f8..16a9ba35f7f 100644 --- a/modular_skyrat/modules/modular_weapons/code/modular_projectiles.dm +++ b/modular_skyrat/modules/modular_weapons/code/modular_projectiles.dm @@ -9,7 +9,7 @@ // whatever goblin decided to spread out bullets over like 3 files and god knows however many overrides i wish you a very stubbed toe /* -* .460 Ceres +* .460 Ceres (renamed tgcode .45) */ /obj/item/ammo_casing/c45/rubber @@ -45,7 +45,7 @@ weak_against_armour = TRUE /* -* 8mm Usurpator +* 8mm Usurpator (renamed tg c46x30mm, used in the WT550) */ /obj/projectile/bullet/c46x30mm_rubber @@ -70,19 +70,18 @@ harmful = FALSE /* -* .277 Aestus +* .277 Aestus (renamed tgcode .223, used in the M-90gl) */ -/obj/item/ammo_casing/a277/rubber +/obj/item/ammo_casing/a223/rubber name = ".277 rubber bullet casing" desc = "A .277 rubber bullet casing.\

\ RUBBER: Less than lethal ammo. Deals both stamina damage and regular damage." - caliber = CALIBER_A277 - projectile_type = /obj/projectile/bullet/a277/rubber + projectile_type = /obj/projectile/bullet/a223/rubber harmful = FALSE -/obj/projectile/bullet/a277/rubber +/obj/projectile/bullet/a223/rubber name = ".277 rubber bullet" damage = 10 armour_penetration = 10 @@ -96,17 +95,16 @@ embedding = null wound_bonus = -50 -/obj/item/ammo_casing/a277/ap +/obj/item/ammo_casing/a223/ap name = ".277 Aestus armor-piercing bullet casing" desc = "A .277 armor-piercing bullet casing.\

\ ARMOR PIERCING: Increased armor piercing capabilities. What did you expect?" - caliber = CALIBER_A277 - projectile_type = /obj/projectile/bullet/a277/ap + projectile_type = /obj/projectile/bullet/a223/ap advanced_print_req = TRUE custom_materials = AMMO_MATS_AP -/obj/projectile/bullet/a277/ap +/obj/projectile/bullet/a223/ap name = ".277 armor-piercing bullet" armour_penetration = 60