datums
This commit is contained in:
@@ -23,6 +23,10 @@
|
||||
//Called on life ticks
|
||||
/datum/brain_trauma/proc/on_life()
|
||||
return
|
||||
|
||||
//Called on death
|
||||
/datum/brain_trauma/proc/on_death()
|
||||
return
|
||||
|
||||
//Called when given to a mob
|
||||
/datum/brain_trauma/proc/on_gain()
|
||||
|
||||
@@ -14,13 +14,17 @@
|
||||
|
||||
/datum/brain_trauma/special/imaginary_friend/on_life()
|
||||
if(get_dist(owner, friend) > 9)
|
||||
friend.yank()
|
||||
friend.recall()
|
||||
if(!friend)
|
||||
qdel(src)
|
||||
return
|
||||
if(!friend.client && friend_initialized)
|
||||
addtimer(CALLBACK(src, .proc/reroll_friend), 600)
|
||||
|
||||
/datum/brain_trauma/special/imaginary_friend/on_death()
|
||||
..()
|
||||
qdel(src) //friend goes down with the ship
|
||||
|
||||
/datum/brain_trauma/special/imaginary_friend/on_lose()
|
||||
..()
|
||||
QDEL_NULL(friend)
|
||||
@@ -55,12 +59,19 @@
|
||||
see_in_dark = 0
|
||||
lighting_alpha = LIGHTING_PLANE_ALPHA_VISIBLE
|
||||
sight = NONE
|
||||
mouse_opacity = MOUSE_OPACITY_OPAQUE
|
||||
see_invisible = SEE_INVISIBLE_LIVING
|
||||
invisibility = INVISIBILITY_MAXIMUM
|
||||
var/icon/human_image
|
||||
var/image/current_image
|
||||
var/hidden = FALSE
|
||||
var/move_delay = 0
|
||||
var/mob/living/carbon/owner
|
||||
var/datum/brain_trauma/special/imaginary_friend/trauma
|
||||
|
||||
var/datum/action/innate/imaginary_join/join
|
||||
var/datum/action/innate/imaginary_hide/hide
|
||||
|
||||
/mob/camera/imaginary_friend/Login()
|
||||
..()
|
||||
to_chat(src, "<span class='notice'><b>You are the imaginary friend of [owner]!</b></span>")
|
||||
@@ -75,8 +86,14 @@
|
||||
name = real_name
|
||||
trauma = _trauma
|
||||
owner = trauma.owner
|
||||
copy_known_languages_from(owner, TRUE)
|
||||
human_image = get_flat_human_icon(null, pick(SSjob.occupations))
|
||||
|
||||
join = new
|
||||
join.Grant(src)
|
||||
hide = new
|
||||
hide.Grant(src)
|
||||
|
||||
/mob/camera/imaginary_friend/proc/Show()
|
||||
if(!client) //nobody home
|
||||
return
|
||||
@@ -91,9 +108,11 @@
|
||||
current_image = image(human_image, src, , MOB_LAYER, dir=src.dir)
|
||||
current_image.override = TRUE
|
||||
current_image.name = name
|
||||
if(hidden)
|
||||
current_image.alpha = 150
|
||||
|
||||
//Add new image to owner and friend
|
||||
if(owner.client)
|
||||
if(!hidden && owner.client)
|
||||
owner.client.images |= current_image
|
||||
|
||||
client.images |= current_image
|
||||
@@ -105,13 +124,7 @@
|
||||
client.images.Remove(human_image)
|
||||
return ..()
|
||||
|
||||
/mob/camera/imaginary_friend/proc/yank()
|
||||
if(!client) //don't bother if the friend is braindead
|
||||
return
|
||||
forceMove(get_turf(owner))
|
||||
Show()
|
||||
|
||||
/mob/camera/imaginary_friend/say(message)
|
||||
/mob/camera/imaginary_friend/say(message, bubble_type, var/list/spans = list(), sanitize = TRUE, datum/language/language = null, ignore_spam = FALSE, forced = null)
|
||||
if (!message)
|
||||
return
|
||||
|
||||
@@ -124,13 +137,16 @@
|
||||
|
||||
friend_talk(message)
|
||||
|
||||
/mob/camera/imaginary_friend/Hear(message, atom/movable/speaker, datum/language/message_language, raw_message, radio_freq, list/spans, message_mode)
|
||||
to_chat(src, compose_message(speaker, message_language, raw_message, radio_freq, spans, message_mode))
|
||||
|
||||
/mob/camera/imaginary_friend/proc/friend_talk(message)
|
||||
message = trim(copytext(sanitize(message), 1, MAX_MESSAGE_LEN))
|
||||
message = capitalize(trim(copytext(sanitize(message), 1, MAX_MESSAGE_LEN)))
|
||||
|
||||
if(!message)
|
||||
return
|
||||
|
||||
log_talk(src,"[key_name(src)] : [message]",LOGSAY)
|
||||
src.log_talk(message, LOG_SAY, tag="imaginary friend")
|
||||
|
||||
var/rendered = "<span class='game say'><span class='name'>[name]</span> <span class='message'>[say_quote(message)]</span></span>"
|
||||
var/dead_rendered = "<span class='game say'><span class='name'>[name] (Imaginary friend of [owner])</span> <span class='message'>[say_quote(message)]</span></span>"
|
||||
@@ -138,17 +154,68 @@
|
||||
to_chat(owner, "[rendered]")
|
||||
to_chat(src, "[rendered]")
|
||||
|
||||
//speech bubble
|
||||
if(owner.client)
|
||||
var/mutable_appearance/MA = mutable_appearance('icons/mob/talk.dmi', src, "default[say_test(message)]", FLY_LAYER)
|
||||
MA.appearance_flags = APPEARANCE_UI_IGNORE_ALPHA
|
||||
INVOKE_ASYNC(GLOBAL_PROC, /proc/flick_overlay, MA, list(owner.client), 30)
|
||||
|
||||
for(var/mob/M in GLOB.dead_mob_list)
|
||||
var/link = FOLLOW_LINK(M, owner)
|
||||
to_chat(M, "[link] [dead_rendered]")
|
||||
|
||||
/mob/camera/imaginary_friend/Move(NewLoc, Dir = 0)
|
||||
if(world.time < move_delay)
|
||||
return FALSE
|
||||
if(get_dist(src, owner) > 9)
|
||||
recall()
|
||||
move_delay = world.time + 10
|
||||
return FALSE
|
||||
forceMove(NewLoc)
|
||||
move_delay = world.time + 1
|
||||
|
||||
/mob/camera/imaginary_friend/forceMove(atom/destination)
|
||||
dir = get_dir(get_turf(src), destination)
|
||||
loc = destination
|
||||
if(get_dist(src, owner) > 9)
|
||||
yank()
|
||||
return
|
||||
Show()
|
||||
|
||||
/mob/camera/imaginary_friend/movement_delay()
|
||||
return 2
|
||||
/mob/camera/imaginary_friend/proc/recall()
|
||||
if(!owner || loc == owner)
|
||||
return FALSE
|
||||
forceMove(owner)
|
||||
|
||||
/datum/action/innate/imaginary_join
|
||||
name = "Join"
|
||||
desc = "Join your owner, following them from inside their mind."
|
||||
icon_icon = 'icons/mob/actions/actions_minor_antag.dmi'
|
||||
background_icon_state = "bg_revenant"
|
||||
button_icon_state = "join"
|
||||
|
||||
/datum/action/innate/imaginary_join/Activate()
|
||||
var/mob/camera/imaginary_friend/I = owner
|
||||
I.recall()
|
||||
|
||||
/datum/action/innate/imaginary_hide
|
||||
name = "Hide"
|
||||
desc = "Hide yourself from your owner's sight."
|
||||
icon_icon = 'icons/mob/actions/actions_minor_antag.dmi'
|
||||
background_icon_state = "bg_revenant"
|
||||
button_icon_state = "hide"
|
||||
|
||||
/datum/action/innate/imaginary_hide/proc/update_status()
|
||||
var/mob/camera/imaginary_friend/I = owner
|
||||
if(I.hidden)
|
||||
name = "Show"
|
||||
desc = "Become visible to your owner."
|
||||
button_icon_state = "unhide"
|
||||
else
|
||||
name = "Hide"
|
||||
desc = "Hide yourself from your owner's sight."
|
||||
button_icon_state = "hide"
|
||||
UpdateButtonIcon()
|
||||
|
||||
/datum/action/innate/imaginary_hide/Activate()
|
||||
var/mob/camera/imaginary_friend/I = owner
|
||||
I.hidden = !I.hidden
|
||||
I.Show()
|
||||
update_status()
|
||||
@@ -51,7 +51,7 @@
|
||||
if(prob(3))
|
||||
owner.emote("drool")
|
||||
else if(owner.stat == CONSCIOUS && prob(3))
|
||||
owner.say(pick_list_replacements(BRAIN_DAMAGE_FILE, "brain_damage"))
|
||||
owner.say(pick_list_replacements(BRAIN_DAMAGE_FILE, "brain_damage"), forced = "brain damage")
|
||||
..()
|
||||
|
||||
/datum/brain_trauma/mild/dumbness/on_lose()
|
||||
@@ -176,7 +176,7 @@
|
||||
var/obj/item/I = owner.get_active_held_item()
|
||||
if(I)
|
||||
to_chat(owner, "<span class='warning'>Your fingers spasm!</span>")
|
||||
log_attack("[key_name(owner)] used [I] due to a Muscle Spasm.")
|
||||
owner.log_message("used [I] due to a Muscle Spasm", LOG_ATTACK)
|
||||
I.attack_self(owner)
|
||||
if(3)
|
||||
var/prev_intent = owner.a_intent
|
||||
@@ -192,14 +192,14 @@
|
||||
targets += M
|
||||
if(LAZYLEN(targets))
|
||||
to_chat(owner, "<span class='warning'>Your arm spasms!</span>")
|
||||
log_attack("[key_name(owner)] attacked someone due to a Muscle Spasm.") //the following attack will log itself
|
||||
owner.log_message(" attacked someone due to a Muscle Spasm") //the following attack will log itself
|
||||
owner.ClickOn(pick(targets))
|
||||
owner.a_intent = prev_intent
|
||||
if(4)
|
||||
var/prev_intent = owner.a_intent
|
||||
owner.a_intent = INTENT_HARM
|
||||
to_chat(owner, "<span class='warning'>Your arm spasms!</span>")
|
||||
log_attack("[key_name(owner)] attacked himself to a Muscle Spasm.")
|
||||
owner.log_message("attacked [owner.p_them()]self to a Muscle Spasm", LOG_ATTACK)
|
||||
owner.ClickOn(owner)
|
||||
owner.a_intent = prev_intent
|
||||
if(5)
|
||||
@@ -211,6 +211,6 @@
|
||||
targets += T
|
||||
if(LAZYLEN(targets) && I)
|
||||
to_chat(owner, "<span class='warning'>Your arm spasms!</span>")
|
||||
log_attack("[key_name(owner)] threw [I] due to a Muscle Spasm.")
|
||||
owner.log_message("threw [I] due to a Muscle Spasm", LOG_ATTACK)
|
||||
owner.throw_item(pick(targets))
|
||||
..()
|
||||
|
||||
@@ -107,7 +107,7 @@
|
||||
if(2)
|
||||
owner.emote("scream")
|
||||
owner.Jitter(5)
|
||||
owner.say("AAAAH!!")
|
||||
owner.say("AAAAH!!", forced = "phobia")
|
||||
if(reason)
|
||||
owner.pointed(reason)
|
||||
if(3)
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
if(prob(4))
|
||||
if(prob(33) && (owner.IsStun() || owner.IsKnockdown() || owner.IsUnconscious()))
|
||||
speak("unstun", TRUE)
|
||||
else if(prob(60) && owner.health <= HEALTH_THRESHOLD_CRIT)
|
||||
else if(prob(60) && owner.health <= owner.crit_threshold)
|
||||
speak("heal", TRUE)
|
||||
else if(prob(30) && owner.a_intent == INTENT_HARM)
|
||||
speak("aggressive")
|
||||
@@ -133,4 +133,4 @@
|
||||
QDEL_NULL(psychotic_brawling)
|
||||
|
||||
/datum/brain_trauma/special/psychotic_brawling/bath_salts
|
||||
name = "Chemical Violent Psychosis"
|
||||
name = "Chemical Violent Psychosis"
|
||||
|
||||
@@ -138,11 +138,11 @@
|
||||
to_chat(src, "<span class='notice'>As a split personality, you cannot do anything but observe. However, you will eventually gain control of your body, switching places with the current personality.</span>")
|
||||
to_chat(src, "<span class='warning'><b>Do not commit suicide or put the body in a deadly position. Behave like you care about it as much as the owner.</b></span>")
|
||||
|
||||
/mob/living/split_personality/say(message)
|
||||
/mob/living/split_personality/say(message, bubble_type, var/list/spans = list(), sanitize = TRUE, datum/language/language = null, ignore_spam = FALSE, forced = null)
|
||||
to_chat(src, "<span class='warning'>You cannot speak, your other self is controlling your body!</span>")
|
||||
return FALSE
|
||||
|
||||
/mob/living/split_personality/emote(message)
|
||||
/mob/living/split_personality/emote(act, m_type = null, message = null, intentional = FALSE)
|
||||
return
|
||||
|
||||
///////////////BRAINWASHING////////////////////
|
||||
|
||||
Reference in New Issue
Block a user