Files
VOREStation/code/modules/assembly/assembly.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

115 lines
3.0 KiB
Plaintext

/obj/item/assembly
name = "assembly"
desc = "A small electronic device that should never exist."
icon = 'icons/obj/assemblies/new_assemblies.dmi'
icon_state = ""
w_class = ITEMSIZE_SMALL
matter = list(MAT_STEEL = 100)
throwforce = 2
throw_speed = 3
throw_range = 10
drop_sound = 'sound/items/drop/component.ogg'
pickup_sound = 'sound/items/pickup/component.ogg'
origin_tech = list(TECH_MAGNET = 1)
var/secured = 1
var/list/attached_overlays = null
var/obj/item/assembly_holder/holder = null
var/cooldown = FALSE //To prevent spam
var/wires = WIRE_RECEIVE | WIRE_PULSE
var/const/WIRE_RECEIVE = 1 //Allows Pulsed(0) to call Activate()
var/const/WIRE_PULSE = 2 //Allows Pulse(0) to act on the holder
var/const/WIRE_PULSE_SPECIAL = 4 //Allows Pulse(0) to act on the holders special assembly
var/const/WIRE_RADIO_RECEIVE = 8 //Allows Pulsed(1) to call Activate()
var/const/WIRE_RADIO_PULSE = 16 //Allows Pulse(1) to send a radio message
///var used for attack_self chain
var/special_handling = FALSE
/obj/item/assembly/proc/holder_movement()
return
/obj/item/assembly/proc/process_cooldown()
if(cooldown)
return FALSE
cooldown = TRUE
VARSET_IN(src, cooldown, FALSE, 2 SECONDS)
return TRUE
/obj/item/assembly/proc/pulsed(var/radio = 0)
if(holder && (wires & WIRE_RECEIVE))
activate()
if(radio && (wires & WIRE_RADIO_RECEIVE))
activate()
return 1
/obj/item/assembly/proc/pulse(var/radio = 0)
if(holder && (wires & WIRE_PULSE))
holder.process_activation(src, 1, 0)
if(holder && (wires & WIRE_PULSE_SPECIAL))
holder.process_activation(src, 0, 1)
return 1
/obj/item/assembly/proc/activate()
if(!secured || !process_cooldown())
return FALSE
return TRUE
/obj/item/assembly/proc/toggle_secure()
secured = !secured
update_icon()
return secured
/obj/item/assembly/proc/attach_assembly(var/obj/item/assembly/A, var/mob/user)
holder = new/obj/item/assembly_holder(get_turf(src))
if(holder.attach(A,src,user))
to_chat(user, span_notice("You attach \the [A] to \the [src]!"))
return TRUE
/obj/item/assembly/attackby(obj/item/W as obj, mob/user as mob)
if(isassembly(W))
var/obj/item/assembly/A = W
if((!A.secured) && (!secured))
attach_assembly(A,user)
return
if(W.has_tool_quality(TOOL_SCREWDRIVER))
if(toggle_secure())
to_chat(user, span_notice("\The [src] is ready!"))
else
to_chat(user, span_notice("\The [src] can now be attached!"))
return
return ..()
/obj/item/assembly/process()
return PROCESS_KILL
/obj/item/assembly/examine(mob/user)
. = ..()
if((in_range(src, user) || loc == user))
if(secured)
. += "\The [src] is ready!"
else
. += "\The [src] can be attached!"
/obj/item/assembly/attack_self(mob/user)
. = ..(user)
if(.)
return TRUE
if(special_handling)
return FALSE
if(!user)
return FALSE
tgui_interact(user)
/obj/item/assembly/tgui_state(mob/user)
return GLOB.tgui_deep_inventory_state
/obj/item/assembly/tgui_interact(mob/user, datum/tgui/ui)
return // tgui goes here
/obj/item/assembly/tgui_host()
if(istype(loc, /obj/item/assembly_holder))
return loc.tgui_host()
return ..()