forgot a bunch of shit, also had to re-do parts because we don't have update_overlays()
This commit is contained in:
CygnusB
2021-01-19 06:09:55 -03:00
parent f21db73775
commit 958b01f4d0
6 changed files with 69 additions and 16 deletions
+1 -1
View File
@@ -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()
+51
View File
@@ -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 = "<span class='danger'>After making your selection, you notice a strange target on the ground. It might be best to step back!</span>"
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: <span class='bold'>Item request received. Your package is inbound, please stand back from the landing site.</span> 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"
+1 -1
View File
@@ -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
. = ..()
. = ..()
@@ -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
+1 -1
View File
@@ -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
@@ -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)