mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-29 03:22:12 +00:00
VR code tweaks, mob TF, ghost joining, qdel to VR escapees
This commit is contained in:
@@ -6,3 +6,66 @@
|
||||
if(body_backup)
|
||||
qdel(body_backup)
|
||||
..()
|
||||
|
||||
// Persistence vars not included as we probably don't want losing limbs in the game mean losing limbs in real life. Definitely can't backfire.
|
||||
/mob/observer/dead/verb/fake_enter_vr()
|
||||
set name = "Join virtual reality"
|
||||
set category = "Ghost"
|
||||
set desc = "Log into NanoTrasen's local virtual reality server."
|
||||
|
||||
var/time_till_respawn = time_till_respawn()
|
||||
if(time_till_respawn == -1) // Special case, never allowed to respawn
|
||||
to_chat(usr, "<span class='warning'>Respawning is not allowed!</span>")
|
||||
return
|
||||
if(time_till_respawn) // Nonzero time to respawn
|
||||
to_chat(usr, "<span class='warning'>You can't do that yet! You died too recently. You need to wait another [round(time_till_respawn/10/60, 0.1)] minutes.</span>")
|
||||
return
|
||||
|
||||
var/datum/data/record/record_found
|
||||
record_found = find_general_record("name", client.prefs.real_name)
|
||||
// Found their record, they were spawned previously. Remind them corpses cannot play games.
|
||||
if(record_found)
|
||||
var/answer = tgui_alert(src,"You seem to have previously joined this round. If you are currently dead, you should not enter VR as this character. Would you still like to proceed?","Previously spawned",list("Yes","No"))
|
||||
if(answer != "Yes")
|
||||
return
|
||||
|
||||
var/S = null
|
||||
var/list/vr_landmarks = list()
|
||||
for(var/obj/effect/landmark/virtual_reality/sloc in landmarks_list)
|
||||
vr_landmarks += sloc.name
|
||||
|
||||
S = tgui_input_list(usr, "Please select a location to spawn your avatar at:", "Spawn location", vr_landmarks)
|
||||
if(!S)
|
||||
return 0
|
||||
for(var/obj/effect/landmark/virtual_reality/i in landmarks_list)
|
||||
if(i.name == S)
|
||||
S = i
|
||||
break
|
||||
|
||||
var/mob/living/carbon/human/avatar = new(get_turf(S), "Virtual Reality Avatar")
|
||||
if(!avatar)
|
||||
to_chat(src, "Something went wrong and spawning failed.")
|
||||
return
|
||||
|
||||
//Write the appearance and whatnot out to the character
|
||||
var/client/C = client
|
||||
C.prefs.copy_to(avatar) // Unfortunately the cascade of procs this calls will add the body to the transcore body DB. Don't see a simple way to prevent that.
|
||||
avatar.key = key
|
||||
for(var/lang in C.prefs.alternate_languages)
|
||||
var/datum/language/chosen_language = GLOB.all_languages[lang]
|
||||
if(chosen_language)
|
||||
if(is_lang_whitelisted(usr,chosen_language) || (avatar.species && (chosen_language.name in avatar.species.secondary_langs)))
|
||||
avatar.add_language(lang)
|
||||
|
||||
avatar.regenerate_icons()
|
||||
avatar.update_transform()
|
||||
avatar.species.equip_survival_gear(avatar)
|
||||
avatar.verbs += /mob/living/carbon/human/proc/fake_exit_vr
|
||||
avatar.verbs += /mob/living/carbon/human/proc/vr_transform_into_mob
|
||||
avatar.verbs |= /mob/living/proc/set_size // Introducing NeosVR
|
||||
avatar.virtual_reality_mob = TRUE
|
||||
log_and_message_admins("[key_name_admin(avatar)] joined virtual reality from the ghost menu.")
|
||||
|
||||
var/newname = sanitize(tgui_input_text(avatar, "You are entering virtual reality. Your username is currently [src.name]. Would you like to change it to something else?", "Name change", null, MAX_NAME_LEN), MAX_NAME_LEN)
|
||||
if(newname)
|
||||
avatar.real_name = newname
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
var/pain_emote_3p = null
|
||||
var/species_sounds = "None" // By default, we have nothing.
|
||||
var/death_sound_override = null
|
||||
var/virtual_reality_mob = FALSE // gross boolean for keeping VR mobs in VR
|
||||
/* // Not sure if needed, screams aren't a carbon thing rn.
|
||||
var/scream_sound = null
|
||||
var/female_scream_sound = null
|
||||
@@ -44,3 +45,98 @@ Maybe later, gotta figure out a way to click yourself when in a locker etc.
|
||||
..()
|
||||
verbs |= /mob/living/proc/click_self
|
||||
*/
|
||||
|
||||
/mob/living/proc/handle_vorefootstep(m_intent, turf/T) // Moved from living_ch.dm
|
||||
return FALSE
|
||||
|
||||
// Gross proc which is called on Life() to check for escaped VR mobs. Tried to do this with Exited() on area/vr but ended up being too heavy.
|
||||
/mob/living/proc/handle_vr_derez()
|
||||
if(virtual_reality_mob && !istype(get_area(src), /area/vr))
|
||||
log_debug("[src] escaped virtual reality")
|
||||
visible_message("[src] blinks out of existence.")
|
||||
for(var/obj/belly/B in vore_organs) // Assume anybody inside an escaped VR mob is also an escaped VR mob.
|
||||
for(var/mob/living/L in B)
|
||||
log_debug("[L] was inside an escaped VR mob and has been deleted.")
|
||||
qdel(L)
|
||||
qdel(src) // Would like to convert escaped players into AR holograms in the future to encourage exploit finding.
|
||||
|
||||
// TRANSFORMATION PROCS
|
||||
|
||||
// Used to check if THIS MOB has been transformed into a different mob, as only the NEW mob uses tf_mob_holder.
|
||||
// Necessary in niche cases where a proc interacts with the old body and needs to know it's been transformed (such as transforming into a mob then dying in virtual reality).
|
||||
// Use this if you cannot use the tf_mob_holder var. Returns TRUE if transformed, FALSE if not.
|
||||
/mob/living/proc/tfed_into_mob_check()
|
||||
if(loc && isliving(loc))
|
||||
var/mob/living/M = loc
|
||||
if(istype(M) && M.tf_mob_holder && (M.tf_mob_holder == src))
|
||||
return TRUE
|
||||
else
|
||||
return FALSE
|
||||
else
|
||||
return FALSE
|
||||
|
||||
// For some reason upstream made a general revert proc but not a general transform proc, so here it is.
|
||||
// Requires a /mob/living type path for transformation. Returns the new mob on success, null in all other cases.
|
||||
// Just handles mob TF right now, but maybe we'll want to do something similar for items in the future.
|
||||
/mob/living/proc/transform_into_mob(mob/living/new_form, pref_override = FALSE, revert = FALSE)
|
||||
if(!src.mind)
|
||||
return
|
||||
if(!src.allow_spontaneous_tf && !pref_override)
|
||||
return
|
||||
if(src.tf_mob_holder) //If we're already transformed
|
||||
if(revert)
|
||||
revert_mob_tf()
|
||||
return
|
||||
else
|
||||
return
|
||||
else
|
||||
if(src.stat == DEAD)
|
||||
return
|
||||
if(!ispath(new_form, /mob/living))
|
||||
return
|
||||
var/mob/living/new_mob = new new_form(get_turf(src))
|
||||
new_mob.faction = src.faction
|
||||
|
||||
if(new_mob && isliving(new_mob))
|
||||
for(var/obj/belly/B as anything in new_mob.vore_organs)
|
||||
new_mob.vore_organs -= B
|
||||
qdel(B)
|
||||
new_mob.vore_organs = list()
|
||||
new_mob.name = src.name
|
||||
new_mob.real_name = src.real_name
|
||||
for(var/lang in src.languages)
|
||||
new_mob.languages |= lang
|
||||
src.copy_vore_prefs_to_mob(new_mob)
|
||||
new_mob.vore_selected = src.vore_selected
|
||||
if(ishuman(src))
|
||||
var/mob/living/carbon/human/H = src
|
||||
if(ishuman(new_mob))
|
||||
var/mob/living/carbon/human/N = new_mob
|
||||
N.gender = H.gender
|
||||
N.identifying_gender = H.identifying_gender
|
||||
else
|
||||
new_mob.gender = H.gender
|
||||
else
|
||||
new_mob.gender = src.gender
|
||||
if(ishuman(new_mob))
|
||||
var/mob/living/carbon/human/N = new_mob
|
||||
N.identifying_gender = src.gender
|
||||
|
||||
for(var/obj/belly/B as anything in src.vore_organs)
|
||||
B.loc = new_mob
|
||||
B.forceMove(new_mob)
|
||||
B.owner = new_mob
|
||||
src.vore_organs -= B
|
||||
new_mob.vore_organs += B
|
||||
|
||||
new_mob.ckey = src.ckey
|
||||
if(src.ai_holder && new_mob.ai_holder)
|
||||
var/datum/ai_holder/old_AI = src.ai_holder
|
||||
old_AI.set_stance(STANCE_SLEEP)
|
||||
var/datum/ai_holder/new_AI = new_mob.ai_holder
|
||||
new_AI.hostile = old_AI.hostile
|
||||
new_AI.retaliate = old_AI.retaliate
|
||||
src.loc = new_mob
|
||||
src.forceMove(new_mob)
|
||||
new_mob.tf_mob_holder = src
|
||||
return new_mob
|
||||
|
||||
Reference in New Issue
Block a user