Files
VOREStation/code/modules/modular_computers/computers/modular_computer/interaction.dm
Cameron Lennox d5849910e5 Begin clickcode attack_self fix (#18797)
* Begin clickcode attack_self fix

Begins the work to make everything call back to parent for attack_self so that signals are sacred.

* Makes MORE things call the attack_self() parent

Yes, I could make special_handling a var on obj/item HOWEVER i want it to be specific so it can be tracked down later and ONLY the objects that use it can be refactored instead of sitting there literally forever and it just becoming 'a thing'.

* Finishes making the rest of attack_self call parent.

As mentioned, things such as 'specialty_goggles' 'special_handling' and the such are only there to help with attack_self until the attack_self is recoded for those items.

* begone foul demon

* some more cleanup

* These

* GOD this was annoying

* yeh

* Fix this

* fLARES

* Thesee too

* toys!

* Even more!

* More fixes

* Even more

* rest of em

* these too

* Update syndie.dm

* hardref clear

* Update code/game/gamemodes/nuclear/pinpointer.dm

* Update code/game/objects/effects/mines.dm

* Update code/game/objects/items/blueprints_vr.dm

* Update code/game/objects/items/blueprints_vr.dm

* Update code/game/objects/items/contraband_vr.dm

* Update code/game/objects/items/crayons.dm

* Update code/game/objects/items/crayons.dm

* Update code/game/objects/items/gunbox.dm

* Update code/game/objects/items/gunbox.dm

* Update code/game/objects/items/gunbox_vr.dm

* Update code/game/objects/items/gunbox_vr.dm

* Update code/game/objects/items/weapons/gift_wrappaper.dm

* Update code/game/objects/items/crayons.dm

* Update code/game/objects/items/crayons.dm

* Update code/game/objects/items/gunbox.dm

* these too

* Update maintpanel_stack.dm

* angry warning

* Fixes packaged snacks.

Fixes improper var default.

* Special handling for these

* proper poly types

* Fixes magclaws

Makes the 'features' it had just part  of base magboots that can be adjusted via varswap.

* Fixes jackets

Fixes https://github.com/VOREStation/VOREStation/issues/18941

* Small bugfix

Makes p_Theyre properly capitialize
Makes examine show proper wording

* Update gift_wrappaper.dm
2025-12-29 13:21:10 -05:00

215 lines
6.0 KiB
Plaintext

/obj/item/modular_computer/proc/update_verbs()
verbs.Cut()
if(portable_drive)
verbs |= /obj/item/modular_computer/verb/eject_usb
if(card_slot)
verbs |= /obj/item/modular_computer/verb/eject_id
verbs |= /obj/item/modular_computer/verb/emergency_shutdown
// Forcibly shut down the device. To be used when something bugs out and the UI is nonfunctional.
/obj/item/modular_computer/verb/emergency_shutdown()
set name = "Forced Shutdown"
set category = "Object"
set src in view(1)
if(usr.incapacitated() || !isliving(usr))
to_chat(usr, span_warning("You can't do that."))
return
if(!Adjacent(usr))
to_chat(usr, span_warning("You can't reach it."))
return
if(enabled)
bsod = 1
update_icon()
shutdown_computer()
to_chat(usr, "You press a hard-reset button on \the [src]. It displays a brief debug screen before shutting down.")
spawn(2 SECONDS)
bsod = 0
update_icon()
// Eject ID card from computer, if it has ID slot with card inside.
/obj/item/modular_computer/verb/eject_id()
set name = "Eject ID"
set category = "Object"
set src in view(1)
if(usr.incapacitated() || !isliving(usr))
to_chat(usr, span_warning("You can't do that."))
return
if(!Adjacent(usr))
to_chat(usr, span_warning("You can't reach it."))
return
proc_eject_id(usr)
// Eject ID card from computer, if it has ID slot with card inside.
/obj/item/modular_computer/verb/eject_usb()
set name = "Eject Portable Storage"
set category = "Object"
set src in view(1)
if(usr.incapacitated() || !isliving(usr))
to_chat(usr, span_warning("You can't do that."))
return
if(!Adjacent(usr))
to_chat(usr, span_warning("You can't reach it."))
return
proc_eject_usb(usr)
/obj/item/modular_computer/proc/proc_eject_id(mob/user)
if(!user)
user = usr
if(!card_slot)
to_chat(user, "\The [src] does not have an ID card slot")
return
if(!card_slot.stored_card)
to_chat(user, "There is no card in \the [src]")
return
if(active_program)
active_program.event_idremoved(0)
for(var/datum/computer_file/program/P in idle_threads)
P.event_idremoved(1)
card_slot.stored_card.forceMove(get_turf(src))
card_slot.stored_card = null
update_uis()
to_chat(user, "You remove the card from \the [src]")
/obj/item/modular_computer/proc/proc_eject_usb(mob/user)
if(!user)
user = usr
if(!portable_drive)
to_chat(user, "There is no portable device connected to \the [src].")
return
uninstall_component(user, portable_drive)
update_uis()
/obj/item/modular_computer/attack_ghost(var/mob/observer/dead/user)
if(enabled)
tgui_interact(user)
else if(check_rights_for(user.client, R_ADMIN|R_EVENT|R_DEBUG))
var/response = tgui_alert(user, "This computer is turned off. Would you like to turn it on?", "Admin Override", list("Yes", "No"))
if(response == "Yes")
turn_on(user)
/obj/item/modular_computer/attack_ai(var/mob/user)
return attack_self(user)
/obj/item/modular_computer/attack_hand(var/mob/user)
if(anchored)
return attack_self(user)
return ..()
// On-click handling. Turns on the computer if it's off and opens the GUI.
/obj/item/modular_computer/attack_self(mob/user)
. = ..(user)
if(.)
return TRUE
if(enabled && screen_on)
if(isliving(user) && HAS_TRAIT(user, TRAIT_UNLUCKY) && prob(5))
var/mob/living/unlucky_soul = user
to_chat(user, span_danger("You interact with \the [src] and are met with a sudden shock!"))
var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
s.set_up(5, 1, src)
s.start()
unlucky_soul.electrocute_act(5, src, 1)
return
tgui_interact(user)
else if(!enabled && screen_on)
if(HAS_TRAIT(user, TRAIT_UNLUCKY) && prob(25))
to_chat(user, "You try to turn on \the [src] but it doesn't respond.")
return
turn_on(user)
/obj/item/modular_computer/attackby(var/obj/item/W, var/mob/user)
if(istype(W, /obj/item/card/id)) // ID Card, try to insert it.
var/obj/item/card/id/I = W
if(!card_slot)
to_chat(user, "You try to insert \the [I] into \the [src], but it does not have an ID card slot installed.")
return
if(card_slot.stored_card)
to_chat(user, "You try to insert \the [I] into \the [src], but it's ID card slot is occupied.")
return
user.drop_from_inventory(I)
card_slot.stored_card = I
I.forceMove(src)
update_uis()
to_chat(user, "You insert \the [I] into \the [src].")
return
if(istype(W, /obj/item/paper) || istype(W, /obj/item/paper_bundle))
if(!nano_printer)
return
nano_printer.attackby(W, user)
if(istype(W, /obj/item/computer_hardware))
var/obj/item/computer_hardware/C = W
if(C.hardware_size <= max_hardware_size)
try_install_component(user, C)
else
to_chat(user, "This component is too large for \the [src].")
if(W.has_tool_quality(TOOL_WRENCH))
var/list/components = get_all_components()
if(components.len)
to_chat(user, "Remove all components from \the [src] before disassembling it.")
return
new /obj/item/stack/material/steel( get_turf(src.loc), steel_sheet_cost )
src.visible_message("\The [src] has been disassembled by [user].")
qdel(src)
return
if(W.has_tool_quality(TOOL_WELDER))
var/obj/item/weldingtool/WT = W.get_welder()
if(!WT.isOn())
to_chat(user, "\The [W] is off.")
return
if(!damage)
to_chat(user, "\The [src] does not require repairs.")
return
to_chat(user, "You begin repairing damage to \the [src]...")
if(WT.remove_fuel(round(damage/75)) && do_after(user, damage/10, target = src))
damage = 0
to_chat(user, "You repair \the [src].")
return
if(W.has_tool_quality(TOOL_SCREWDRIVER))
var/list/all_components = get_all_components()
if(!all_components.len)
to_chat(user, "This device doesn't have any components installed.")
return
var/list/component_names = list()
for(var/obj/item/computer_hardware/H in all_components)
component_names.Add(H.name)
var/choice = tgui_input_list(user, "Which component do you want to uninstall?", "Computer maintenance", component_names)
if(!choice)
return
if(!Adjacent(user))
return
var/obj/item/computer_hardware/H = find_hardware_by_name(choice)
if(!H)
return
uninstall_component(user, H)
return
..()