Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrates door remotes to the new attack chain + fixes janikeyring #27925

Merged
merged 4 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion code/game/machinery/doors/airlock.dm
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ GLOBAL_LIST_EMPTY(airlock_emissive_underlays)
var/doorDeni = 'sound/machines/deniedbeep.ogg' // i'm thinkin' Deni's
var/boltUp = 'sound/machines/boltsup.ogg'
var/boltDown = 'sound/machines/boltsdown.ogg'
var/is_special = FALSE
/// Our ID tag for map-based linking shenanigans
var/id_tag
/// List of people who have shocked this door for logging purposes
Expand Down
91 changes: 61 additions & 30 deletions code/game/objects/items/control_wand.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
var/additional_access = list()
var/obj/item/card/id/ID

new_attack_chain = TRUE

/obj/item/door_remote/New()
..()
ID = new /obj/item/card/id
Expand All @@ -28,7 +30,10 @@
QDEL_NULL(ID)
return ..()

/obj/item/door_remote/attack_self__legacy__attackchain(mob/user)
/obj/item/door_remote/activate_self(mob/user)
if(..())
return

var/list/options = list(WAND_OPEN = image(icon = 'icons/mob/radial.dmi', icon_state = "radial_open"),
WAND_BOLT = image(icon = 'icons/mob/radial.dmi', icon_state = "radial_bolt"),
WAND_EMERGENCY = image(icon = 'icons/mob/radial.dmi', icon_state = "radial_ea"),
Expand All @@ -49,21 +54,25 @@
. = ..()
. += "<span class='notice'>It's current mode is: [mode]</span>"

/obj/item/door_remote/afterattack__legacy__attackchain(obj/target, mob/user)
/obj/item/door_remote/interact_with_atom(atom/target, mob/living/user, list/modifiers)
if(istype(target, /obj/machinery/door/airlock))
access_airlock(target, user)
if(istype(target, /obj/machinery/door/window))
access_windoor(target, user)
return ITEM_INTERACT_COMPLETE

/obj/item/door_remote/ranged_interact_with_atom(atom/target, mob/living/user, list/modifiers)
if(istype(target, /obj/machinery/door/airlock))
access_airlock(target, user)
if(istype(target, /obj/machinery/door/window))
access_windoor(target, user)
return ITEM_INTERACT_COMPLETE

/obj/item/door_remote/proc/access_airlock(obj/machinery/door/airlock/D, mob/user)
if(HAS_TRAIT(D, TRAIT_CMAGGED))
to_chat(user, "<span class='danger'>The door doesn't respond to [src]!</span>")
return

if(D.is_special)
to_chat(user, "<span class='danger'>[src] cannot access this kind of door!</span>")
return

if(!(D.arePowerSystemsOn()))
to_chat(user, "<span class='danger'>[D] has no power!</span>")
return
Expand Down Expand Up @@ -184,20 +193,32 @@
/// How far can we use this. Leave `null` for infinite range
var/range

/obj/item/door_remote/omni/access_tuner/afterattack__legacy__attackchain(obj/machinery/door/D, mob/user)
if(!istype(D, /obj/machinery/door/airlock) && !istype(D, /obj/machinery/door/window))
/obj/item/door_remote/omni/access_tuner/interact_with_atom(atom/target, mob/living/user, list/modifiers)
if(!hack(target, user)) // if the hack is successful, calls the parent proc and does the door stuff
return ITEM_INTERACT_COMPLETE
return ..()

/obj/item/door_remote/omni/access_tuner/ranged_interact_with_atom(atom/target, mob/living/user, list/modifiers)
if(!hack(target, user))
return ITEM_INTERACT_COMPLETE
return ..()

/obj/item/door_remote/omni/access_tuner/proc/hack(atom/target, mob/user)
if(!istype(target, /obj/machinery/door/airlock) && !istype(target, /obj/machinery/door/window))
return
if(!isnull(range) && get_dist(src, D) > range)
if(!isnull(range) && get_dist(src, target) > range)
return

if(busy)
to_chat(user, "<span class='warning'>[src] is alreading interfacing with a door!</span>")
return
icon_state = "hacktool-g"
busy = TRUE
to_chat(user, "<span class='notice'>[src] is attempting to interface with [D]...</span>")
if(do_after(user, hack_speed, target = D))
. = ..()
to_chat(user, "<span class='notice'>[src] is attempting to interface with [target]...</span>")
if(do_after(user, hack_speed, target = target))
busy = FALSE
icon_state = "hacktool"
return TRUE
busy = FALSE
icon_state = "hacktool"

Expand All @@ -224,52 +245,62 @@
var/last_airlock_uid
additional_access = list(ACCESS_MEDICAL, ACCESS_RESEARCH, ACCESS_CONSTRUCTION, ACCESS_MAILSORTING, ACCESS_CARGO, ACCESS_MINING, ACCESS_KITCHEN, ACCESS_BAR, ACCESS_JANITOR, ACCESS_CHAPEL_OFFICE)

/obj/item/door_remote/janikeyring/New()
..()
RegisterSignal(src, COMSIG_ACTIVATE_SELF, TYPE_PROC_REF(/datum, signal_cancel_activate_self))
Toastical marked this conversation as resolved.
Show resolved Hide resolved

/obj/item/door_remote/janikeyring/examine(mob/user)
. = ..()
. += "<span class='notice'>This keyring has access to Medbay, Science, Engineering, Cargo, the Bar and the Kitchen!</span>"

/obj/item/door_remote/janikeyring/attack_self__legacy__attackchain(mob/user)
if(cooldown > world.time)
/obj/item/door_remote/janikeyring/activate_self(mob/user)
RegisterSignal(src, COMSIG_ACTIVATE_SELF, TYPE_PROC_REF(/datum, signal_cancel_activate_self), override = TRUE)
Toastical marked this conversation as resolved.
Show resolved Hide resolved
if(..() || cooldown > world.time)
return

to_chat(user, "<span class='warning'>You shake [src]!</span>")
playsound(src, 'sound/items/keyring_shake.ogg', 50)
cooldown = world.time + JANGLE_COOLDOWN

/obj/item/door_remote/janikeyring/afterattack__legacy__attackchain(obj/machinery/door/D, mob/user, proximity)
if(!proximity)
return
if(!istype(D, /obj/machinery/door/airlock) && !istype(D, /obj/machinery/door/window))
/obj/item/door_remote/janikeyring/interact_with_atom(obj/machinery/door/target, mob/living/user, list/modifiers)
if(!unlock(target, user))
return ITEM_INTERACT_COMPLETE
return ..()

/obj/item/door_remote/janikeyring/ranged_interact_with_atom(atom/target, mob/living/user, list/modifiers) // THOSE AINT MAGICAL REMOTE KEYS
return ITEM_INTERACT_COMPLETE


/obj/item/door_remote/janikeyring/proc/unlock(obj/machinery/door/target, mob/living/user)
if(!istype(target, /obj/machinery/door/airlock) && !istype(target, /obj/machinery/door/window))
return
if(busy)
to_chat(user, "<span class='warning'>You are already using [src] on the [D]'s access panel!</span>")
to_chat(user, "<span class='warning'>You are already using [src] on the [target]'s access panel!</span>")
return
busy = TRUE
var/mob/living/carbon/human/H = user
if(H.mind.assigned_role == "Janitor" && last_airlock_uid == D.UID())
to_chat(user, "<span class='notice'>You recognize [D] and look for the key you used...</span>")
if(H.mind.assigned_role == "Janitor" && last_airlock_uid == target.UID())
to_chat(user, "<span class='notice'>You recognize [target] and look for the key you used...</span>")
hack_speed = 5 SECONDS
else
to_chat(user, "<span class='notice'>You fiddle with [src], trying different keys to open [D]...</span>")
to_chat(user, "<span class='notice'>You fiddle with [src], trying different keys to open [target]...</span>")
if(H.mind.assigned_role != "Janitor")
hack_speed = rand(30, 60) SECONDS
else
hack_speed = rand(5, 20) SECONDS
playsound(src, 'sound/items/keyring_unlock.ogg', 50)
if(do_after(user, hack_speed, target = D, progress = 0))
if(D.check_access(ID))
last_airlock_uid = D.UID()
. = ..()
if(do_after(user, hack_speed, target = target, progress = 0))
if(target.check_access(ID))
last_airlock_uid = target.UID()
busy = FALSE
return TRUE
busy = FALSE

/obj/item/door_remote/janikeyring/access_airlock(obj/machinery/door/airlock/D, mob/user)
if(HAS_TRAIT(D, TRAIT_CMAGGED))
to_chat(user, "<span class='danger'>[src] won't fit in the [D] airlock's access panel, there's slime everywhere!</span>")
return

if(D.is_special)
to_chat(user, "<span class='danger'>[src] cannot fit in the [D] airlock's access panel!</span>")
return

if(!D.arePowerSystemsOn())
to_chat(user, "<span class='danger'>The [D] airlock has no power!</span>")
return
Expand Down
Loading