Merge branch 'master' of https://github.com/Citadel-Station-13/Citadel-Station-13 into abductor-update
This commit is contained in:
@@ -53,7 +53,7 @@
|
||||
|
||||
// If you want/expect to be moving the component around between parents, use this to register on the parent for signals
|
||||
/datum/component/proc/RegisterWithParent()
|
||||
return
|
||||
SEND_SIGNAL(src, COMSIG_COMPONENT_REGISTER_PARENT) //CITADEL EDIT
|
||||
|
||||
/datum/component/proc/Initialize(...)
|
||||
return
|
||||
@@ -85,7 +85,7 @@
|
||||
UnregisterFromParent()
|
||||
|
||||
/datum/component/proc/UnregisterFromParent()
|
||||
return
|
||||
SEND_SIGNAL(src, COMSIG_COMPONENT_UNREGISTER_PARENT) //CITADEL EDIT
|
||||
|
||||
/datum/proc/RegisterSignal(datum/target, sig_type_or_types, proctype, override = FALSE)
|
||||
if(QDELETED(src) || QDELETED(target))
|
||||
|
||||
@@ -19,12 +19,14 @@
|
||||
src.damage_multiplier = damage_multiplier
|
||||
|
||||
/datum/component/bane/RegisterWithParent()
|
||||
. = ..()
|
||||
if(speciestype)
|
||||
RegisterSignal(parent, COMSIG_ITEM_AFTERATTACK, .proc/speciesCheck)
|
||||
else
|
||||
RegisterSignal(parent, COMSIG_ITEM_AFTERATTACK, .proc/mobCheck)
|
||||
|
||||
/datum/component/bane/UnregisterFromParent()
|
||||
. = ..()
|
||||
UnregisterSignal(parent, COMSIG_ITEM_AFTERATTACK)
|
||||
|
||||
/datum/component/bane/proc/speciesCheck(obj/item/source, atom/target, mob/user, proximity_flag, click_parameters)
|
||||
|
||||
@@ -21,9 +21,11 @@
|
||||
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)
|
||||
|
||||
@@ -23,17 +23,51 @@
|
||||
RegisterSignal(parent, COMSIG_ITEM_ATTACK, .proc/onItemAttack)
|
||||
|
||||
/datum/component/butchering/proc/onItemAttack(obj/item/source, mob/living/M, mob/living/user)
|
||||
if(user.a_intent == INTENT_HARM && M.stat == DEAD && (M.butcher_results || M.guaranteed_butcher_results)) //can we butcher it?
|
||||
if(user.a_intent != INTENT_HARM)
|
||||
return
|
||||
if(M.stat == DEAD && (M.butcher_results || M.guaranteed_butcher_results)) //can we butcher it?
|
||||
if(butchering_enabled && (can_be_blunt || source.get_sharpness()))
|
||||
INVOKE_ASYNC(src, .proc/startButcher, source, M, user)
|
||||
return COMPONENT_ITEM_NO_ATTACK
|
||||
|
||||
if(ishuman(M) && source.force && source.get_sharpness())
|
||||
var/mob/living/carbon/human/H = M
|
||||
if((H.health <= H.crit_threshold || (user.pulling == H && user.grab_state >= GRAB_NECK) || H.IsSleeping()) && user.zone_selected == BODY_ZONE_HEAD) // Only sleeping, neck grabbed, or crit, can be sliced.
|
||||
if(H.has_status_effect(/datum/status_effect/neck_slice))
|
||||
user.show_message("<span class='warning'>[H]'s neck has already been already cut, you can't make the bleeding any worse!</span>", 1, \
|
||||
"<span class='warning'>Their neck has already been already cut, you can't make the bleeding any worse!</span>")
|
||||
return COMPONENT_ITEM_NO_ATTACK
|
||||
INVOKE_ASYNC(src, .proc/startNeckSlice, source, H, user)
|
||||
return COMPONENT_ITEM_NO_ATTACK
|
||||
|
||||
/datum/component/butchering/proc/startButcher(obj/item/source, mob/living/M, mob/living/user)
|
||||
to_chat(user, "<span class='notice'>You begin to butcher [M]...</span>")
|
||||
playsound(M.loc, butcher_sound, 50, TRUE, -1)
|
||||
if(do_mob(user, M, speed) && M.Adjacent(source))
|
||||
Butcher(user, M)
|
||||
|
||||
/datum/component/butchering/proc/startNeckSlice(obj/item/source, mob/living/carbon/human/H, mob/living/user)
|
||||
user.visible_message("<span class='danger'>[user] is slitting [H]'s throat!</span>", \
|
||||
"<span class='danger'>You start slicing [H]'s throat!</span>", \
|
||||
"<span class='notice'>You hear a cutting noise!</span>", ignored_mobs = H)
|
||||
H.show_message("<span class='userdanger'>Your throat is being slit by [user]!</span>", 1, \
|
||||
"<span class = 'userdanger'>Something is cutting into your neck!</span>", NONE)
|
||||
log_combat(user, H, "starts slicing the throat of")
|
||||
|
||||
playsound(H.loc, butcher_sound, 50, TRUE, -1)
|
||||
if(do_mob(user, H, CLAMP(500 / source.force, 30, 100)) && H.Adjacent(source))
|
||||
if(H.has_status_effect(/datum/status_effect/neck_slice))
|
||||
user.show_message("<span class='warning'>[H]'s neck has already been already cut, you can't make the bleeding any worse!</span>", 1, \
|
||||
"<span class='warning'>Their neck has already been already cut, you can't make the bleeding any worse!</span>")
|
||||
return
|
||||
|
||||
H.visible_message("<span class='danger'>[user] slits [H]'s throat!</span>", \
|
||||
"<span class='userdanger'>[user] slits your throat...</span>")
|
||||
log_combat(user, H, "finishes slicing the throat of")
|
||||
H.apply_damage(source.force, BRUTE, BODY_ZONE_HEAD)
|
||||
H.bleed_rate = CLAMP(H.bleed_rate + 20, 0, 30)
|
||||
H.apply_status_effect(/datum/status_effect/neck_slice)
|
||||
|
||||
/datum/component/butchering/proc/Butcher(mob/living/butcher, mob/living/meat)
|
||||
var/turf/T = meat.drop_location()
|
||||
var/final_effectiveness = effectiveness - meat.butcher_difficulty
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
apply()
|
||||
|
||||
/datum/component/decal/RegisterWithParent()
|
||||
. = ..()
|
||||
if(first_dir)
|
||||
RegisterSignal(parent, COMSIG_ATOM_DIR_CHANGE, .proc/rotate_react)
|
||||
if(cleanable)
|
||||
@@ -25,6 +26,7 @@
|
||||
RegisterSignal(parent, COMSIG_PARENT_EXAMINE, .proc/examine)
|
||||
|
||||
/datum/component/decal/UnregisterFromParent()
|
||||
. = ..()
|
||||
UnregisterSignal(parent, list(COMSIG_ATOM_DIR_CHANGE, COMSIG_COMPONENT_CLEAN_ACT, COMSIG_PARENT_EXAMINE))
|
||||
|
||||
/datum/component/decal/Destroy()
|
||||
|
||||
@@ -30,11 +30,13 @@
|
||||
return ..()
|
||||
|
||||
/datum/component/fantasy/RegisterWithParent()
|
||||
. = ..()
|
||||
var/obj/item/master = parent
|
||||
originalName = master.name
|
||||
modify()
|
||||
|
||||
/datum/component/fantasy/UnregisterFromParent()
|
||||
. = ..()
|
||||
unmodify()
|
||||
|
||||
/datum/component/fantasy/InheritComponent(datum/component/fantasy/newComp, original, list/arguments)
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
src.fire_stacks = fire_stacks
|
||||
|
||||
/datum/component/igniter/RegisterWithParent()
|
||||
. = ..()
|
||||
if(ismachinery(parent) || isstructure(parent) || isgun(parent)) // turrets, etc
|
||||
RegisterSignal(parent, COMSIG_PROJECTILE_ON_HIT, .proc/projectile_hit)
|
||||
else if(isitem(parent))
|
||||
@@ -17,6 +18,7 @@
|
||||
RegisterSignal(parent, COMSIG_HOSTILE_ATTACKINGTARGET, .proc/hostile_attackingtarget)
|
||||
|
||||
/datum/component/igniter/UnregisterFromParent()
|
||||
. = ..()
|
||||
UnregisterSignal(parent, list(COMSIG_ITEM_AFTERATTACK, COMSIG_HOSTILE_ATTACKINGTARGET, COMSIG_PROJECTILE_ON_HIT))
|
||||
|
||||
/datum/component/igniter/proc/item_afterattack(obj/item/source, atom/target, mob/user, proximity_flag, click_parameters)
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
src.throw_anchored = throw_anchored
|
||||
|
||||
/datum/component/knockback/RegisterWithParent()
|
||||
. = ..()
|
||||
if(ismachinery(parent) || isstructure(parent) || isgun(parent)) // turrets, etc
|
||||
RegisterSignal(parent, COMSIG_PROJECTILE_ON_HIT, .proc/projectile_hit)
|
||||
else if(isitem(parent))
|
||||
@@ -18,6 +19,7 @@
|
||||
RegisterSignal(parent, COMSIG_HOSTILE_ATTACKINGTARGET, .proc/hostile_attackingtarget)
|
||||
|
||||
/datum/component/knockback/UnregisterFromParent()
|
||||
. = ..()
|
||||
UnregisterSignal(parent, list(COMSIG_ITEM_AFTERATTACK, COMSIG_HOSTILE_ATTACKINGTARGET, COMSIG_PROJECTILE_ON_HIT))
|
||||
|
||||
/datum/component/knockback/proc/item_afterattack(obj/item/source, atom/target, mob/user, proximity_flag, click_parameters)
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
src.flat_heal = flat_heal
|
||||
|
||||
/datum/component/lifesteal/RegisterWithParent()
|
||||
. = ..()
|
||||
if(isgun(parent))
|
||||
RegisterSignal(parent, COMSIG_PROJECTILE_ON_HIT, .proc/projectile_hit)
|
||||
else if(isitem(parent))
|
||||
@@ -18,6 +19,7 @@
|
||||
RegisterSignal(parent, COMSIG_HOSTILE_ATTACKINGTARGET, .proc/hostile_attackingtarget)
|
||||
|
||||
/datum/component/lifesteal/UnregisterFromParent()
|
||||
. = ..()
|
||||
UnregisterSignal(parent, list(COMSIG_ITEM_AFTERATTACK, COMSIG_HOSTILE_ATTACKINGTARGET, COMSIG_PROJECTILE_ON_HIT))
|
||||
|
||||
/datum/component/lifesteal/proc/item_afterattack(obj/item/source, atom/target, mob/user, proximity_flag, click_parameters)
|
||||
|
||||
@@ -150,15 +150,6 @@
|
||||
if(9)
|
||||
setSanity(sanity+0.4, maximum=SANITY_GREAT)
|
||||
|
||||
if(HAS_TRAIT(owner, TRAIT_DEPRESSION))
|
||||
if(prob(0.05))
|
||||
add_event(null, "depression", /datum/mood_event/depression)
|
||||
clear_event(null, "jolly")
|
||||
if(HAS_TRAIT(owner, TRAIT_JOLLY))
|
||||
if(prob(0.05))
|
||||
add_event(null, "jolly", /datum/mood_event/jolly)
|
||||
clear_event(null, "depression")
|
||||
|
||||
HandleNutrition(owner)
|
||||
|
||||
/datum/component/mood/proc/setSanity(amount, minimum=SANITY_INSANE, maximum=SANITY_NEUTRAL)//I'm sure bunging this in here will have no negative repercussions.
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
cloud_sync()
|
||||
|
||||
/datum/component/nanites/RegisterWithParent()
|
||||
. = ..()
|
||||
RegisterSignal(parent, COMSIG_HAS_NANITES, .proc/confirm_nanites)
|
||||
RegisterSignal(parent, COMSIG_NANITE_UI_DATA, .proc/nanite_ui_data)
|
||||
RegisterSignal(parent, COMSIG_NANITE_GET_PROGRAMS, .proc/get_programs)
|
||||
@@ -57,6 +58,7 @@
|
||||
RegisterSignal(parent, COMSIG_NANITE_SIGNAL, .proc/receive_signal)
|
||||
|
||||
/datum/component/nanites/UnregisterFromParent()
|
||||
. = ..()
|
||||
UnregisterSignal(parent, list(COMSIG_HAS_NANITES,
|
||||
COMSIG_NANITE_UI_DATA,
|
||||
COMSIG_NANITE_GET_PROGRAMS,
|
||||
|
||||
@@ -20,12 +20,14 @@
|
||||
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, .proc/move_react)
|
||||
target = target.loc
|
||||
|
||||
/datum/component/orbiter/UnregisterFromParent()
|
||||
. = ..()
|
||||
var/atom/target = parent
|
||||
while(ismovableatom(target))
|
||||
UnregisterSignal(target, COMSIG_MOVABLE_MOVED)
|
||||
|
||||
@@ -106,6 +106,7 @@
|
||||
if(!can_be_rotated.Invoke(user, rotation) || !can_user_rotate.Invoke(user, rotation))
|
||||
return
|
||||
BaseRot(user, rotation)
|
||||
return TRUE
|
||||
|
||||
/datum/component/simple_rotation/proc/WrenchRot(datum/source, obj/item/I, mob/living/user)
|
||||
if(!can_be_rotated.Invoke(user,default_rotation_direction) || !can_user_rotate.Invoke(user,default_rotation_direction))
|
||||
|
||||
@@ -13,10 +13,12 @@
|
||||
src.override_projectile_range = override_projectile_range
|
||||
|
||||
/datum/component/shrapnel/RegisterWithParent()
|
||||
. = ..()
|
||||
if(ismachinery(parent) || isstructure(parent) || isgun(parent)) // turrets, etc
|
||||
RegisterSignal(parent, COMSIG_PROJECTILE_ON_HIT, .proc/projectile_hit)
|
||||
|
||||
/datum/component/shrapnel/UnregisterFromParent()
|
||||
. = ..()
|
||||
UnregisterSignal(parent, list(COMSIG_PROJECTILE_ON_HIT))
|
||||
|
||||
/datum/component/shrapnel/proc/projectile_hit(atom/fired_from, atom/movable/firer, atom/target, Angle)
|
||||
|
||||
@@ -762,7 +762,7 @@
|
||||
if(!isliving(user) || !user.CanReach(parent))
|
||||
return
|
||||
if(check_locked(source, user, TRUE))
|
||||
return
|
||||
return TRUE
|
||||
|
||||
var/atom/A = parent
|
||||
if(!quickdraw)
|
||||
@@ -770,19 +770,20 @@
|
||||
user_show_to_mob(user)
|
||||
if(rustle_sound)
|
||||
playsound(A, "rustle", 50, 1, -5)
|
||||
return
|
||||
return TRUE
|
||||
|
||||
if(!user.incapacitated())
|
||||
if(user.can_hold_items() && !user.incapacitated())
|
||||
var/obj/item/I = locate() in real_location()
|
||||
if(!I)
|
||||
return
|
||||
A.add_fingerprint(user)
|
||||
remove_from_storage(I, get_turf(user))
|
||||
if(!user.put_in_hands(I))
|
||||
to_chat(user, "<span class='notice'>You fumble for [I] and it falls on the floor.</span>")
|
||||
return
|
||||
user.visible_message("<span class='warning'>[user] fumbles with the [parent], letting [I] fall on the floor.</span>", \
|
||||
"<span class='notice'>You fumble with [parent], letting [I] fall on the floor.</span>")
|
||||
return TRUE
|
||||
user.visible_message("<span class='warning'>[user] draws [I] from [parent]!</span>", "<span class='notice'>You draw [I] from [parent].</span>")
|
||||
return
|
||||
return TRUE
|
||||
|
||||
/datum/component/storage/proc/action_trigger(datum/signal_source, datum/action/source)
|
||||
gather_mode_switch(source.owner)
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
src.faction = faction
|
||||
|
||||
/datum/component/summoning/RegisterWithParent()
|
||||
. = ..()
|
||||
if(ismachinery(parent) || isstructure(parent) || isgun(parent)) // turrets, etc
|
||||
RegisterSignal(parent, COMSIG_PROJECTILE_ON_HIT, .proc/projectile_hit)
|
||||
else if(isitem(parent))
|
||||
@@ -32,6 +33,7 @@
|
||||
RegisterSignal(parent, COMSIG_HOSTILE_ATTACKINGTARGET, .proc/hostile_attackingtarget)
|
||||
|
||||
/datum/component/summoning/UnregisterFromParent()
|
||||
. = ..()
|
||||
UnregisterSignal(parent, list(COMSIG_ITEM_AFTERATTACK, COMSIG_HOSTILE_ATTACKINGTARGET, COMSIG_PROJECTILE_ON_HIT))
|
||||
|
||||
/datum/component/summoning/proc/item_afterattack(obj/item/source, atom/target, mob/user, proximity_flag, click_parameters)
|
||||
|
||||
@@ -9,10 +9,12 @@
|
||||
src.allowed_slot = allowed_slot
|
||||
|
||||
/datum/component/tactical/RegisterWithParent()
|
||||
. = ..()
|
||||
RegisterSignal(parent, COMSIG_ITEM_EQUIPPED, .proc/modify)
|
||||
RegisterSignal(parent, COMSIG_ITEM_DROPPED, .proc/unmodify)
|
||||
|
||||
/datum/component/tactical/UnregisterFromParent()
|
||||
. = ..()
|
||||
UnregisterSignal(parent, list(COMSIG_ITEM_EQUIPPED, COMSIG_ITEM_DROPPED))
|
||||
unmodify()
|
||||
|
||||
|
||||
@@ -1,128 +1,245 @@
|
||||
/**
|
||||
* The virtual reality turned component.
|
||||
* Originally created to overcome issues of mob polymorphing locking the player inside virtual reality
|
||||
* and allow for a more "immersive" virtual reality in a virtual reality experience.
|
||||
* It relies on comically complex order of logic, expect things to break if procs such as mind/transfer_to() are revamped.
|
||||
* In short, a barebone not so hardcoded VR framework.
|
||||
* If you plan to add more devices that make use of this component, remember to isolate their code outta here where possible.
|
||||
*/
|
||||
/datum/component/virtual_reality
|
||||
can_transfer = TRUE
|
||||
var/datum/mind/mastermind // where is my mind t. pixies
|
||||
//the player's mind (not the parent's), should something happen to them or to their mob.
|
||||
var/datum/mind/mastermind
|
||||
//the current mob's mind, which we need to keep track for mind transfer.
|
||||
var/datum/mind/current_mind
|
||||
var/obj/machinery/vr_sleeper/vr_sleeper
|
||||
//the action datum used by the mob to quit the vr session.
|
||||
var/datum/action/quit_vr/quit_action
|
||||
//This one's name should be self explainatory, currently used for emags.
|
||||
var/you_die_in_the_game_you_die_for_real = FALSE
|
||||
var/datum/component/virtual_reality/inception //The component works on a very fragile link betwixt mind, ckey and death.
|
||||
//Used to allow people to play recursively playing vr while playing vr without many issues.
|
||||
var/datum/component/virtual_reality/level_below
|
||||
var/datum/component/virtual_reality/level_above
|
||||
//Used to stop the component from executing certain functions that'd cause us some issues otherwise.
|
||||
//FALSE if there is a connected player, otherwise TRUE.
|
||||
var/session_paused = TRUE
|
||||
//Used to stop unwarranted behaviour from happening in cases where the master mind transference is unsupported. Set on Initialize().
|
||||
var/allow_mastermind_transfer = FALSE
|
||||
|
||||
/datum/component/virtual_reality/Initialize(mob/M, obj/machinery/vr_sleeper/gaming_pod, yolo = FALSE, new_char = TRUE)
|
||||
if(!ismob(parent) || !istype(M))
|
||||
/datum/component/virtual_reality/Initialize(yolo = FALSE, _allow_mastermind_transfer = FALSE)
|
||||
var/mob/M = parent
|
||||
if(!istype(M) || !M.mind)
|
||||
return COMPONENT_INCOMPATIBLE
|
||||
var/mob/vr_M = parent
|
||||
mastermind = M.mind
|
||||
RegisterSignal(M, list(COMSIG_MOB_DEATH, COMSIG_PARENT_QDELETING), .proc/game_over)
|
||||
RegisterSignal(M, COMSIG_MOB_KEY_CHANGE, .proc/switch_player)
|
||||
RegisterSignal(mastermind, COMSIG_MIND_TRANSFER, .proc/switch_player)
|
||||
you_die_in_the_game_you_die_for_real = yolo
|
||||
quit_action = new()
|
||||
if(gaming_pod)
|
||||
vr_sleeper = gaming_pod
|
||||
RegisterSignal(vr_sleeper, COMSIG_ATOM_EMAG_ACT, .proc/you_only_live_once)
|
||||
RegisterSignal(vr_sleeper, COMSIG_MACHINE_EJECT_OCCUPANT, .proc/revert_to_reality)
|
||||
vr_M.ckey = M.ckey
|
||||
var/datum/component/virtual_reality/clusterfk = M.GetComponent(/datum/component/virtual_reality)
|
||||
if(clusterfk && !clusterfk.inception)
|
||||
clusterfk.inception = src
|
||||
SStgui.close_user_uis(M, src)
|
||||
allow_mastermind_transfer = _allow_mastermind_transfer
|
||||
quit_action = new
|
||||
|
||||
/datum/component/virtual_reality/Destroy()
|
||||
QDEL_NULL(quit_action)
|
||||
if(level_above)
|
||||
level_above.level_below = null
|
||||
level_above = null
|
||||
if(level_below)
|
||||
level_below.level_above = null
|
||||
level_below = null
|
||||
return ..()
|
||||
|
||||
/datum/component/virtual_reality/RegisterWithParent()
|
||||
. = ..()
|
||||
var/mob/M = parent
|
||||
current_mind = M.mind
|
||||
if(!quit_action)
|
||||
quit_action = new
|
||||
quit_action.Grant(M)
|
||||
RegisterSignal(quit_action, COMSIG_ACTION_TRIGGER, .proc/revert_to_reality)
|
||||
RegisterSignal(quit_action, COMSIG_ACTION_TRIGGER, .proc/action_trigger)
|
||||
RegisterSignal(M, list(COMSIG_MOB_DEATH, COMSIG_PARENT_QDELETING), .proc/game_over)
|
||||
RegisterSignal(M, COMSIG_MOB_GHOSTIZE, .proc/be_a_quitter)
|
||||
RegisterSignal(M, COMSIG_MOB_KEY_CHANGE, .proc/pass_me_the_remote)
|
||||
RegisterSignal(current_mind, COMSIG_MIND_TRANSFER, .proc/pass_me_the_remote)
|
||||
mastermind.current.audiovisual_redirect = M
|
||||
if(vr_sleeper)
|
||||
vr_sleeper.vr_mob = M
|
||||
RegisterSignal(M, COMSIG_MOB_KEY_CHANGE, .proc/on_player_transfer)
|
||||
RegisterSignal(current_mind, COMSIG_MIND_TRANSFER, .proc/on_player_transfer)
|
||||
RegisterSignal(current_mind, COMSIG_PRE_MIND_TRANSFER, .proc/pre_player_transfer)
|
||||
if(mastermind?.current)
|
||||
mastermind.current.audiovisual_redirect = M
|
||||
|
||||
/datum/component/virtual_reality/UnregisterFromParent()
|
||||
quit_action.Remove(parent)
|
||||
. = ..()
|
||||
if(quit_action)
|
||||
quit_action.Remove(parent)
|
||||
UnregisterSignal(quit_action, COMSIG_ACTION_TRIGGER)
|
||||
UnregisterSignal(parent, list(COMSIG_MOB_DEATH, COMSIG_PARENT_QDELETING, COMSIG_MOB_KEY_CHANGE, COMSIG_MOB_GHOSTIZE))
|
||||
UnregisterSignal(current_mind, COMSIG_MIND_TRANSFER)
|
||||
UnregisterSignal(quit_action, COMSIG_ACTION_TRIGGER)
|
||||
UnregisterSignal(current_mind, list(COMSIG_MIND_TRANSFER, COMSIG_PRE_MIND_TRANSFER))
|
||||
current_mind = null
|
||||
mastermind.current.audiovisual_redirect = null
|
||||
if(mastermind?.current)
|
||||
mastermind.current.audiovisual_redirect = null
|
||||
|
||||
/datum/component/virtual_reality/proc/switch_player(datum/source, mob/new_mob, mob/old_mob)
|
||||
if(vr_sleeper || !new_mob.mind)
|
||||
// Machineries currently don't deal up with the occupant being polymorphed et similar... Or did something fuck up?
|
||||
revert_to_reality()
|
||||
return
|
||||
old_mob.audiovisual_redirect = null
|
||||
new_mob.audiovisual_redirect = parent
|
||||
|
||||
/datum/component/virtual_reality/proc/action_trigger(datum/signal_source, datum/action/source)
|
||||
if(source != quit_action)
|
||||
return COMPONENT_ACTION_BLOCK_TRIGGER
|
||||
revert_to_reality(signal_source)
|
||||
/**
|
||||
* Called when attempting to connect a mob to a virtual reality mob.
|
||||
* This will return FALSE if the mob is without player or dead. TRUE otherwise
|
||||
*/
|
||||
/datum/component/virtual_reality/proc/connect(mob/M)
|
||||
var/mob/vr_M = parent
|
||||
if(!M.mind || M.stat == DEAD || !vr_M.mind || vr_M.stat == DEAD)
|
||||
return FALSE
|
||||
var/datum/component/virtual_reality/VR = M.GetComponent(/datum/component/virtual_reality)
|
||||
if(VR)
|
||||
VR.level_below = src
|
||||
level_above = VR
|
||||
M.transfer_ckey(vr_M, FALSE)
|
||||
mastermind = M.mind
|
||||
mastermind.current.audiovisual_redirect = parent
|
||||
RegisterSignal(mastermind, COMSIG_PRE_MIND_TRANSFER, .proc/switch_player)
|
||||
RegisterSignal(M, list(COMSIG_MOB_DEATH, COMSIG_PARENT_QDELETING), .proc/game_over)
|
||||
RegisterSignal(M, COMSIG_MOB_PRE_PLAYER_CHANGE, .proc/player_hijacked)
|
||||
SStgui.close_user_uis(vr_M, src)
|
||||
session_paused = FALSE
|
||||
return TRUE
|
||||
|
||||
/**
|
||||
* emag_act() hook. Makes the game deadlier, killing the mastermind mob too should the parent die.
|
||||
*/
|
||||
/datum/component/virtual_reality/proc/you_only_live_once()
|
||||
if(you_die_in_the_game_you_die_for_real || vr_sleeper?.only_current_user_can_interact)
|
||||
if(you_die_in_the_game_you_die_for_real)
|
||||
return FALSE
|
||||
you_die_in_the_game_you_die_for_real = TRUE
|
||||
return TRUE
|
||||
|
||||
/datum/component/virtual_reality/proc/pass_me_the_remote(datum/source, mob/new_mob)
|
||||
if(new_mob == mastermind.current)
|
||||
revert_to_reality(source)
|
||||
return TRUE
|
||||
new_mob.TakeComponent(src)
|
||||
return TRUE
|
||||
/**
|
||||
* Called when the mastermind mind is transferred to another mob.
|
||||
* This is pretty much just going to simply quit the session until machineries support polymorphed occupants etcetera.
|
||||
*/
|
||||
/datum/component/virtual_reality/proc/switch_player(datum/source, mob/new_mob, mob/old_mob)
|
||||
if(session_paused)
|
||||
return
|
||||
if(!allow_mastermind_transfer)
|
||||
quit()
|
||||
return COMPONENT_STOP_MIND_TRANSFER
|
||||
UnregisterSignal(old_mob, list(COMSIG_MOB_DEATH, COMSIG_PARENT_QDELETING, COMSIG_MOB_PRE_PLAYER_CHANGE))
|
||||
RegisterSignal(new_mob, list(COMSIG_MOB_DEATH, COMSIG_PARENT_QDELETING), .proc/game_over)
|
||||
RegisterSignal(new_mob, COMSIG_MOB_PRE_PLAYER_CHANGE, .proc/player_hijacked)
|
||||
old_mob.audiovisual_redirect = null
|
||||
new_mob.audiovisual_redirect = parent
|
||||
|
||||
/**
|
||||
* Called to stop the player mind from being transferred should the new mob happen to be one of our masterminds'.
|
||||
* Since the target's mind.current is going to be null'd in the mind transfer process,
|
||||
* This has to be done in a different signal proc than on_player_transfer(), by then the mastermind.current will be null.
|
||||
*/
|
||||
/datum/component/virtual_reality/proc/pre_player_transfer(datum/source, mob/new_mob, mob/old_mob)
|
||||
if(!mastermind || session_paused)
|
||||
return
|
||||
if(new_mob == mastermind.current)
|
||||
quit()
|
||||
return COMPONENT_STOP_MIND_TRANSFER
|
||||
if(!level_above)
|
||||
return
|
||||
var/datum/component/virtual_reality/VR = level_above
|
||||
while(VR)
|
||||
if(VR.mastermind.current == new_mob)
|
||||
VR.quit() //this will revert the ckey back to new_mob.
|
||||
return COMPONENT_STOP_MIND_TRANSFER
|
||||
VR = VR.level_above
|
||||
|
||||
/**
|
||||
* Called when someone or something else is somewhat about to replace the mastermind's mob key somehow.
|
||||
* And potentially lock the player in a broken virtual reality plot. Not really something to be proud of.
|
||||
*/
|
||||
/datum/component/virtual_reality/proc/player_hijacked(datum/source, mob/our_character, mob/their_character)
|
||||
if(session_paused)
|
||||
return
|
||||
if(!their_character)
|
||||
quit(cleanup = TRUE)
|
||||
return
|
||||
var/will_it_be_handled_in_their_pre_player_transfer = FALSE
|
||||
var/datum/component/virtual_reality/VR = src
|
||||
while(VR)
|
||||
if(VR.parent == their_character)
|
||||
will_it_be_handled_in_their_pre_player_transfer = TRUE
|
||||
break
|
||||
VR = VR.level_below
|
||||
if(!will_it_be_handled_in_their_pre_player_transfer) //it's not the player playing shenanigeans, abandon all ships.
|
||||
quit(cleanup = TRUE)
|
||||
|
||||
/**
|
||||
* Takes care of moving the component from a mob to another when their mind or ckey is transferred.
|
||||
* The very reason this component even exists (else one would be stuck playing as a monky if monkyified)
|
||||
*/
|
||||
/datum/component/virtual_reality/proc/on_player_transfer(datum/source, mob/new_mob, mob/old_mob)
|
||||
new_mob.TakeComponent(src)
|
||||
|
||||
/**
|
||||
* Required for the component to be transferable from mob to mob.
|
||||
*/
|
||||
/datum/component/virtual_reality/PostTransfer()
|
||||
if(!ismob(parent))
|
||||
return COMPONENT_INCOMPATIBLE
|
||||
|
||||
/**
|
||||
*The following procs simply acts as hooks for quit(), since components do not use callbacks anymore
|
||||
*/
|
||||
/datum/component/virtual_reality/proc/action_trigger(datum/signal_source, datum/action/source)
|
||||
quit()
|
||||
return COMPONENT_ACTION_BLOCK_TRIGGER
|
||||
|
||||
/datum/component/virtual_reality/proc/revert_to_reality(datum/source)
|
||||
quit_it()
|
||||
quit()
|
||||
|
||||
/datum/component/virtual_reality/proc/game_over(datum/source)
|
||||
quit_it(TRUE, TRUE)
|
||||
quit(you_die_in_the_game_you_die_for_real, TRUE)
|
||||
return COMPONENT_BLOCK_DEATH_BROADCAST
|
||||
|
||||
/datum/component/virtual_reality/proc/be_a_quitter(datum/source, can_reenter_corpse)
|
||||
quit_it()
|
||||
return COMPONENT_BLOCK_GHOSTING
|
||||
/datum/component/virtual_reality/proc/be_a_quitter(datum/source, can_reenter_corpse, special = FALSE, penalize = FALSE)
|
||||
if(!special)
|
||||
quit()
|
||||
return COMPONENT_BLOCK_GHOSTING
|
||||
|
||||
/datum/component/virtual_reality/proc/virtual_reality_in_a_virtual_reality(mob/player, killme = FALSE, datum/component/virtual_reality/yo_dawg)
|
||||
/datum/component/virtual_reality/proc/machine_destroyed(datum/source)
|
||||
quit(cleanup = TRUE)
|
||||
|
||||
/**
|
||||
* Takes care of deleting itself, moving the player back to the mastermind's current and queueing the parent for deletion.
|
||||
* It supports nested virtual realities by recursively calling vr_in_a_vr(), which in turns calls quit(),
|
||||
* up to the deepest level, where the ckey will be transferred back to our mastermind's mob instead.
|
||||
* The above operation is skipped when session_paused is TRUE (ergo no player in control of the current mob).
|
||||
* vars:
|
||||
* * deathcheck is used to kill the master, you want this FALSE unless for stuff that doesn't involve emagging.
|
||||
* * cleanup is used to queue the parent for the next vr_clean_master's run, where they'll be deleted should they be dead.
|
||||
* * mob/override is used for the recursive virtual reality explained above and shouldn't be used outside of vr_in_a_vr().
|
||||
*/
|
||||
/datum/component/virtual_reality/proc/quit(deathcheck = FALSE, cleanup = FALSE, mob/override)
|
||||
var/mob/M = parent
|
||||
quit_it(FALSE, killme, player, yo_dawg)
|
||||
yo_dawg.inception = null
|
||||
if(killme)
|
||||
M.death(FALSE)
|
||||
|
||||
/datum/component/virtual_reality/proc/quit_it(deathcheck = FALSE, cleanup = FALSE, mob/override)
|
||||
var/mob/M = parent
|
||||
var/mob/dreamer = override ? override : mastermind.current
|
||||
if(!mastermind)
|
||||
to_chat(M, "<span class='warning'>You feel a dreadful sensation, something terrible happened. You try to wake up, but you find yourself unable to...</span>")
|
||||
else
|
||||
var/key_transfer = FALSE
|
||||
if(inception?.parent)
|
||||
inception.virtual_reality_in_a_virtual_reality(dreamer, cleanup, src)
|
||||
if(!session_paused)
|
||||
session_paused = TRUE
|
||||
var/mob/dreamer = override || mastermind.current
|
||||
if(!dreamer) //This shouldn't happen.
|
||||
stack_trace("virtual reality component quit() called without a mob to transfer the parent ckey to.")
|
||||
to_chat(M, "<span class='warning'>You feel a dreadful sensation, something terrible happened. You try to wake up, but you find yourself unable to...</span>")
|
||||
qdel(src)
|
||||
return
|
||||
if(level_below?.parent)
|
||||
level_below.vr_in_a_vr(dreamer, deathcheck, (deathcheck && cleanup))
|
||||
else
|
||||
key_transfer = TRUE
|
||||
if(key_transfer)
|
||||
M.transfer_ckey(dreamer, FALSE)
|
||||
dreamer.stop_sound_channel(CHANNEL_HEARTBEAT)
|
||||
dreamer.audiovisual_redirect = null
|
||||
if(deathcheck && you_die_in_the_game_you_die_for_real)
|
||||
to_chat(mastermind, "<span class='warning'>You feel everything fading away...</span>")
|
||||
dreamer.death(FALSE)
|
||||
if(cleanup)
|
||||
var/obj/effect/vr_clean_master/cleanbot = locate() in get_area(M)
|
||||
if(cleanbot)
|
||||
LAZYADD(cleanbot.corpse_party, M)
|
||||
if(vr_sleeper)
|
||||
vr_sleeper.vr_mob = null
|
||||
vr_sleeper = null
|
||||
qdel(src)
|
||||
if(deathcheck)
|
||||
to_chat(dreamer, "<span class='warning'>You feel everything fading away...</span>")
|
||||
dreamer.death(FALSE)
|
||||
mastermind.current.audiovisual_redirect = null
|
||||
if(!cleanup)
|
||||
if(level_above)
|
||||
level_above.level_below = null
|
||||
level_above = null
|
||||
UnregisterSignal(mastermind.current, list(COMSIG_MOB_DEATH, COMSIG_PARENT_QDELETING, COMSIG_MOB_PRE_PLAYER_CHANGE))
|
||||
UnregisterSignal(mastermind, COMSIG_PRE_MIND_TRANSFER)
|
||||
mastermind = null
|
||||
if(cleanup)
|
||||
var/obj/effect/vr_clean_master/cleanbot = locate() in get_area(M)
|
||||
if(cleanbot)
|
||||
LAZYOR(cleanbot.corpse_party, M)
|
||||
qdel(src)
|
||||
|
||||
/datum/component/virtual_reality/Destroy()
|
||||
var/datum/action/quit_vr/delet_me = quit_action
|
||||
. = ..()
|
||||
qdel(delet_me)
|
||||
/**
|
||||
* Used for recursive virtual realities shenanigeans and should be called only through the above proc.
|
||||
*/
|
||||
/datum/component/virtual_reality/proc/vr_in_a_vr(mob/player, deathcheck = FALSE, lethal_cleanup = FALSE)
|
||||
var/mob/M = parent
|
||||
quit(deathcheck, lethal_cleanup, player)
|
||||
M.audiovisual_redirect = null
|
||||
if(lethal_cleanup)
|
||||
M.death(FALSE)
|
||||
|
||||
@@ -34,10 +34,12 @@
|
||||
last_process = world.time
|
||||
|
||||
/datum/component/wet_floor/RegisterWithParent()
|
||||
. = ..()
|
||||
RegisterSignal(parent, COMSIG_TURF_IS_WET, .proc/is_wet)
|
||||
RegisterSignal(parent, COMSIG_TURF_MAKE_DRY, .proc/dry)
|
||||
|
||||
/datum/component/wet_floor/UnregisterFromParent()
|
||||
. = ..()
|
||||
UnregisterSignal(parent, list(COMSIG_TURF_IS_WET, COMSIG_TURF_MAKE_DRY))
|
||||
|
||||
/datum/component/wet_floor/Destroy()
|
||||
|
||||
Reference in New Issue
Block a user