Files
Paradise/code/modules/assembly/holder.dm
Vi3trice f4b37b4177 Port TG updating appearances (#17943)
* Get pants that match or else you gonna look silly yo

* Posters

* Fix other hud elements

* Rereviewed

* Update shotglass.dm

* Fix for new merged PRs

* Typo

* Coming across other stuff

* Update theblob.dm

* No takebacksies

* smh i forget to leave a comment

* Updated for the detgun and cards

* Should have rerun langserver again

* No longer plastic, more in scope

* Damn you bluespace

* Reverting turret logic, out of scope at this point

* Tweak that part

* Went over energy guns again, and fixed UI White's sprite sheet

* Welding masks, glasses, and JUSTICE

* Update portable_atmospherics.dm

* Cleaning up, clearing things up

* Review and suggestions

* Update valve.dm

* More tweaks

* Missing character

* Not distinct lightmasks, so they can be overlays

* Update generator.dm

* Add parameter so holodeck doesn't try to make a perfect copy

* Update unsorted.dm

* Spiders

* Better fix for spiders, fix vamps too

* Ghosts

* Update telekinesis.dm

* Cleaning up old procs

* It's set up to not copy datums... Unless they're in a list

* Donuts, duct tape, and detgun. D3VR coming to Early Access

* Update procs that interact with doors so they call update_state instead

* Forgot one spot, and actually might as well just force lock

* Cleaning up other things... Sigh, and kitty ears

* oops

* Getting used to how it works

* blinds

* Going back to the suit obscuring thing, so it doesn't update all the time

* Missed that from merging master

* I made this PR and forgot about it

* Fix runtimes in cards

* Make things a bit more unified

* Update update_icons.dm

* yarn, really?

* Update library_equipment.dm

* Update shieldgen.dm

* Every time Charlie merges something, I go back and see if I can improve things further

* what's this? more?

* Update misc_special.dm

* wow, paper

* Review

* More reviews

* To be sure, seems like being broken messed something sometimes

* Brought airlocks closer to how TG works to iron out some stuff

* Pizza and morgue

* Doesn't seem to hurt, tried with holodeck

* Revert "Doesn't seem to hurt, tried with holodeck"

This reverts commit 158529302b.

* Icon conflict

* Fix organ damage

* Don't ask how. Why. It's like that on prod too.

* Cutting down on things and updating from TG.

* More flexible. Just in case the thing you stuck it on didn't destroy.

* Hydro was one the things I touched earlier on, better rework it

* Reviews

* Cleaning up further, also bri'ish

* Undo a change I did, and switch over to a more recent implementation

* Update biogenerator.dm

* Rolling back to old airlocks, but with new duct taped note

* Functionally the same. I'd just rather not have the smoothing happen there

* Went over APCs again

* Fix welding helmet names in species files

* Update airlock.dm

* Update persistent_overlay.dm

* Oh, topic
2022-07-21 08:11:59 +02:00

202 lines
4.8 KiB
Plaintext

/obj/item/assembly_holder
name = "Assembly"
icon = 'icons/obj/assemblies/new_assemblies.dmi'
icon_state = "holder"
item_state = "assembly"
flags = CONDUCT
throwforce = 5
w_class = WEIGHT_CLASS_SMALL
throw_speed = 3
throw_range = 10
var/secured = FALSE
var/obj/item/assembly/a_left = null
var/obj/item/assembly/a_right = null
/obj/item/assembly_holder/proc/attach(obj/item/D, obj/item/D2, mob/user)
return
/obj/item/assembly_holder/proc/process_activation(obj/item/D)
return
/obj/item/assembly_holder/IsAssemblyHolder()
return TRUE
/obj/item/assembly_holder/Destroy()
if(a_left)
a_left.holder = null
if(a_right)
a_right.holder = null
return ..()
/obj/item/assembly_holder/attach(obj/item/D, obj/item/D2, mob/user)
if(!D || !D2)
return FALSE
if(!isassembly(D) || !isassembly(D2))
return FALSE
var/obj/item/assembly/A1 = D
var/obj/item/assembly/A2 = D2
if(A1.secured || A2.secured)
return FALSE
if(!A1.remove_item_from_storage(src))
if(user)
user.remove_from_mob(A1)
A1.forceMove(src)
if(!A2.remove_item_from_storage(src))
if(user)
user.remove_from_mob(A2)
A2.forceMove(src)
A1.holder = src
A2.holder = src
a_left = A1
a_right = A2
name = "[A1.name]-[A2.name] assembly"
update_icon(UPDATE_OVERLAYS)
return TRUE
/obj/item/assembly_holder/proc/has_prox_sensors()
if(istype(a_left, /obj/item/assembly/prox_sensor) || istype(a_right, /obj/item/assembly/prox_sensor))
return TRUE
return FALSE
/obj/item/assembly_holder/update_overlays()
. = ..()
if(a_left)
. += "[a_left.icon_state]_left"
for(var/O in a_left.attached_overlays)
. += "[O]_l"
if(a_right)
. += "[a_right.icon_state]_right"
for(var/O in a_right.attached_overlays)
. += "[O]_r"
if(master)
master.update_icon()
/obj/item/assembly_holder/examine(mob/user)
. = ..()
if(in_range(src, user) || loc == user)
if(secured)
. += "[src] is ready!"
else
. += "[src] can be attached!"
/obj/item/assembly_holder/HasProximity(atom/movable/AM)
if(a_left)
a_left.HasProximity(AM)
if(a_right)
a_right.HasProximity(AM)
/obj/item/assembly_holder/Crossed(atom/movable/AM, oldloc)
if(a_left)
a_left.Crossed(AM, oldloc)
if(a_right)
a_right.Crossed(AM, oldloc)
/obj/item/assembly_holder/on_found(mob/finder)
if(a_left)
a_left.on_found(finder)
if(a_right)
a_right.on_found(finder)
/obj/item/assembly_holder/hear_talk(mob/living/M, list/message_pieces)
if(a_left)
a_left.hear_talk(M, message_pieces)
if(a_right)
a_right.hear_talk(M, message_pieces)
/obj/item/assembly_holder/hear_message(mob/living/M, msg)
if(a_left)
a_left.hear_message(M, msg)
if(a_right)
a_right.hear_message(M, msg)
/obj/item/assembly_holder/proc/process_movement() // infrared beams and prox sensors
if(a_left && a_right)
a_left.holder_movement()
a_right.holder_movement()
/obj/item/assembly_holder/Move()
. = ..()
process_movement()
return
/obj/item/assembly_holder/pickup()
. = ..()
process_movement()
/obj/item/assembly_holder/Bump()
..()
process_movement()
/obj/item/assembly_holder/throw_impact() // called when a throw stops
..()
process_movement()
/obj/item/assembly_holder/attack_hand()//Perhapse this should be a holder_pickup proc instead, can add if needbe I guess
if(a_left && a_right)
a_left.holder_movement()
a_right.holder_movement()
..()
return
/obj/item/assembly_holder/screwdriver_act(mob/user, obj/item/I)
if(!a_left || !a_right)
to_chat(user, "<span class='warning'>BUG:Assembly part missing, please report this!</span>")
return
. = TRUE
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
return
a_left.toggle_secure()
a_right.toggle_secure()
secured = !secured
if(secured)
to_chat(user, "<span class='notice'>[src] is ready!</span>")
else
to_chat(user, "<span class='notice'>[src] can now be taken apart!</span>")
update_icon()
/obj/item/assembly_holder/attack_self(mob/user)
add_fingerprint(user)
if(secured)
if(!a_left || !a_right)
to_chat(user, "<span class='warning'>Assembly part missing!</span>")
return
if(istype(a_left, a_right.type))//If they are the same type it causes issues due to window code
switch(alert("Which side would you like to use?",,"Left","Right"))
if("Left")
a_left.attack_self(user)
if("Right")
a_right.attack_self(user)
return
else
a_left.attack_self(user)
a_right.attack_self(user)
else
var/turf/T = get_turf(src)
if(!T)
return FALSE
if(a_left)
a_left.holder = null
a_left.forceMove(T)
if(a_right)
a_right.holder = null
a_right.forceMove(T)
qdel(src)
/obj/item/assembly_holder/process_activation(obj/D, normal = TRUE, special = TRUE)
if(!D)
return FALSE
if(normal && a_right && a_left)
if(a_right != D)
a_right.pulsed(0)
if(a_left && a_left != D) // the right pools might have sent us boom, so `a_left` can be null here
a_left.pulsed(0)
if(master)
master.receive_signal()
return TRUE