From 958b01f4d0142052cec39fa376dd9c05d70d8f19 Mon Sep 17 00:00:00 2001 From: CygnusB <39594514+MalricB@users.noreply.github.com> Date: Tue, 19 Jan 2021 06:09:55 -0300 Subject: [PATCH] part 2 forgot a bunch of shit, also had to re-do parts because we don't have update_overlays() --- code/game/machinery/recharger.dm | 2 +- code/game/objects/items/miscellaneous.dm | 51 +++++++++++++++++++ code/modules/cargo/centcom_podlauncher.dm | 2 +- .../boxes_magazines/external/rechargable.dm | 17 ++++--- code/modules/projectiles/gun.dm | 2 +- .../projectiles/guns/ballistic/revolver.dm | 11 ++-- 6 files changed, 69 insertions(+), 16 deletions(-) diff --git a/code/game/machinery/recharger.dm b/code/game/machinery/recharger.dm index 33829b74..c18411ef 100644 --- a/code/game/machinery/recharger.dm +++ b/code/game/machinery/recharger.dm @@ -18,7 +18,7 @@ /obj/item/modular_computer, /obj/item/gun/ballistic/automatic/magrifle_e, /obj/item/gun/ballistic/automatic/pistol/mag_e, - /obj/item/ammo_casing/msw_batt, + /obj/item/ammo_casing/mws_batt, /obj/item/ammo_box/magazine/mws_mag)) /obj/machinery/recharger/RefreshParts() diff --git a/code/game/objects/items/miscellaneous.dm b/code/game/objects/items/miscellaneous.dm index 619bfd63..8983485c 100644 --- a/code/game/objects/items/miscellaneous.dm +++ b/code/game/objects/items/miscellaneous.dm @@ -1,3 +1,54 @@ +/obj/item/choice_beacon + name = "choice beacon" + desc = "Hey, why are you viewing this?!! Please let Centcom know about this odd occurance." + icon = 'icons/obj/device.dmi' + icon_state = "gangtool-blue" + item_state = "radio" + var/list/stored_options + var/force_refresh = FALSE //if set to true, the beacon will recalculate its display options whenever opened + +/obj/item/choice_beacon/attack_self(mob/user) + if(canUseBeacon(user)) + generate_options(user) + +/obj/item/choice_beacon/proc/generate_display_names() // return the list that will be used in the choice selection. entries should be in (type.name = type) fashion. see choice_beacon/hero for how this is done. + return list() + +/obj/item/choice_beacon/proc/canUseBeacon(mob/living/user) + if(user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK)) + return TRUE + else + playsound(src, 'sound/machines/buzz-sigh.ogg', 40, 1) + return FALSE + +/obj/item/choice_beacon/proc/generate_options(mob/living/M) + if(!stored_options || force_refresh) + stored_options = generate_display_names() + if(!stored_options.len) + return + var/choice = input(M,"Which item would you like to order?","Select an Item") as null|anything in stored_options + if(!choice || !M.canUseTopic(src, BE_CLOSE, FALSE, NO_TK)) + return + + spawn_option(stored_options[choice],M) + qdel(src) + +/obj/item/choice_beacon/proc/create_choice_atom(atom/choice, mob/owner) + return new choice() + +/obj/item/choice_beacon/proc/spawn_option(obj/choice,mob/living/M) + var/obj/new_item = new choice() + var/obj/structure/closet/supplypod/bluespacepod/pod = new() + pod.explosionSize = list(0,0,0,0) + new_item.forceMove(pod) + var/msg = "After making your selection, you notice a strange target on the ground. It might be best to step back!" + if(ishuman(M)) + var/mob/living/carbon/human/H = M + if(istype(H.ears, /obj/item/radio/headset)) + msg = "You hear something crackle in your ears for a moment before a voice speaks. \"Please stand by for a message from Central Command. Message as follows: Item request received. Your package is inbound, please stand back from the landing site. Message ends.\"" + to_chat(M, msg) + new /obj/effect/DPtarget(get_turf(src), pod) + /obj/item/caution desc = "Caution! Wet Floor!" name = "wet floor sign" diff --git a/code/modules/cargo/centcom_podlauncher.dm b/code/modules/cargo/centcom_podlauncher.dm index e482aa00..880fb859 100644 --- a/code/modules/cargo/centcom_podlauncher.dm +++ b/code/modules/cargo/centcom_podlauncher.dm @@ -508,4 +508,4 @@ force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.adm updateCursor(FALSE) //Make sure our moues cursor resets to default. False means we are not in launch mode qdel(temp_pod) //Delete the temp_pod qdel(selector) //Delete the selector effect - . = ..() \ No newline at end of file + . = ..() diff --git a/code/modules/projectiles/boxes_magazines/external/rechargable.dm b/code/modules/projectiles/boxes_magazines/external/rechargable.dm index 21e3083f..1444cccd 100644 --- a/code/modules/projectiles/boxes_magazines/external/rechargable.dm +++ b/code/modules/projectiles/boxes_magazines/external/rechargable.dm @@ -27,8 +27,8 @@ var/list/modes = list() -/obj/item/ammo_box/magazine/mws_mag/update_overlays() - .=..() +/obj/item/ammo_box/magazine/mws_mag/update_icon() + cut_overlays() if(!stored_ammo.len) return //Why bother @@ -37,13 +37,14 @@ for(var/B in stored_ammo) var/obj/item/ammo_casing/mws_batt/batt = B var/mutable_appearance/cap = mutable_appearance(icon, "[initial(icon_state)]_cap", color = batt.type_color) + cap.color = batt.type_color cap.pixel_x = current * x_offset //Caps don't need a pixel_y offset - . += cap + add_overlay(cap) if(batt.cell.charge > 0) var/ratio = CEILING(clamp(batt.cell.charge / batt.cell.maxcharge, 0, 1) * 4, 1) //4 is how many lights we have a sprite for var/mutable_appearance/charge = mutable_appearance(icon, "[initial(icon_state)]_charge-[ratio]", color = "#29EAF4") //Could use battery color but eh. charge.pixel_x = current * x_offset - . += charge + add_overlay(charge) current++ //Increment for offsets @@ -74,11 +75,11 @@ cell.give(cell.maxcharge) update_icon() -/obj/item/ammo_casing/mws_batt/update_overlays() - .=..() - +/obj/item/ammo_casing/mws_batt/update_icon() + cut_overlays() var/mutable_appearance/ends = mutable_appearance(icon, "[initial(icon_state)]_ends", color = type_color) - . += ends + ends.color = type_color + add_overlay(ends) /obj/item/ammo_casing/mws_batt/get_cell() return cell diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index 68fbfc31..55f057d2 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -95,7 +95,7 @@ zoom(user, FALSE) //we can only stay zoomed in if it's in our hands //yeah and we only unzoom if we're actually zoomed using the gun!! //called after the gun has successfully fired its chambered ammo. -/obj/item/gun/proc/process_chamber(mob/living/user)) +/obj/item/gun/proc/process_chamber(mob/living/user) return FALSE //check if there's enough ammo/energy/whatever to shoot one time diff --git a/code/modules/projectiles/guns/ballistic/revolver.dm b/code/modules/projectiles/guns/ballistic/revolver.dm index fee38e33..05e284e5 100644 --- a/code/modules/projectiles/guns/ballistic/revolver.dm +++ b/code/modules/projectiles/guns/ballistic/revolver.dm @@ -445,8 +445,8 @@ chambered = null update_icon() -/obj/item/gun/ballistic/revolver/mws/update_overlays() - .=..() +/obj/item/gun/ballistic/revolver/mws/update_icon() + cut_overlays() if(!chambered) return @@ -456,16 +456,17 @@ //Mode bar var/image/mode_bar = image(icon, icon_state = "[initial(icon_state)]_type") mode_bar.color = batt_color - . += mode_bar + add_overlay(mode_bar) //Barrel color var/mutable_appearance/barrel_color = mutable_appearance(icon, "[initial(icon_state)]_barrel", color = batt_color) barrel_color.alpha = 150 - . += barrel_color + add_overlay(barrel_color) //Charge bar var/ratio = can_shoot() ? CEILING(clamp(batt.cell.charge / batt.cell.maxcharge, 0, 1) * charge_sections, 1) : 0 for(var/i = 0, i < ratio, i++) var/mutable_appearance/charge_bar = mutable_appearance(icon, "[initial(icon_state)]_charge", color = batt_color) charge_bar.pixel_x = i - . += charge_bar + charge_bar.color = batt_color + add_overlay(charge_bar)