From 670a6f2126bfa57b16b8c08e7dc3f2ce942681cc Mon Sep 17 00:00:00 2001 From: CitadelStationBot Date: Thu, 18 May 2017 16:37:18 -0500 Subject: [PATCH] Vending machines are more dangerous when throwing items --- code/game/machinery/vending.dm | 28 +++++-- code/game/objects/items.dm | 3 + .../objects/items/weapons/cigs_lighters.dm | 83 ++++++++++--------- .../objects/items/weapons/grenades/grenade.dm | 32 +++---- 4 files changed, 90 insertions(+), 56 deletions(-) diff --git a/code/game/machinery/vending.dm b/code/game/machinery/vending.dm index bd51e1e651..ebe4c79730 100644 --- a/code/game/machinery/vending.dm +++ b/code/game/machinery/vending.dm @@ -48,6 +48,7 @@ var/icon_deny //Icon_state when vending! var/seconds_electrified = 0 //Shock customers like an airlock. var/shoot_inventory = 0 //Fire items at customers! We're broken! + var/shoot_inventory_chance = 2 var/shut_up = 0 //Stop spouting those godawful pitches! var/extended_inventory = 0 //can we access the hidden inventory? var/scan_id = 1 @@ -561,7 +562,7 @@ speak(slogan) last_slogan = world.time - if(shoot_inventory && prob(2)) + if(shoot_inventory && prob(shoot_inventory_chance)) throw_item() @@ -592,7 +593,7 @@ if(!target) return 0 - for(var/datum/data/vending_product/R in product_records) + for(var/datum/data/vending_product/R in shuffle(product_records)) if(R.amount <= 0) //Try to use a record that actually has something to dump. continue var/dump_path = R.product_path @@ -605,19 +606,22 @@ if(!throw_item) return 0 + pre_throw(throw_item) + throw_item.throw_at(target, 16, 3) visible_message("[src] launches [throw_item] at [target]!") return 1 +/obj/machinery/vending/proc/pre_throw(obj/item/I) + return + /obj/machinery/vending/proc/shock(mob/user, prb) if(stat & (BROKEN|NOPOWER)) // unpowered, no shock return FALSE if(!prob(prb)) return FALSE - var/datum/effect_system/spark_spread/s = new /datum/effect_system/spark_spread - s.set_up(5, 1, src) - s.start() + do_sparks(5, TRUE, src) var/tmp/check_range = TRUE if(electrocute_mob(user, get_area(src), src, 0.7, check_range)) return TRUE @@ -864,6 +868,11 @@ IF YOU MODIFY THE PRODUCTS LIST OF A MACHINE, MAKE SURE TO UPDATE ITS RESUPPLY C /obj/item/weapon/storage/fancy/cigarettes/cigars = 1, /obj/item/weapon/storage/fancy/cigarettes/cigars/havana = 1, /obj/item/weapon/storage/fancy/cigarettes/cigars/cohiba = 1) refill_canister = /obj/item/weapon/vending_refill/cigarette +/obj/machinery/vending/cigarette/pre_throw(obj/item/I) + if(istype(I, /obj/item/weapon/lighter)) + var/obj/item/weapon/lighter/L = I + L.set_lit(TRUE) + /obj/machinery/vending/medical name = "\improper NanoMed Plus" desc = "Medical drug dispenser." @@ -919,6 +928,15 @@ IF YOU MODIFY THE PRODUCTS LIST OF A MACHINE, MAKE SURE TO UPDATE ITS RESUPPLY C armor = list(melee = 100, bullet = 100, laser = 100, energy = 100, bomb = 0, bio = 0, rad = 0, fire = 100, acid = 50) resistance_flags = FIRE_PROOF +/obj/machinery/vending/security/pre_throw(obj/item/I) + if(istype(I, /obj/item/weapon/grenade)) + var/obj/item/weapon/grenade/G = I + G.preprime() + else if(istype(I, /obj/item/device/flashlight)) + var/obj/item/device/flashlight/F = I + F.on = TRUE + F.update_brightness() + /obj/machinery/vending/hydronutrients name = "\improper NutriMax" desc = "A plant nutrients vendor." diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 8dc9bd89b2..4a69fdff87 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -528,6 +528,9 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE) /obj/item/throw_impact(atom/A) if(A && !QDELETED(A)) + if(is_hot() && isliving(A)) + var/mob/living/L = A + L.IgniteMob() var/itempush = 1 if(w_class < 4) itempush = 0 //too light to push anything diff --git a/code/game/objects/items/weapons/cigs_lighters.dm b/code/game/objects/items/weapons/cigs_lighters.dm index 3cf5305dcb..82229bb7cf 100644 --- a/code/game/objects/items/weapons/cigs_lighters.dm +++ b/code/game/objects/items/weapons/cigs_lighters.dm @@ -472,8 +472,10 @@ CIGARETTE PACKETS ARE IN FANCY.DM flags = CONDUCT slot_flags = SLOT_BELT var/lit = 0 + var/fancy = TRUE heat = 1500 resistance_flags = FIRE_PROOF + light_color = LIGHT_COLOR_FIRE /obj/item/weapon/lighter/update_icon() if(lit) @@ -484,37 +486,28 @@ CIGARETTE PACKETS ARE IN FANCY.DM /obj/item/weapon/lighter/ignition_effect(atom/A, mob/user) . = "With a single flick of their wrist, [user] smoothly lights [A] with [src]. Damn [user.p_theyre()] cool." -/obj/item/weapon/lighter/greyscale - name = "cheap lighter" - desc = "A cheap-as-free lighter." - icon_state = "lighter" - -/obj/item/weapon/lighter/greyscale/Initialize() - . = ..() - add_atom_colour(color2hex(randomColor(1)), FIXED_COLOUR_PRIORITY) - update_icon() - -/obj/item/weapon/lighter/greyscale/update_icon() - cut_overlays() - var/mutable_appearance/base_overlay = mutable_appearance(icon,"[initial(icon_state)]_base") - base_overlay.appearance_flags = RESET_COLOR //the edging doesn't change color +/obj/item/weapon/lighter/proc/set_lit(new_lit) + lit = new_lit if(lit) - base_overlay.icon_state = "[initial(icon_state)]_on" - add_overlay(base_overlay) - -/obj/item/weapon/lighter/greyscale/ignition_effect(atom/A, mob/user) - . = "After some fiddling, [user] manages to light [A] with [src]." + force = 5 + damtype = "fire" + hitsound = 'sound/items/welder.ogg' + attack_verb = list("burnt", "singed") + set_light(1) + START_PROCESSING(SSobj, src) + else + hitsound = "swing_hit" + force = 0 + attack_verb = null //human_defense.dm takes care of it + set_light(0) + STOP_PROCESSING(SSobj, src) + update_icon() /obj/item/weapon/lighter/attack_self(mob/living/user) if(user.is_holding(src)) if(!lit) - lit = 1 - update_icon() - force = 5 - damtype = "fire" - hitsound = 'sound/items/welder.ogg' - attack_verb = list("burnt", "singed") - if(!istype(src, /obj/item/weapon/lighter/greyscale)) + set_lit(TRUE) + if(fancy) user.visible_message("Without even breaking stride, [user] flips open and lights [src] in one smooth movement.", "Without even breaking stride, you flip open and lights [src] in one smooth movement.") else var/prot = FALSE @@ -534,20 +527,12 @@ CIGARETTE PACKETS ARE IN FANCY.DM user.apply_damage(5, BURN, hitzone) user.visible_message("After a few attempts, [user] manages to light [src] - however, [user.p_they()] burn their finger in the process.", "You burn yourself while lighting the lighter!") - set_light(1) - START_PROCESSING(SSobj, src) else - lit = 0 - update_icon() - hitsound = "swing_hit" - force = 0 - attack_verb = null //human_defense.dm takes care of it - if(!istype(src, /obj/item/weapon/lighter/greyscale)) + set_lit(FALSE) + if(fancy) user.visible_message("You hear a quiet click, as [user] shuts off [src] without even looking at what [user.p_theyre()] doing. Wow.", "You quietly shut off [src] without even looking at what you're doing. Wow.") else user.visible_message("[user] quietly shuts off [src].", "You quietly shut off [src].") - set_light(0) - STOP_PROCESSING(SSobj, src) else . = ..() @@ -562,7 +547,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM if(M == user) cig.attackby(src, user) else - if(!istype(src, /obj/item/weapon/lighter/greyscale)) + if(fancy) cig.light("[user] whips the [name] out and holds it for [M]. [user.p_their(TRUE)] arm is as steady as the unflickering flame they light \the [cig] with.") else cig.light("[user] holds the [name] out for [M], and lights the [cig.name].") @@ -575,6 +560,30 @@ CIGARETTE PACKETS ARE IN FANCY.DM /obj/item/weapon/lighter/is_hot() return lit * heat + +/obj/item/weapon/lighter/greyscale + name = "cheap lighter" + desc = "A cheap-as-free lighter." + icon_state = "lighter" + fancy = FALSE + +/obj/item/weapon/lighter/greyscale/Initialize() + . = ..() + add_atom_colour(color2hex(randomColor(1)), FIXED_COLOUR_PRIORITY) + update_icon() + +/obj/item/weapon/lighter/greyscale/update_icon() + cut_overlays() + var/mutable_appearance/base_overlay = mutable_appearance(icon,"[initial(icon_state)]_base") + base_overlay.appearance_flags = RESET_COLOR //the edging doesn't change color + if(lit) + base_overlay.icon_state = "[initial(icon_state)]_on" + add_overlay(base_overlay) + +/obj/item/weapon/lighter/greyscale/ignition_effect(atom/A, mob/user) + . = "After some fiddling, [user] manages to light [A] with [src]." + + /////////// //ROLLING// /////////// diff --git a/code/game/objects/items/weapons/grenades/grenade.dm b/code/game/objects/items/weapons/grenades/grenade.dm index e478813558..a5f5eb6133 100644 --- a/code/game/objects/items/weapons/grenades/grenade.dm +++ b/code/game/objects/items/weapons/grenades/grenade.dm @@ -48,23 +48,27 @@ /obj/item/weapon/grenade/attack_self(mob/user) if(!active) if(clown_check(user)) - to_chat(user, "You prime the [name]! [det_time/10] seconds!") - playsound(user.loc, 'sound/weapons/armbomb.ogg', 60, 1) - active = 1 - icon_state = initial(icon_state) + "_active" - add_fingerprint(user) - var/turf/bombturf = get_turf(src) - var/area/A = get_area(bombturf) - var/message = "[ADMIN_LOOKUPFLW(user)]) has primed a [name] for detonation at [ADMIN_COORDJMP(bombturf)]" - GLOB.bombers += message - message_admins(message) - log_game("[key_name(usr)] has primed a [name] for detonation at [A.name] [COORD(bombturf)].") + preprime(user) if(iscarbon(user)) var/mob/living/carbon/C = user C.throw_mode_on() - spawn(det_time) - prime() +/obj/item/weapon/grenade/proc/preprime(mob/user) + if(user) + to_chat(user, "You prime the [name]! [det_time/10] seconds!") + playsound(loc, 'sound/weapons/armbomb.ogg', 60, 1) + active = TRUE + icon_state = initial(icon_state) + "_active" + add_fingerprint(user) + var/turf/bombturf = get_turf(src) + var/area/A = get_area(bombturf) + if(user) + var/message = "[ADMIN_LOOKUPFLW(user)]) has primed a [name] for detonation at [ADMIN_COORDJMP(bombturf)]" + GLOB.bombers += message + message_admins(message) + log_game("[key_name(usr)] has primed a [name] for detonation at [A.name] [COORD(bombturf)].") + + addtimer(CALLBACK(src, .proc/prime), det_time) /obj/item/weapon/grenade/proc/prime() @@ -104,4 +108,4 @@ if(damage && attack_type == PROJECTILE_ATTACK && prob(15)) owner.visible_message("[attack_text] hits [owner]'s [src], setting it off! What a shot!") prime() - return 1 //It hit the grenade, not them \ No newline at end of file + return 1 //It hit the grenade, not them