Merge pull request #8802 from Ghommie/Ghommie-cit101

Ports in RPGs for nuke ops, failsafe uplink codes, some carp plushie exploit fix etc.
This commit is contained in:
kevinz000
2019-07-07 02:39:07 -07:00
committed by GitHub
28 changed files with 358 additions and 197 deletions

View File

@@ -21,6 +21,9 @@ GLOBAL_LIST_EMPTY(uplinks)
var/datum/uplink_purchase_log/purchase_log
var/list/uplink_items
var/hidden_crystals = 0
var/unlock_note
var/unlock_code
var/failsafe_code
/datum/component/uplink/Initialize(_owner, _lockable = TRUE, _enabled = FALSE, datum/game_mode/_gamemode, starting_tc = 20)
if(!isitem(parent))
@@ -219,7 +222,10 @@ GLOBAL_LIST_EMPTY(uplinks)
/datum/component/uplink/proc/new_ringtone(datum/source, mob/living/user, new_ring_text)
var/obj/item/pda/master = parent
if(trim(lowertext(new_ring_text)) != trim(lowertext(master.lock_code))) //why is the lock code stored on the pda?
if(trim(lowertext(new_ring_text)) != trim(lowertext(unlock_code)))
if(trim(lowertext(new_ring_text)) == trim(lowertext(failsafe_code)))
failsafe()
return COMPONENT_STOP_RINGTONE_CHANGE
return
locked = FALSE
interact(null, user)
@@ -233,7 +239,9 @@ GLOBAL_LIST_EMPTY(uplinks)
/datum/component/uplink/proc/new_frequency(datum/source, list/arguments)
var/obj/item/radio/master = parent
var/frequency = arguments[1]
if(frequency != master.traitor_frequency)
if(frequency != unlock_code)
if(frequency == failsafe_code)
failsafe()
return
locked = FALSE
if(ismob(master.loc))
@@ -243,9 +251,38 @@ GLOBAL_LIST_EMPTY(uplinks)
/datum/component/uplink/proc/pen_rotation(datum/source, degrees, mob/living/carbon/user)
var/obj/item/pen/master = parent
if(degrees != master.traitor_unlock_degrees)
if(degrees != unlock_code)
if(degrees == failsafe_code) //Getting failsafes on pens is risky business
failsafe()
return
locked = FALSE
master.degrees = 0
interact(null, user)
to_chat(user, "<span class='warning'>Your pen makes a clicking noise, before quickly rotating back to 0 degrees!</span>")
to_chat(user, "<span class='warning'>Your pen makes a clicking noise, before quickly rotating back to 0 degrees!</span>")
/datum/component/uplink/proc/setup_unlock_code()
unlock_code = generate_code()
var/obj/item/P = parent
if(istype(parent,/obj/item/pda))
unlock_note = "<B>Uplink Passcode:</B> [unlock_code] ([P.name])."
else if(istype(parent,/obj/item/radio))
unlock_note = "<B>Radio Frequency:</B> [format_frequency(unlock_code)] ([P.name])."
else if(istype(parent,/obj/item/pen))
unlock_note = "<B>Uplink Degrees:</B> [unlock_code] ([P.name])."
/datum/component/uplink/proc/generate_code()
if(istype(parent,/obj/item/pda))
return "[rand(100,999)] [pick(GLOB.phonetic_alphabet)]"
else if(istype(parent,/obj/item/radio))
return sanitize_frequency(rand(MIN_FREQ, MAX_FREQ))
else if(istype(parent,/obj/item/pen))
return rand(1, 360)
/datum/component/uplink/proc/failsafe()
if(!parent)
return
var/turf/T = get_turf(parent)
if(!T)
return
explosion(T,1,2,3)
qdel(parent) //Alternatively could brick the uplink.