mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-23 03:57:13 +01:00
Migrates door remotes to the new attack chain + fixes janikeyring (#27925)
* migrates door remotes + removes unused airlock var * remove janikey do_after bar * me stoopid * initializes + remove extra line --------- Co-authored-by: Toastical <toast@toaster.com>
This commit is contained in:
@@ -16,8 +16,10 @@
|
||||
var/additional_access = list()
|
||||
var/obj/item/card/id/ID
|
||||
|
||||
/obj/item/door_remote/New()
|
||||
..()
|
||||
new_attack_chain = TRUE
|
||||
|
||||
/obj/item/door_remote/Initialize(mapload)
|
||||
. = ..()
|
||||
ID = new /obj/item/card/id
|
||||
for(var/region in region_access)
|
||||
ID.access += get_region_accesses(region)
|
||||
@@ -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"),
|
||||
@@ -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
|
||||
@@ -184,10 +193,20 @@
|
||||
/// 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)
|
||||
@@ -195,9 +214,11 @@
|
||||
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"
|
||||
|
||||
@@ -224,41 +245,54 @@
|
||||
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/Initialize(mapload)
|
||||
. = ..()
|
||||
RegisterSignal(src, COMSIG_ACTIVATE_SELF, TYPE_PROC_REF(/datum, signal_cancel_activate_self))
|
||||
|
||||
/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)
|
||||
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)
|
||||
@@ -266,10 +300,6 @@
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user