Merge remote-tracking branch 'refs/remotes/origin/master' into syntheticbloods
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
/datum/component/bouncy
|
||||
dupe_mode = COMPONENT_DUPE_UNIQUE_PASSARGS
|
||||
var/bouncy_mod = 1
|
||||
var/list/bounce_signals = list(COMSIG_MOVABLE_IMPACT, COMSIG_ITEM_HIT_REACT, COMSIG_ITEM_ATTACK)
|
||||
|
||||
/datum/component/bouncy/Initialize(_bouncy_mod, list/_bounce_signals)
|
||||
if(!ismovableatom(parent))
|
||||
return COMPONENT_INCOMPATIBLE
|
||||
if(_bouncy_mod)
|
||||
bouncy_mod = _bouncy_mod
|
||||
if(_bounce_signals)
|
||||
bounce_signals = _bounce_signals
|
||||
|
||||
/datum/component/bouncy/InheritComponent(datum/component/bouncy/B, original, _bouncy_mod, list/_bounce_signals)
|
||||
if(_bouncy_mod)
|
||||
bouncy_mod = max(bouncy_mod, _bouncy_mod)
|
||||
if(_bounce_signals)
|
||||
var/list/diff_bounces = difflist(bounce_signals, _bounce_signals, TRUE)
|
||||
for(var/bounce in diff_bounces)
|
||||
bounce_signals += bounce
|
||||
RegisterSignal(parent, bounce, .proc/bounce_up)
|
||||
|
||||
/datum/component/bouncy/RegisterWithParent()
|
||||
RegisterSignal(parent, bounce_signals, .proc/bounce_up)
|
||||
|
||||
/datum/component/bouncy/UnregisterFromParent()
|
||||
UnregisterSignal(parent, bounce_signals)
|
||||
|
||||
/datum/component/bouncy/proc/bounce_up(datum/source)
|
||||
var/atom/movable/A = parent
|
||||
switch(rand(1, 3))
|
||||
if(1)
|
||||
A.do_jiggle(45 + rand(-10, 10) * bouncy_mod, 14)
|
||||
if(2)
|
||||
var/min_b = 0.6/bouncy_mod
|
||||
var/max_b = 1.2 * bouncy_mod
|
||||
A.do_squish(rand(min_b, max_b), rand(min_b, max_b), 14)
|
||||
if(3)
|
||||
var/pixelshift = 8 * bouncy_mod
|
||||
A.Shake(pixelshift, pixelshift, duration = 15)
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
if(ishuman(AM))
|
||||
var/mob/living/carbon/human/H = AM
|
||||
if(H.has_trait(TRAIT_PIERCEIMMUNE))
|
||||
if(HAS_TRAIT(H, TRAIT_PIERCEIMMUNE))
|
||||
return
|
||||
|
||||
if((flags & CALTROP_IGNORE_WALKERS) && H.m_intent == MOVE_INTENT_WALK)
|
||||
@@ -46,7 +46,7 @@
|
||||
return
|
||||
|
||||
var/damage = rand(min_damage, max_damage)
|
||||
if(H.has_trait(TRAIT_LIGHT_STEP))
|
||||
if(HAS_TRAIT(H, TRAIT_LIGHT_STEP))
|
||||
damage *= 0.75
|
||||
H.apply_damage(damage, BRUTE, picked_def_zone)
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
if (!wearer)
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
return
|
||||
if(!wearer.has_trait(TRAIT_DEAF))
|
||||
if(!HAS_TRAIT(wearer, TRAIT_DEAF))
|
||||
var/obj/item/organ/ears/ears = wearer.getorganslot(ORGAN_SLOT_EARS)
|
||||
if (ears)
|
||||
ears.deaf = max(ears.deaf - 1, (ears.ear_damage < UNHEALING_EAR_DAMAGE ? 0 : 1)) // Do not clear deafness while above the unhealing ear damage threshold
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
/datum/component/mood/Initialize()
|
||||
if(!isliving(parent))
|
||||
return COMPONENT_INCOMPATIBLE
|
||||
|
||||
|
||||
START_PROCESSING(SSmood, src)
|
||||
|
||||
RegisterSignal(parent, COMSIG_ADD_MOOD_EVENT, .proc/add_event)
|
||||
@@ -150,17 +150,17 @@
|
||||
else
|
||||
owner.crit_threshold -= (holdmyinsanityeffect - insanity_effect)
|
||||
|
||||
if(owner.has_trait(TRAIT_DEPRESSION))
|
||||
if(HAS_TRAIT(owner, TRAIT_DEPRESSION))
|
||||
if(prob(0.05))
|
||||
add_event(null, "depression", /datum/mood_event/depression)
|
||||
clear_event(null, "jolly")
|
||||
if(owner.has_trait(TRAIT_JOLLY))
|
||||
if(HAS_TRAIT(owner, TRAIT_JOLLY))
|
||||
if(prob(0.05))
|
||||
add_event(null, "jolly", /datum/mood_event/jolly)
|
||||
clear_event(null, "depression")
|
||||
|
||||
holdmyinsanityeffect = insanity_effect
|
||||
|
||||
|
||||
HandleNutrition(owner)
|
||||
|
||||
/datum/component/mood/proc/DecreaseSanity(amount, minimum = SANITY_INSANE)
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
dupe_mode = COMPONENT_DUPE_UNIQUE_PASSARGS
|
||||
|
||||
var/mob/living/host_mob
|
||||
var/nanite_volume = 100 //amount of nanites in the system, used as fuel for nanite programs
|
||||
var/max_nanites = 500 //maximum amount of nanites in the system
|
||||
var/nanite_volume = 50 //amount of nanites in the system, used as fuel for nanite programs
|
||||
var/max_nanites = 250 //maximum amount of nanites in the system
|
||||
var/regen_rate = 0.5 //nanites generated per second
|
||||
var/safety_threshold = 50 //how low nanites will get before they stop processing/triggering
|
||||
var/safety_threshold = 25 //how low nanites will get before they stop processing/triggering
|
||||
var/cloud_id = 0 //0 if not connected to the cloud, 1-100 to set a determined cloud backup to draw from
|
||||
var/next_sync = 0
|
||||
var/list/datum/nanite_program/programs = list()
|
||||
@@ -46,9 +46,9 @@
|
||||
RegisterSignal(parent, COMSIG_NANITE_ADD_PROGRAM, .proc/add_program)
|
||||
RegisterSignal(parent, COMSIG_NANITE_SCAN, .proc/nanite_scan)
|
||||
RegisterSignal(parent, COMSIG_NANITE_SYNC, .proc/sync)
|
||||
RegisterSignal(parent, COMSIG_ATOM_EMP_ACT, .proc/on_emp)
|
||||
|
||||
if(isliving(parent))
|
||||
RegisterSignal(parent, COMSIG_ATOM_EMP_ACT, .proc/on_emp)
|
||||
RegisterSignal(parent, COMSIG_MOB_DEATH, .proc/on_death)
|
||||
RegisterSignal(parent, COMSIG_MOB_ALLOWED, .proc/check_access)
|
||||
RegisterSignal(parent, COMSIG_LIVING_ELECTROCUTE_ACT, .proc/on_shock)
|
||||
@@ -169,23 +169,19 @@
|
||||
holder.icon_state = "nanites[nanite_percent]"
|
||||
|
||||
/datum/component/nanites/proc/on_emp(datum/source, severity)
|
||||
nanite_volume *= (rand(0.60, 0.90)) //Lose 10-40% of nanites
|
||||
adjust_nanites(null, -(rand(5, 50))) //Lose 5-50 flat nanite volume
|
||||
if(prob(40/severity))
|
||||
cloud_id = 0
|
||||
adjust_nanites(null, -(nanite_volume * 0.3 + 50)) //Lose 30% variable and 50 flat nanite volume.
|
||||
for(var/X in programs)
|
||||
var/datum/nanite_program/NP = X
|
||||
NP.on_emp(severity)
|
||||
|
||||
/datum/component/nanites/proc/on_shock(datum/source, shock_damage)
|
||||
nanite_volume *= (rand(0.45, 0.80)) //Lose 20-55% of nanites
|
||||
adjust_nanites(null, -(rand(5, 50))) //Lose 5-50 flat nanite volume
|
||||
adjust_nanites(null, -(nanite_volume * (shock_damage * 0.005) + shock_damage)) //0.5% of shock damage (@ 50 damage it'd drain 25%) + shock damage flat volume
|
||||
for(var/X in programs)
|
||||
var/datum/nanite_program/NP = X
|
||||
NP.on_shock(shock_damage)
|
||||
|
||||
/datum/component/nanites/proc/on_minor_shock(datum/source)
|
||||
adjust_nanites(null, -(rand(5, 15))) //Lose 5-15 flat nanite volume
|
||||
adjust_nanites(null, -25)
|
||||
for(var/X in programs)
|
||||
var/datum/nanite_program/NP = X
|
||||
NP.on_minor_shock()
|
||||
@@ -311,4 +307,4 @@
|
||||
mob_program["trigger_code"] = P.trigger_code
|
||||
id++
|
||||
mob_programs += list(mob_program)
|
||||
data["mob_programs"] = mob_programs
|
||||
data["mob_programs"] = mob_programs
|
||||
|
||||
@@ -0,0 +1,156 @@
|
||||
/datum/component/orbiter
|
||||
dupe_mode = COMPONENT_DUPE_UNIQUE_PASSARGS
|
||||
var/list/orbiters
|
||||
var/datum/callback/orbiter_spy
|
||||
var/datum/callback/orbited_spy
|
||||
|
||||
//radius: range to orbit at, radius of the circle formed by orbiting (in pixels)
|
||||
//clockwise: whether you orbit clockwise or anti clockwise
|
||||
//rotation_speed: how fast to rotate (how many ds should it take for a rotation to complete)
|
||||
//rotation_segments: the resolution of the orbit circle, less = a more block circle, this can be used to produce hexagons (6 segments) triangles (3 segments), and so on, 36 is the best default.
|
||||
//pre_rotation: Chooses to rotate src 90 degress towards the orbit dir (clockwise/anticlockwise), useful for things to go "head first" like ghosts
|
||||
/datum/component/orbiter/Initialize(atom/movable/orbiter, radius, clockwise, rotation_speed, rotation_segments, pre_rotation)
|
||||
if(!istype(orbiter) || !isatom(parent) || isarea(parent))
|
||||
return COMPONENT_INCOMPATIBLE
|
||||
|
||||
orbiters = list()
|
||||
orbiter_spy = CALLBACK(src, .proc/orbiter_move_react)
|
||||
orbited_spy = CALLBACK(src, .proc/move_react)
|
||||
|
||||
var/atom/master = parent
|
||||
master.orbiters = src
|
||||
|
||||
begin_orbit(orbiter, radius, clockwise, rotation_speed, rotation_segments, pre_rotation)
|
||||
|
||||
/datum/component/orbiter/RegisterWithParent()
|
||||
var/atom/target = parent
|
||||
while(ismovableatom(target))
|
||||
RegisterSignal(target, COMSIG_MOVABLE_MOVED, orbited_spy)
|
||||
target = target.loc
|
||||
|
||||
/datum/component/orbiter/UnregisterFromParent()
|
||||
var/atom/target = parent
|
||||
while(ismovableatom(target))
|
||||
UnregisterSignal(target, COMSIG_MOVABLE_MOVED)
|
||||
target = target.loc
|
||||
|
||||
/datum/component/orbiter/Destroy()
|
||||
var/atom/master = parent
|
||||
master.orbiters = null
|
||||
for(var/i in orbiters)
|
||||
end_orbit(i)
|
||||
orbiters = null
|
||||
QDEL_NULL(orbiter_spy)
|
||||
QDEL_NULL(orbited_spy)
|
||||
return ..()
|
||||
|
||||
/datum/component/orbiter/InheritComponent(datum/component/orbiter/newcomp, original, list/arguments)
|
||||
if(arguments)
|
||||
begin_orbit(arglist(arguments))
|
||||
return
|
||||
// The following only happens on component transfers
|
||||
orbiters += newcomp.orbiters
|
||||
|
||||
/datum/component/orbiter/PostTransfer()
|
||||
if(!isatom(parent) || isarea(parent) || !get_turf(parent))
|
||||
return COMPONENT_INCOMPATIBLE
|
||||
move_react()
|
||||
|
||||
/datum/component/orbiter/proc/begin_orbit(atom/movable/orbiter, radius, clockwise, rotation_speed, rotation_segments, pre_rotation)
|
||||
if(orbiter.orbiting)
|
||||
if(orbiter.orbiting == src)
|
||||
orbiter.orbiting.end_orbit(orbiter, TRUE)
|
||||
else
|
||||
orbiter.orbiting.end_orbit(orbiter)
|
||||
orbiters[orbiter] = TRUE
|
||||
orbiter.orbiting = src
|
||||
RegisterSignal(orbiter, COMSIG_MOVABLE_MOVED, orbiter_spy)
|
||||
var/matrix/initial_transform = matrix(orbiter.transform)
|
||||
|
||||
// Head first!
|
||||
if(pre_rotation)
|
||||
var/matrix/M = matrix(orbiter.transform)
|
||||
var/pre_rot = 90
|
||||
if(!clockwise)
|
||||
pre_rot = -90
|
||||
M.Turn(pre_rot)
|
||||
orbiter.transform = M
|
||||
|
||||
var/matrix/shift = matrix(orbiter.transform)
|
||||
shift.Translate(0, radius)
|
||||
orbiter.transform = shift
|
||||
|
||||
orbiter.SpinAnimation(rotation_speed, -1, clockwise, rotation_segments, parallel = FALSE)
|
||||
|
||||
//we stack the orbits up client side, so we can assign this back to normal server side without it breaking the orbit
|
||||
orbiter.transform = initial_transform
|
||||
orbiter.forceMove(get_turf(parent))
|
||||
to_chat(orbiter, "<span class='notice'>Now orbiting [parent].</span>")
|
||||
|
||||
/datum/component/orbiter/proc/end_orbit(atom/movable/orbiter, refreshing=FALSE)
|
||||
if(!orbiters[orbiter])
|
||||
return
|
||||
UnregisterSignal(orbiter, COMSIG_MOVABLE_MOVED)
|
||||
orbiter.SpinAnimation(0, 0)
|
||||
orbiters -= orbiter
|
||||
orbiter.stop_orbit(src)
|
||||
orbiter.orbiting = null
|
||||
if(!refreshing && !length(orbiters) && !QDELING(src))
|
||||
qdel(src)
|
||||
|
||||
// This proc can receive signals by either the thing being directly orbited or anything holding it
|
||||
/datum/component/orbiter/proc/move_react(atom/orbited, atom/oldloc, direction)
|
||||
set waitfor = FALSE // Transfer calls this directly and it doesnt care if the ghosts arent done moving
|
||||
|
||||
var/atom/movable/master = parent
|
||||
if(master.loc == oldloc)
|
||||
return
|
||||
|
||||
var/turf/newturf = get_turf(master)
|
||||
if(!newturf)
|
||||
qdel(src)
|
||||
|
||||
// Handling the signals of stuff holding us (or not anymore)
|
||||
// These are prety rarely activated, how often are you following something in a bag?
|
||||
if(oldloc && !isturf(oldloc)) // We used to be registered to it, probably
|
||||
var/atom/target = oldloc
|
||||
while(ismovableatom(target))
|
||||
UnregisterSignal(target, COMSIG_MOVABLE_MOVED)
|
||||
target = target.loc
|
||||
if(orbited?.loc && orbited.loc != newturf) // We want to know when anything holding us moves too
|
||||
var/atom/target = orbited.loc
|
||||
while(ismovableatom(target))
|
||||
RegisterSignal(target, COMSIG_MOVABLE_MOVED, orbited_spy, TRUE)
|
||||
target = target.loc
|
||||
|
||||
var/atom/curloc = master.loc
|
||||
for(var/i in orbiters)
|
||||
var/atom/movable/thing = i
|
||||
if(QDELETED(thing) || thing.loc == newturf)
|
||||
continue
|
||||
thing.forceMove(newturf)
|
||||
if(CHECK_TICK && master.loc != curloc)
|
||||
// We moved again during the checktick, cancel current operation
|
||||
break
|
||||
|
||||
|
||||
/datum/component/orbiter/proc/orbiter_move_react(atom/movable/orbiter, atom/oldloc, direction)
|
||||
if(orbiter.loc == get_turf(parent))
|
||||
return
|
||||
end_orbit(orbiter)
|
||||
|
||||
/////////////////////
|
||||
|
||||
/atom/movable/proc/orbit(atom/A, radius = 10, clockwise = FALSE, rotation_speed = 20, rotation_segments = 36, pre_rotation = TRUE)
|
||||
if(!istype(A) || !get_turf(A) || A == src)
|
||||
return
|
||||
|
||||
return A.AddComponent(/datum/component/orbiter, src, radius, clockwise, rotation_speed, rotation_segments, pre_rotation)
|
||||
|
||||
/atom/movable/proc/stop_orbit(datum/component/orbiter/orbits)
|
||||
return // We're just a simple hook
|
||||
|
||||
/atom/proc/transfer_observers_to(atom/target)
|
||||
if(!orbiters || !istype(target) || !get_turf(target) || target == src)
|
||||
return
|
||||
target.TakeComponent(orbiters)
|
||||
@@ -27,7 +27,7 @@
|
||||
C.stuttering = 20
|
||||
if((!istype(H.dna.species, /datum/species/skeleton)) && (!istype(H.dna.species, /datum/species/golem)) && (!istype(H.dna.species, /datum/species/android)) && (!istype(H.dna.species, /datum/species/jelly)))
|
||||
C.adjustStaminaLoss(25) //boneless humanoids don't lose the will to live
|
||||
to_chat(C, "<font color='red' size='4'><B>DOOT</B></span>")
|
||||
to_chat(C, "<font color='red' size='4'><B>DOOT</B></font>")
|
||||
spectral_change(H)
|
||||
|
||||
else //the sound will spook monkeys.
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
can_transfer = TRUE
|
||||
var/drop_all_on_deconstruct = TRUE
|
||||
var/drop_all_on_destroy = FALSE
|
||||
var/drop_all_on_break = FALSE
|
||||
var/unlock_on_break = FALSE
|
||||
var/transfer_contents_on_component_transfer = FALSE
|
||||
var/list/datum/component/storage/slaves = list()
|
||||
|
||||
@@ -17,6 +19,7 @@
|
||||
. = ..()
|
||||
RegisterSignal(parent, COMSIG_ATOM_CONTENTS_DEL, .proc/on_contents_del)
|
||||
RegisterSignal(parent, COMSIG_OBJ_DECONSTRUCT, .proc/on_deconstruct)
|
||||
RegisterSignal(parent, COMSIG_OBJ_BREAK, .proc/on_break)
|
||||
|
||||
/datum/component/storage/concrete/Destroy()
|
||||
var/atom/real_location = real_location()
|
||||
@@ -101,6 +104,12 @@
|
||||
if(drop_all_on_deconstruct)
|
||||
do_quick_empty()
|
||||
|
||||
/datum/component/storage/concrete/proc/on_break(datum/source, damage_flag)
|
||||
if(drop_all_on_break)
|
||||
do_quick_empty()
|
||||
if(unlock_on_break)
|
||||
set_locked(source, FALSE)
|
||||
|
||||
/datum/component/storage/concrete/can_see_contents()
|
||||
. = ..()
|
||||
for(var/i in slaves)
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
/datum/component/storage/concrete/emergency
|
||||
drop_all_on_break = TRUE
|
||||
unlock_on_break = TRUE
|
||||
locked = TRUE
|
||||
|
||||
/datum/component/storage/concrete/emergency/Initialize()
|
||||
. = ..()
|
||||
RegisterSignal(parent, COMSIG_ATOM_EMAG_ACT, .proc/unlock_me)
|
||||
|
||||
/datum/component/storage/concrete/emergency/on_attack_hand(datum/source, mob/user)
|
||||
var/atom/A = parent
|
||||
if(!attack_hand_interact)
|
||||
return
|
||||
if(user.active_storage == src && A.loc == user) //if you're already looking inside the storage item
|
||||
user.active_storage.close(user)
|
||||
close(user)
|
||||
. = COMPONENT_NO_ATTACK_HAND
|
||||
return
|
||||
. = COMPONENT_NO_ATTACK_HAND
|
||||
if(!check_locked(source, user, TRUE))
|
||||
show_to(user)
|
||||
A.do_jiggle()
|
||||
if(rustle_sound)
|
||||
playsound(A, "rustle", 50, 1, -5)
|
||||
|
||||
/datum/component/storage/concrete/emergency/signal_insertion_attempt(datum/source, obj/item/I, mob/M, silent = FALSE, force = FALSE)
|
||||
if(!silent && istype(I, /obj/item/card/emag))
|
||||
silent = TRUE // suppresses the message
|
||||
return ..()
|
||||
|
||||
/datum/component/storage/concrete/emergency/check_locked(datum/source, mob/user, message = FALSE)
|
||||
. = locked && GLOB.security_level < SEC_LEVEL_RED
|
||||
if(message && . && user)
|
||||
to_chat(user, "The storage unit will only unlock during a Red or Delta security alert.")
|
||||
|
||||
/datum/component/storage/concrete/emergency/proc/unlock_me(datum/source)
|
||||
if(locked)
|
||||
set_locked(source, FALSE)
|
||||
@@ -156,8 +156,7 @@
|
||||
next += slave.parent
|
||||
|
||||
/datum/component/storage/proc/attack_self(datum/source, mob/M)
|
||||
if(locked)
|
||||
to_chat(M, "<span class='warning'>[parent] seems to be locked!</span>")
|
||||
if(check_locked(source, M, TRUE))
|
||||
return FALSE
|
||||
if((M.get_active_held_item() == parent) && allow_quick_empty)
|
||||
quick_empty(M)
|
||||
@@ -166,8 +165,7 @@
|
||||
if(!isitem(O) || !click_gather || SEND_SIGNAL(O, COMSIG_CONTAINS_STORAGE))
|
||||
return FALSE
|
||||
. = COMPONENT_NO_ATTACK
|
||||
if(locked)
|
||||
to_chat(M, "<span class='warning'>[parent] seems to be locked!</span>")
|
||||
if(check_locked(source, M, TRUE))
|
||||
return FALSE
|
||||
var/atom/A = parent
|
||||
var/obj/item/I = O
|
||||
@@ -238,8 +236,7 @@
|
||||
var/atom/A = parent
|
||||
if((!ishuman(M) && (A.loc != M)) || (M.stat != CONSCIOUS) || M.restrained() || !M.canmove)
|
||||
return
|
||||
if(locked)
|
||||
to_chat(M, "<span class='warning'>[parent] seems to be locked!</span>")
|
||||
if(check_locked(null, M, TRUE))
|
||||
return FALSE
|
||||
A.add_fingerprint(M)
|
||||
to_chat(M, "<span class='notice'>You start dumping out [parent].</span>")
|
||||
@@ -281,7 +278,7 @@
|
||||
|
||||
/datum/component/storage/proc/set_locked(datum/source, new_state)
|
||||
locked = new_state
|
||||
if(locked)
|
||||
if(check_locked())
|
||||
close_all()
|
||||
|
||||
/datum/component/storage/proc/_process_numerical_display()
|
||||
@@ -456,8 +453,7 @@
|
||||
var/atom/A = parent
|
||||
var/atom/dump_destination = dest_object.get_dumping_location()
|
||||
if(A.Adjacent(M) && dump_destination && M.Adjacent(dump_destination))
|
||||
if(locked)
|
||||
to_chat(M, "<span class='warning'>[parent] seems to be locked!</span>")
|
||||
if(check_locked(null, M, TRUE))
|
||||
return FALSE
|
||||
if(dump_destination.storage_contents_dump_act(src, M))
|
||||
playsound(A, "rustle", 50, 1, -5)
|
||||
@@ -535,11 +531,9 @@
|
||||
if(!istype(M))
|
||||
return FALSE
|
||||
A.add_fingerprint(M)
|
||||
if(locked && !force)
|
||||
to_chat(M, "<span class='warning'>[parent] seems to be locked!</span>")
|
||||
if(!force && (check_locked(null, M) || !M.CanReach(parent, view_only = TRUE)))
|
||||
return FALSE
|
||||
if(force || M.CanReach(parent, view_only = TRUE))
|
||||
show_to(M)
|
||||
show_to(M)
|
||||
|
||||
/datum/component/storage/proc/mousedrop_receive(datum/source, atom/movable/O, mob/M)
|
||||
if(isitem(O))
|
||||
@@ -563,10 +557,9 @@
|
||||
var/atom/host = parent
|
||||
if(real_location == I.loc)
|
||||
return FALSE //Means the item is already in the storage item
|
||||
if(locked)
|
||||
if(check_locked(null, M, !stop_messages))
|
||||
if(M && !stop_messages)
|
||||
host.add_fingerprint(M)
|
||||
to_chat(M, "<span class='warning'>[host] seems to be locked!</span>")
|
||||
return FALSE
|
||||
if(real_location.contents.len >= max_items)
|
||||
if(!stop_messages)
|
||||
@@ -599,7 +592,7 @@
|
||||
if(!stop_messages)
|
||||
to_chat(M, "<span class='warning'>[IP] cannot hold [I] as it's a storage item of the same size!</span>")
|
||||
return FALSE //To prevent the stacking of same sized storage items.
|
||||
if(I.item_flags & NODROP) //SHOULD be handled in unEquip, but better safe than sorry.
|
||||
if(HAS_TRAIT(I, TRAIT_NODROP)) //SHOULD be handled in unEquip, but better safe than sorry.
|
||||
to_chat(M, "<span class='warning'>\the [I] is stuck to your hand, you can't put it in \the [host]!</span>")
|
||||
return FALSE
|
||||
var/datum/component/storage/concrete/master = master()
|
||||
@@ -659,8 +652,10 @@
|
||||
/datum/component/storage/proc/on_check()
|
||||
return TRUE
|
||||
|
||||
/datum/component/storage/proc/check_locked()
|
||||
return locked
|
||||
/datum/component/storage/proc/check_locked(datum/source, mob/user, message = FALSE)
|
||||
. = locked
|
||||
if(message && . && user)
|
||||
to_chat(user, "<span class='warning'>[parent] seems to be locked!</span>")
|
||||
|
||||
/datum/component/storage/proc/signal_take_type(datum/source, type, atom/destination, amount = INFINITY, check_adjacent = FALSE, force = FALSE, mob/user, list/inserted)
|
||||
if(!force)
|
||||
@@ -720,9 +715,7 @@
|
||||
|
||||
if(A.loc == user)
|
||||
. = COMPONENT_NO_ATTACK_HAND
|
||||
if(locked)
|
||||
to_chat(user, "<span class='warning'>[parent] seems to be locked!</span>")
|
||||
else
|
||||
if(!check_locked(source, user, TRUE))
|
||||
show_to(user)
|
||||
A.do_jiggle()
|
||||
|
||||
@@ -747,15 +740,15 @@
|
||||
/datum/component/storage/proc/on_alt_click(datum/source, mob/user)
|
||||
if(!isliving(user) || !user.CanReach(parent))
|
||||
return
|
||||
if(locked)
|
||||
to_chat(user, "<span class='warning'>[parent] seems to be locked!</span>")
|
||||
if(check_locked(source, user, TRUE))
|
||||
return
|
||||
|
||||
var/atom/A = parent
|
||||
if(!quickdraw)
|
||||
A.add_fingerprint(user)
|
||||
user_show_to_mob(user)
|
||||
playsound(A, "rustle", 50, 1, -5)
|
||||
if(rustle_sound)
|
||||
playsound(A, "rustle", 50, 1, -5)
|
||||
return
|
||||
|
||||
if(!user.incapacitated())
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user