[MIRROR] Pipeguns: Elitism Edition (#3054)

* Pipeguns: Elitism Edition

* fixes

Co-authored-by: necromanceranne <40847847+necromanceranne@users.noreply.github.com>
Co-authored-by: Gandalf2k15 <jzo123@hotmail.com>
This commit is contained in:
SkyratBot
2021-02-04 17:25:10 +01:00
committed by GitHub
parent 897a6258a4
commit f18f2ad02f
26 changed files with 263 additions and 104 deletions
@@ -39,6 +39,10 @@
BB.def_zone = user.zone_selected
BB.suppressed = quiet
if(isgun(fired_from))
var/obj/item/gun/G = fired_from
BB.damage *= G.projectile_damage_multiplier
if(reagents && BB.reagents)
reagents.trans_to(BB, reagents.total_volume, transfered_by = user) //For chemical darts/bullets
qdel(reagents)
@@ -6,11 +6,23 @@
max_ammo = 5
multiload = TRUE
/obj/item/ammo_box/magazine/internal/boltaction/enchanted
/obj/item/ammo_box/magazine/internal/boltaction/pipegun
name = "pipegun internal magazine"
caliber = CALIBER_SHOTGUN
ammo_type = /obj/item/ammo_casing/shotgun/improvised
max_ammo = 1
/obj/item/ammo_box/magazine/internal/boltaction/pipegun/prime
name = "regal pipegun internal magazine"
max_ammo = 3
/obj/item/ammo_box/magazine/internal/enchanted
max_ammo = 1
caliber = CALIBER_A762
ammo_type = /obj/item/ammo_casing/a762/enchanted
/obj/item/ammo_box/magazine/internal/boltaction/enchanted/arcane_barrage
/obj/item/ammo_box/magazine/internal/arcane_barrage
caliber = CALIBER_A762
ammo_type = /obj/item/ammo_casing/magic/arcane_barrage
/obj/item/ammo_box/magazine/internal/boltaction/harpoon
@@ -22,11 +22,6 @@
name = "double-barrel shotgun internal magazine"
max_ammo = 2
/obj/item/ammo_box/magazine/internal/shot/improvised
name = "improvised shotgun internal magazine"
ammo_type = /obj/item/ammo_casing/shotgun/improvised
max_ammo = 1
/obj/item/ammo_box/magazine/internal/shot/riot
name = "riot shotgun internal magazine"
ammo_type = /obj/item/ammo_casing/shotgun/rubbershot
+6 -2
View File
@@ -42,6 +42,10 @@
var/semicd = 0 //cooldown handler
var/weapon_weight = WEAPON_LIGHT
var/dual_wield_spread = 24 //additional spread when dual wielding
/// Just 'slightly' snowflakey way to modify projectile damage for projectiles fired from this gun.
var/projectile_damage_multiplier = 1
var/spread = 0 //Spread induced by the gun itself.
var/randomspread = 1 //Set to 0 for shotguns. This is used for weapons that don't fire all their bullets at once.
@@ -138,7 +142,7 @@
. += "It has \a [bayonet] [can_bayonet ? "" : "permanently "]affixed to it."
if(can_bayonet) //if it has a bayonet and this is false, the bayonet is permanent.
. += "<span class='info'>[bayonet] looks like it can be <b>unscrewed</b> from [src].</span>"
else if(can_bayonet)
if(can_bayonet)
. += "It has a <b>bayonet</b> lug on it."
/obj/item/gun/equipped(mob/living/user, slot)
@@ -370,6 +374,7 @@
if(user)
user.update_inv_hands()
SSblackbox.record_feedback("tally", "gun_fired", 1, type)
return TRUE
/obj/item/gun/proc/reset_semicd()
@@ -450,7 +455,6 @@
QDEL_NULL(pin)
return TRUE
/obj/item/gun/welder_act(mob/living/user, obj/item/I)
. = ..()
if(.)
+99 -1
View File
@@ -90,6 +90,27 @@
var/suppressor_x_offset ///pixel offset for the suppressor overlay on the x axis.
var/suppressor_y_offset ///pixel offset for the suppressor overlay on the y axis.
///Gun internal magazine modification and misfiring
///Can we modify our ammo type in this gun's internal magazine?
var/can_modify_ammo = FALSE
///our initial ammo type. Should match initial caliber, but a bit of redundency doesn't hurt.
var/initial_caliber
///our alternative ammo type.
var/alternative_caliber
///our initial fire sound. same reasons for initial caliber
var/initial_fire_sound
///our alternative fire sound, in case we want our gun to be louder or quieter or whatever
var/alternative_fire_sound
///If only our alternative ammuntion misfires and not our main ammunition, we set this to TRUE
var/alternative_ammo_misfires = FALSE
/// Whether our ammo misfires now or when it's set by the wrench_act. TRUE means it misfires.
var/can_misfire = FALSE
///How likely is our gun to misfire?
var/misfire_probability = 0
///How much does shooting the gun increment the misfire probability?
var/misfire_percentage_increment = 0
/obj/item/gun/ballistic/Initialize()
. = ..()
if (!spawnwithmagazine)
@@ -302,13 +323,30 @@
if (can_be_sawn_off)
if (sawoff(user, A))
return
if(can_misfire && istype(A, /obj/item/stack/sheet/cloth))
if(guncleaning(user, A))
return
return FALSE
/obj/item/gun/ballistic/process_fire(atom/target, mob/living/user, message = TRUE, params = null, zone_override = "", bonus_spread = 0)
if(magazine && chambered.BB && can_misfire && misfire_probability > 0)
if(prob(misfire_probability))
if(blow_up(user))
to_chat(user, "<span class='userdanger'>[src] misfires!</span>")
if (sawn_off)
bonus_spread += SAWN_OFF_ACC_PENALTY
. = ..()
/obj/item/gun/ballistic/shoot_live_shot(mob/living/user, pointblank = 0, atom/pbtarget = null, message = 1)
if(can_misfire)
misfire_probability += misfire_percentage_increment
. = ..()
///Installs a new suppressor, assumes that the suppressor is already in the contents of src
/obj/item/gun/ballistic/proc/install_suppressor(obj/item/suppressor/S)
suppressed = S
@@ -413,12 +451,17 @@
. = ..()
var/count_chambered = !(bolt_type == BOLT_TYPE_NO_BOLT || bolt_type == BOLT_TYPE_OPEN)
. += "It has [get_ammo(count_chambered)] round\s remaining."
if (!chambered)
. += "It does not seem to have a round chambered."
if (bolt_locked)
. += "The [bolt_wording] is locked back and needs to be released before firing."
. += "The [bolt_wording] is locked back and needs to be released before firing or de-fouling."
if (suppressed)
. += "It has a suppressor attached that can be removed with <b>alt+click</b>."
if(can_misfire)
. += "<span class='danger'>You get the feeling this might explode if you fire it....</span>"
if(misfire_probability > 0)
. += "<span class='danger'>Given the state of the gun, there is a [misfire_probability]% chance it'll misfire.</span>"
///Gets the number of bullets in the gun
/obj/item/gun/ballistic/proc/get_ammo(countchambered = TRUE)
@@ -507,6 +550,61 @@ GLOBAL_LIST_INIT(gun_saw_types, typecacheof(list(
update_icon()
return TRUE
/obj/item/gun/ballistic/proc/guncleaning(mob/user, /obj/item/A)
if(misfire_probability == 0)
to_chat(user, "<span class='notice'>\The [src] seems to be already clean of fouling.</span>")
return
user.changeNext_move(CLICK_CD_MELEE)
user.visible_message("<span class='notice'>[user] begins to cleaning \the [src].</span>", "<span class='notice'>You begin to clean the internals of \the [src].</span>")
if(do_after(user, 100, target = src))
var/original_misfire_value = initial(misfire_probability)
if(misfire_probability > original_misfire_value)
misfire_probability = original_misfire_value
user.visible_message("<span class='notice'>[user] cleans \the [src] of any fouling.</span>", "<span class='notice'>You clean \the [src], removing any fouling, preventing misfire.</span>")
return TRUE
/obj/item/gun/ballistic/wrench_act(mob/living/user, obj/item/I)
if(!user.is_holding(src))
to_chat(user, "<span class='notice'>You need to hold [src] to modify it.</span>")
return TRUE
if(!can_modify_ammo)
return
if(bolt_type == BOLT_TYPE_STANDARD)
if(get_ammo())
to_chat(user, "<span class='notice'>You can't get at the internals while the gun has a bullet in it!</span>")
return
else if(!bolt_locked)
to_chat(user, "<span class='notice'>You can't get at the internals while the bolt is down!</span>")
return
to_chat(user, "<span class='notice'>You begin to tinker with [src]...</span>")
I.play_tool_sound(src)
if(!I.use_tool(src, user, 3 SECONDS))
return TRUE
if(blow_up(user))
user.visible_message("<span class='danger'>\The [src] goes off!</span>", "<span class='danger'>\The [src] goes off in your face!</span>")
return
if(magazine.caliber == initial_caliber)
magazine.caliber = alternative_caliber
if(alternative_ammo_misfires)
can_misfire = TRUE
fire_sound = alternative_fire_sound
to_chat(user, "<span class='notice'>You modify [src]. Now it will fire [alternative_caliber] rounds.</span>")
else
magazine.caliber = initial_caliber
if(alternative_ammo_misfires)
can_misfire = FALSE
fire_sound = initial_fire_sound
to_chat(user, "<span class='notice'>You reset [src]. Now it will fire [initial_caliber] rounds.</span>")
///used for sawing guns, causes the gun to fire without the input of the user
/obj/item/gun/ballistic/proc/blow_up(mob/user)
. = FALSE
@@ -80,6 +80,15 @@
fire_sound = 'sound/weapons/gun/revolver/shot.ogg'
icon_state = "detective"
mag_type = /obj/item/ammo_box/magazine/internal/cylinder/rev38
initial_caliber = CALIBER_38
alternative_caliber = CALIBER_357
initial_fire_sound = 'sound/weapons/gun/revolver/shot.ogg'
alternative_fire_sound = 'sound/weapons/gun/revolver/shot_alt.ogg'
can_modify_ammo = TRUE
alternative_ammo_misfires = TRUE
can_misfire = FALSE
misfire_probability = 0
misfire_percentage_increment = 25 //about 1 in 4 rounds, which increases rapidly every shot
obj_flags = UNIQUE_RENAME
unique_reskin = list("Default" = "detective",
"Fitz Special" = "detective_fitz",
@@ -37,7 +37,7 @@
return ..()
/obj/item/gun/ballistic/rifle/attackby(obj/item/A, mob/user, params)
if (!bolt_locked)
if (!bolt_locked && !istype(A, /obj/item/stack/sheet/cloth))
to_chat(user, "<span class='notice'>The bolt is closed!</span>")
return
return ..()
@@ -73,10 +73,10 @@
update_icon()
/obj/item/gun/ballistic/rifle/boltaction/blow_up(mob/user)
. = 0
. = FALSE
if(chambered?.BB)
process_fire(user, user, FALSE)
. = 1
. = TRUE
/obj/item/gun/ballistic/rifle/boltaction/harpoon
name = "ballistic harpoon gun"
@@ -94,15 +94,57 @@
can_be_sawn_off = FALSE
realistic = FALSE
/obj/item/gun/ballistic/rifle/boltaction/enchanted
/obj/item/gun/ballistic/rifle/boltaction/pipegun
name = "pipegun"
desc = "An excellent weapon for flushing out tunnel rats and enemy assistants, but its rifling leaves much to be desired."
icon_state = "musket"
inhand_icon_state = "musket"
worn_icon_state = "musket"
lefthand_file = 'icons/mob/inhands/weapons/64x_guns_left.dmi'
righthand_file = 'icons/mob/inhands/weapons/64x_guns_right.dmi'
inhand_x_dimension = 64
inhand_y_dimension = 64
fire_sound = 'sound/weapons/gun/sniper/shot.ogg'
mag_type = /obj/item/ammo_box/magazine/internal/boltaction/pipegun
initial_caliber = CALIBER_SHOTGUN
alternative_caliber = CALIBER_A762
initial_fire_sound = 'sound/weapons/gun/sniper/shot.ogg'
alternative_fire_sound = 'sound/weapons/gun/shotgun/shot.ogg'
can_modify_ammo = TRUE
can_misfire = TRUE
misfire_probability = 0
misfire_percentage_increment = 5 //Slowly increases every shot
can_bayonet = FALSE
can_be_sawn_off = FALSE
projectile_damage_multiplier = 0.75
/obj/item/gun/ballistic/rifle/boltaction/pipegun/process_chamber(empty_chamber, from_firing, chamber_next_round)
. = ..()
do_sparks(1, TRUE, src)
/obj/item/gun/ballistic/rifle/boltaction/pipegun/prime
name = "regal pipegun"
desc = "Older, territorial assistants typically possess more valuable loot."
icon_state = "musket_prime"
inhand_icon_state = "musket_prime"
worn_icon_state = "musket_prime"
mag_type = /obj/item/ammo_box/magazine/internal/boltaction/pipegun/prime
can_misfire = FALSE
misfire_probability = 0
misfire_percentage_increment = 0
projectile_damage_multiplier = 1
/// MAGICAL BOLT ACTIONS + ARCANE BARRAGE? ///
/obj/item/gun/ballistic/rifle/enchanted
name = "enchanted bolt action rifle"
desc = "Careful not to lose your head."
var/guns_left = 30
mag_type = /obj/item/ammo_box/magazine/internal/boltaction/enchanted
mag_type = /obj/item/ammo_box/magazine/internal/enchanted
can_be_sawn_off = FALSE
realistic = FALSE
/obj/item/gun/ballistic/rifle/boltaction/enchanted/arcane_barrage
/obj/item/gun/ballistic/rifle/enchanted/arcane_barrage
name = "arcane barrage"
desc = "Pew Pew Pew."
fire_sound = 'sound/weapons/emitter.ogg'
@@ -116,29 +158,29 @@
trigger_guard = TRIGGER_GUARD_ALLOW_ALL
realistic = FALSE
mag_type = /obj/item/ammo_box/magazine/internal/boltaction/enchanted/arcane_barrage
mag_type = /obj/item/ammo_box/magazine/internal/arcane_barrage
/obj/item/gun/ballistic/rifle/boltaction/enchanted/dropped()
/obj/item/gun/ballistic/rifle/enchanted/dropped()
. = ..()
guns_left = 0
magazine = null
chambered = null
/obj/item/gun/ballistic/rifle/boltaction/enchanted/proc/discard_gun(mob/living/user)
/obj/item/gun/ballistic/rifle/enchanted/proc/discard_gun(mob/living/user)
user.throw_item(pick(oview(7,get_turf(user))))
/obj/item/gun/ballistic/rifle/boltaction/enchanted/arcane_barrage/discard_gun(mob/living/user)
/obj/item/gun/ballistic/rifle/enchanted/arcane_barrage/discard_gun(mob/living/user)
qdel(src)
/obj/item/gun/ballistic/rifle/boltaction/enchanted/attack_self()
/obj/item/gun/ballistic/rifle/enchanted/attack_self()
return
/obj/item/gun/ballistic/rifle/boltaction/enchanted/process_fire(atom/target, mob/living/user, message = TRUE, params = null, zone_override = "", bonus_spread = 0)
/obj/item/gun/ballistic/rifle/enchanted/process_fire(atom/target, mob/living/user, message = TRUE, params = null, zone_override = "", bonus_spread = 0)
. = ..()
if(!.)
return
if(guns_left)
var/obj/item/gun/ballistic/rifle/boltaction/enchanted/gun = new type
var/obj/item/gun/ballistic/rifle/enchanted/gun = new type
gun.guns_left = guns_left - 1
discard_gun(user)
user.swap_hand()
@@ -181,67 +181,6 @@
if(.)
weapon_weight = WEAPON_MEDIUM
// IMPROVISED SHOTGUN //
/obj/item/gun/ballistic/shotgun/doublebarrel/improvised
name = "improvised shotgun"
desc = "Essentially a tube that aims shotgun shells."
icon_state = "ishotgun"
inhand_icon_state = "ishotgun"
w_class = WEIGHT_CLASS_BULKY
force = 10
slot_flags = null
mag_type = /obj/item/ammo_box/magazine/internal/shot/improvised
sawn_desc = "I'm just here for the gasoline."
unique_reskin = null
var/slung = FALSE
/obj/item/gun/ballistic/shotgun/doublebarrel/improvised/attackby(obj/item/A, mob/user, params)
..()
if(istype(A, /obj/item/stack/cable_coil) && !sawn_off)
var/obj/item/stack/cable_coil/C = A
if(C.use(10))
slot_flags = ITEM_SLOT_BACK
to_chat(user, "<span class='notice'>You tie the lengths of cable to the shotgun, making a sling.</span>")
slung = TRUE
update_icon()
else
to_chat(user, "<span class='warning'>You need at least ten lengths of cable if you want to make a sling!</span>")
/obj/item/gun/ballistic/shotgun/doublebarrel/improvised/update_icon_state()
. = ..()
if(slung)
inhand_icon_state = "ishotgunsling"
if(sawn_off)
inhand_icon_state = "ishotgun_sawn"
/obj/item/gun/ballistic/shotgun/doublebarrel/improvised/update_overlays()
. = ..()
if(slung)
. += "ishotgunsling"
if(sawn_off)
. += "ishotgun_sawn"
/obj/item/gun/ballistic/shotgun/doublebarrel/improvised/sawoff(mob/user)
. = ..()
if(. && slung) //sawing off the gun removes the sling
new /obj/item/stack/cable_coil(get_turf(src), 10)
slung = FALSE
update_icon()
lefthand_file = 'icons/mob/inhands/weapons/64x_guns_left.dmi'
righthand_file = 'icons/mob/inhands/weapons/64x_guns_right.dmi'
/obj/item/gun/ballistic/shotgun/doublebarrel/improvised/sawn
name = "sawn-off improvised shotgun"
desc = "A single-shot shotgun. Better not miss."
icon_state = "ishotgun_sawn"
inhand_icon_state = "ishotgun_sawn"
worn_icon_state = "gun"
worn_icon = null
w_class = WEIGHT_CLASS_NORMAL
sawn_off = TRUE
slot_flags = ITEM_SLOT_BELT
/obj/item/gun/ballistic/shotgun/doublebarrel/hook
name = "hook modified sawn-off shotgun"
desc = "Range isn't an issue when you can bring your victim to you."