From 39daad8d212c77cc52ce9660d17a35f20bb00280 Mon Sep 17 00:00:00 2001 From: Xhuis Date: Wed, 14 Oct 2015 17:31:58 -0400 Subject: [PATCH 1/4] Pneumatic cannon optimization --- .../objects/items/weapons/pneumaticCannon.dm | 45 ++++++++++++++----- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/code/game/objects/items/weapons/pneumaticCannon.dm b/code/game/objects/items/weapons/pneumaticCannon.dm index eb7652cb0a0..48219fcd7b4 100644 --- a/code/game/objects/items/weapons/pneumaticCannon.dm +++ b/code/game/objects/items/weapons/pneumaticCannon.dm @@ -37,6 +37,9 @@ return updateTank(W, 0, user) return + if(W.type == type) + user << "You're fairly certain that putting a pneumatic cannon inside another pneumatic cannon would cause a spacetime disruption." + return if(istype(W, /obj/item/weapon/wrench)) switch(pressureSetting) if(1) @@ -70,9 +73,22 @@ return -/obj/item/weapon/pneumatic_cannon/afterattack(atom/target as mob|obj|turf, mob/living/carbon/human/user as mob|obj, flag, params) - if(user.a_intent == "harm" || !ishuman(user)) +/obj/item/weapon/pneumatic_cannon/afterattack(atom/target, mob/living/carbon/human/user, flag, params) + if(istype(target, /obj/item/weapon/storage)) //So you can store it in backpacks return ..() + if(istype(target, /obj/structure/closet)) //So you can store it in closets + return ..() + if(istype(target, /obj/structure/rack)) //So you can store it on racks + return ..() + if(!istype(user)) + return ..() + Fire(user, target) + + +/obj/item/weapon/pneumatic_cannon/proc/Fire(var/mob/living/carbon/human/user, var/turf/target_turf) + if(!istype(user) && !target_turf) + return + var/discharge = 0 if(is_in_gang(user, "Sleeping Carp")) user << "Use of ranged weaponry would bring dishonor to the clan." return @@ -85,20 +101,29 @@ if(tank && !tank.air_contents.remove(gasPerThrow * pressureSetting)) user << "\The [src] lets out a weak hiss and doesn't react!" return - user.visible_message("[user] fires \the [src]!", \ - "You fire \the [src]!") - add_logs(user, target, "fired at", src) - playsound(src.loc, 'sound/weapons/sonic_jackhammer.ogg', (50 * pressureSetting), 1) + if(user.disabilities & CLUMSY && prob(25)) + user.visible_message("[user] loses their grip on [src], causing it to go off!", \ + "[src] slips out of your hands and goes off!") + user.drop_item() + if(prob(10)) + target_turf = get_turf(user) + else + for(var/turf/T in range(3,src)) + if(prob(25)) + target_turf = T + discharge = 1 + if(!discharge) + user.visible_message("[user] fires \the [src]!", \ + "You fire \the [src]!") + add_logs(user, target_turf, "fired at", src) + playsound(src.loc, 'sound/weapons/sonic_jackhammer.ogg', 50, 1) for(var/obj/item/ITD in loadedItems) //Item To Discharge spawn(0) loadedItems.Remove(ITD) loadedWeightClass -= ITD.w_class ITD.throw_speed = pressureSetting * 2 ITD.loc = get_turf(src) - ITD.throw_at(target, pressureSetting * 5, pressureSetting * 2,user) - if(pressureSetting >= 3) - user << "\The [src]'s recoil knocks you down!" - user.Weaken(2) + ITD.throw_at(target_turf, pressureSetting * 5, pressureSetting * 2,user) /obj/item/weapon/pneumatic_cannon/ghetto //Obtainable by improvised methods; more gas per use, less capacity, but smaller From 463e80ed620415aa13c2eab54d6ba428d002be6c Mon Sep 17 00:00:00 2001 From: Xhuis Date: Thu, 15 Oct 2015 17:09:48 -0400 Subject: [PATCH 2/4] Restores knockdown for high pressure setting --- code/game/objects/items/weapons/pneumaticCannon.dm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/code/game/objects/items/weapons/pneumaticCannon.dm b/code/game/objects/items/weapons/pneumaticCannon.dm index 48219fcd7b4..6ae15a17a04 100644 --- a/code/game/objects/items/weapons/pneumaticCannon.dm +++ b/code/game/objects/items/weapons/pneumaticCannon.dm @@ -124,6 +124,9 @@ ITD.throw_speed = pressureSetting * 2 ITD.loc = get_turf(src) ITD.throw_at(target_turf, pressureSetting * 5, pressureSetting * 2,user) + if(pressureSetting >= 3 && user) + user.visible_message("[user] is thrown down by the force of the cannon!", "[src] slams into your shoulder, knocking you down!") + user.Weaken(3) /obj/item/weapon/pneumatic_cannon/ghetto //Obtainable by improvised methods; more gas per use, less capacity, but smaller @@ -131,7 +134,7 @@ desc = "A gas-powered, object-firing cannon made out of common parts." force = 5 w_class = 3 - maxWeightClass = 10 + maxWeightClass = 7 gasPerThrow = 5 /datum/table_recipe/improvised_pneumatic_cannon //Pretty easy to obtain but From d09224e267aa36294f579d17a5a10f797ce4d5c1 Mon Sep 17 00:00:00 2001 From: Xhuis Date: Thu, 15 Oct 2015 17:26:32 -0400 Subject: [PATCH 3/4] Changes --- .../objects/items/weapons/pneumaticCannon.dm | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/code/game/objects/items/weapons/pneumaticCannon.dm b/code/game/objects/items/weapons/pneumaticCannon.dm index 6ae15a17a04..9b8516f8413 100644 --- a/code/game/objects/items/weapons/pneumaticCannon.dm +++ b/code/game/objects/items/weapons/pneumaticCannon.dm @@ -85,8 +85,8 @@ Fire(user, target) -/obj/item/weapon/pneumatic_cannon/proc/Fire(var/mob/living/carbon/human/user, var/turf/target_turf) - if(!istype(user) && !target_turf) +/obj/item/weapon/pneumatic_cannon/proc/Fire(var/mob/living/carbon/human/user, var/atom/target) + if(!istype(user) && !target) return var/discharge = 0 if(is_in_gang(user, "Sleeping Carp")) @@ -101,21 +101,19 @@ if(tank && !tank.air_contents.remove(gasPerThrow * pressureSetting)) user << "\The [src] lets out a weak hiss and doesn't react!" return - if(user.disabilities & CLUMSY && prob(25)) - user.visible_message("[user] loses their grip on [src], causing it to go off!", \ - "[src] slips out of your hands and goes off!") + if(user.disabilities & CLUMSY && prob(75)) + user.visible_message("[user] loses their grip on [src], causing it to go off!", "[src] slips out of your hands and goes off!") user.drop_item() if(prob(10)) - target_turf = get_turf(user) + target = get_turf(user) else - for(var/turf/T in range(3,src)) - if(prob(25)) - target_turf = T + var/list/possible_targets = range(3,src) + target = pick(possible_targets) discharge = 1 if(!discharge) user.visible_message("[user] fires \the [src]!", \ "You fire \the [src]!") - add_logs(user, target_turf, "fired at", src) + add_logs(user, target, "fired at", src) playsound(src.loc, 'sound/weapons/sonic_jackhammer.ogg', 50, 1) for(var/obj/item/ITD in loadedItems) //Item To Discharge spawn(0) @@ -123,7 +121,7 @@ loadedWeightClass -= ITD.w_class ITD.throw_speed = pressureSetting * 2 ITD.loc = get_turf(src) - ITD.throw_at(target_turf, pressureSetting * 5, pressureSetting * 2,user) + ITD.throw_at(target, pressureSetting * 5, pressureSetting * 2,user) if(pressureSetting >= 3 && user) user.visible_message("[user] is thrown down by the force of the cannon!", "[src] slams into your shoulder, knocking you down!") user.Weaken(3) From 461726b9ccebc34aa78209a1a20d7ab10e9ec60b Mon Sep 17 00:00:00 2001 From: The Half-Finished Date: Thu, 15 Oct 2015 21:16:14 -0400 Subject: [PATCH 4/4] Update pneumaticCannon.dm --- code/game/objects/items/weapons/pneumaticCannon.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/objects/items/weapons/pneumaticCannon.dm b/code/game/objects/items/weapons/pneumaticCannon.dm index 9b8516f8413..cde8d46f6d4 100644 --- a/code/game/objects/items/weapons/pneumaticCannon.dm +++ b/code/game/objects/items/weapons/pneumaticCannon.dm @@ -132,7 +132,7 @@ desc = "A gas-powered, object-firing cannon made out of common parts." force = 5 w_class = 3 - maxWeightClass = 7 + maxWeightClass = 10 gasPerThrow = 5 /datum/table_recipe/improvised_pneumatic_cannon //Pretty easy to obtain but