Merge pull request #10596 from Seris02/hijackbackup

Hijack Implant
This commit is contained in:
kevinz000
2020-02-10 04:16:14 -07:00
committed by GitHub
76 changed files with 539 additions and 153 deletions
+3 -3
View File
@@ -721,7 +721,7 @@ GLOBAL_LIST_EMPTY(PDAs)
return
/obj/item/pda/proc/remove_id(mob/user)
if(issilicon(user) || !user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
if(hasSiliconAccessInArea(user) || !user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
return
do_remove_id(user)
@@ -916,7 +916,7 @@ GLOBAL_LIST_EMPTY(PDAs)
remove_pen()
/obj/item/pda/proc/toggle_light()
if(issilicon(usr) || !usr.canUseTopic(src, BE_CLOSE))
if(hasSiliconAccessInArea(usr) || !usr.canUseTopic(src, BE_CLOSE))
return
if(fon)
fon = FALSE
@@ -928,7 +928,7 @@ GLOBAL_LIST_EMPTY(PDAs)
/obj/item/pda/proc/remove_pen()
if(issilicon(usr) || !usr.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
if(hasSiliconAccessInArea(usr) || !usr.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
return
if(inserted_item)
+1 -1
View File
@@ -609,7 +609,7 @@ Code:
/obj/item/cartridge/Topic(href, href_list)
..()
if(!usr.canUseTopic(src, !issilicon(usr)))
if(!usr.canUseTopic(src, !hasSiliconAccessInArea(usr)))
usr.unset_machine()
usr << browse(null, "window=pda")
return
@@ -0,0 +1,121 @@
#define HIJACK_APC_MAX_AMOUNT 5
/obj/item/implant/hijack
name = "hijack implant"
desc = "Allows you to control the machinery in a room by hacking into the APC."
actions_types = list(/datum/action/item_action/hands_free/activate, /datum/action/item_action/removeAPCs, /datum/action/item_action/accessAPCs, /datum/action/item_action/stealthmodetoggle)
activated = 1
var/toggled = FALSE
icon_state = "hijack"
var/eye_color
var/stealthmode = FALSE
var/stealthcooldown = 0
var/hijacking = FALSE
/obj/item/implant/hijack/activate()
. = ..()
toggled = !toggled
imp_in.click_intercept = toggled ? src : null
imp_in.siliconaccesstoggle = toggled ? TRUE : FALSE
to_chat(imp_in,"<span class='notice'>You turn [toggled ? "on" : "off"] [src]'s silicon interactions.</span>")
toggle_eyes()
/obj/item/implant/hijack/proc/toggle_eyes()
if (!ishuman(imp_in))
return
var/on = toggled && !stealthmode
var/mob/living/carbon/human/H = imp_in
H.eye_color = on ? "ff0" : eye_color
H.dna.update_ui_block(DNA_EYE_COLOR_BLOCK)
H.update_body()
/obj/item/implant/hijack/implant(mob/living/target, mob/user, silent = FALSE)
if(..())
ADD_TRAIT(target, TRAIT_HIJACKER, "implant")
if (ishuman(target))
var/mob/living/carbon/human/H = target
eye_color = H.eye_color
return TRUE
/obj/item/implant/hijack/removed(mob/target, silent = FALSE, special = 0)
if(..())
REMOVE_TRAIT(target, TRAIT_HIJACKER, "implant")
for (var/area/area in imp_in.siliconaccessareas)
imp_in.toggleSiliconAccessArea(area)
var/obj/machinery/power/apc/apc = area.get_apc()
if (apc)
apc.hijacker = null
apc.set_hijacked_lighting()
apc.update_icon()
if (ishuman(target))
var/mob/living/carbon/human/H = target
H.eye_color = eye_color
return TRUE
/obj/item/implant/hijack/proc/InterceptClickOn(mob/living/user,params,atom/object)
if (isitem(object) || !toggled || user.incapacitated())
return
if (stealthmode == FALSE && istype(object,/obj/machinery/power/apc) && !user.CanReach(object))
if (hijack_remotely(object))
return
if (stealthmode && !user.CanReach(object))
return
if (!object.hasSiliconAccessInArea(imp_in))
return
var/list/modifiers = params2list(params)
imp_in.face_atom(object)
if (modifiers["shift"] && modifiers["ctrl"])
object.AICtrlShiftClick(imp_in)
return TRUE
if (modifiers["shift"])
object.AIShiftClick(imp_in)
return TRUE
if (modifiers["ctrl"])
object.AICtrlClick(imp_in)
return TRUE
if (modifiers["alt"])
object.AIAltClick(imp_in)
return TRUE
if (user.get_active_held_item())
return
if (user.CanReach(object))
object.attack_robot(imp_in)
else
object.attack_ai(imp_in)
return TRUE
/obj/item/implant/hijack/proc/hijack_remotely(obj/machinery/power/apc/apc)
if (apc.hijacker || hijacking)
return FALSE //can't remotely hijack an already hijacked APC
hijacking = TRUE
to_chat(imp_in, "<span class='notice'>Establishing remote connection with APC.</span>")
if (!do_after(imp_in, 4 SECONDS,target=apc))
to_chat(imp_in, "<span class='warning'>Aborting.</span>")
hijacking = FALSE
return TRUE
if (LAZYLEN(imp_in.siliconaccessareas) >= HIJACK_APC_MAX_AMOUNT)
to_chat(src,"<span class='warning'>You are connected to too many APCs! Too many more will fry your brain.</span>")
hijacking = FALSE
return TRUE
imp_in.light_power = 2
imp_in.light_range = 2
imp_in.light_color = COLOR_YELLOW
imp_in.update_light()
imp_in.visible_message("<span class='warning'>[imp_in] starts glowing a with a hollow yellow light!</span>")
to_chat(imp_in, "<span class='notice'>Beginning hijack of APC.</span>")
if (do_after(imp_in, 21 SECONDS,target=apc))
apc.hijacker = imp_in
stealthmode = FALSE
apc.set_hijacked_lighting()
imp_in.toggleSiliconAccessArea(apc.area)
apc.update_icon()
stealthcooldown = world.time + 1 MINUTES + 30 SECONDS
toggle_eyes()
else
to_chat(imp_in, "<span class='warning'>Aborting.</span>")
hijacking = FALSE
imp_in.light_power = 0
imp_in.light_range = 0
imp_in.light_color = COLOR_YELLOW
imp_in.update_light()
return TRUE
@@ -74,4 +74,8 @@
/obj/item/implanter/stealth
name = "implanter (stealth)"
imp_type = /obj/item/implant/stealth
imp_type = /obj/item/implant/stealth
/obj/item/implanter/hijack
name = "implanter (hijack)"
imp_type = /obj/item/implant/hijack