mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-19 11:05:03 +01:00
Say code rewrite, Silicon jerks now using new saycode.
Tracking added for AI's and Observers Instead of calling GetVoice() over and over for everyone that can hear you we're checking a variable that is updated with Life() removed a bunch of my debug verbs. Conflicts: code/game/machinery/telecomms/broadcaster.dm code/modules/mob/dead/observer/observer.dm code/modules/mob/living/carbon/human/human_defines.dm code/modules/mob/living/silicon/say.dm
This commit is contained in:
@@ -76,6 +76,31 @@
|
||||
real_name = name
|
||||
..()
|
||||
|
||||
|
||||
/mob/dead/observer/Topic(href, href_list)
|
||||
if (href_list["track"])
|
||||
var/mob/target = locate(href_list["track"]) in mob_list
|
||||
if(target)
|
||||
ManualFollow(target)
|
||||
|
||||
|
||||
|
||||
/mob/dead/attackby(obj/item/W, mob/user)
|
||||
if(istype(W,/obj/item/weapon/tome))
|
||||
var/mob/dead/M = src
|
||||
if(src.invisibility != 0)
|
||||
M.invisibility = 0
|
||||
user.visible_message( \
|
||||
"\red [user] drags ghost, [M], to our plan of reality!", \
|
||||
"\red You drag [M] to our plan of reality!" \
|
||||
)
|
||||
else
|
||||
user.visible_message ( \
|
||||
"\red [user] just tried to smash his book into that ghost! It's not very effective", \
|
||||
"\red You get the feeling that the ghost can't become any more visible." \
|
||||
)
|
||||
|
||||
|
||||
/mob/dead/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
|
||||
return 1
|
||||
/*
|
||||
|
||||
@@ -23,6 +23,16 @@
|
||||
var/mob/living/carbon/human/H = speaker
|
||||
speaker_name = H.GetVoice()
|
||||
|
||||
if(italics)
|
||||
message = "<i>[message]</i>"
|
||||
|
||||
var/track = null
|
||||
if(istype(src, /mob/dead/observer))
|
||||
if(speaker_name != speaker.real_name)
|
||||
speaker_name = "[speaker.real_name] ([speaker_name])"
|
||||
track = "(<a href='byond://?src=\ref[src];track=\ref[speaker]'>follow</a>) "
|
||||
if(client.prefs.toggles & CHAT_GHOSTEARS && speaker in view(src))
|
||||
message = "<b>[message]</b>"
|
||||
|
||||
if(sdisabilities & DEAF || ear_deaf)
|
||||
if(speaker == src)
|
||||
@@ -30,15 +40,15 @@
|
||||
else
|
||||
src << "<span class='name'>[speaker_name]</span>[alt_name] talks but you cannot hear them."
|
||||
else
|
||||
src << "<span class='game say'><span class='name'>[speaker_name]</span>[alt_name] <span class='[style]'>[verb], <span class='message'>\"[message]\"</span></span></span>"
|
||||
src << "<span class='game say'><span class='name'>[speaker_name]</span>[alt_name] [track]<span class='[style]'>[verb], <span class='message'>\"[message]\"</span></span></span>"
|
||||
|
||||
|
||||
|
||||
/mob/proc/hear_radio(var/message, var/verb="says", var/datum/language/language=null, var/part_a, var/part_b, var/mob/speaker = null)
|
||||
/mob/proc/hear_radio(var/message, var/verb="says", var/datum/language/language=null, var/part_a, var/part_b, var/mob/speaker = null, var/hard_to_hear = 0)
|
||||
if(!client)
|
||||
return
|
||||
var/track = ""
|
||||
|
||||
var/style = "body"
|
||||
world << "in hear_radio and language = [language ? language.name : null]"
|
||||
if(language)
|
||||
world << "in language check"
|
||||
if(!say_understands(speaker,language))
|
||||
@@ -46,6 +56,9 @@
|
||||
verb = language.speech_verb
|
||||
style = language.colour
|
||||
|
||||
if(hard_to_hear)
|
||||
message = stars(message)
|
||||
|
||||
if(verb == "says")
|
||||
var/ending = copytext(message,length(message))
|
||||
if(ending=="!")
|
||||
@@ -56,10 +69,39 @@
|
||||
var/speaker_name = speaker.name
|
||||
if(istype(speaker, /mob/living/carbon/human))
|
||||
var/mob/living/carbon/human/H = speaker
|
||||
speaker_name = H.GetVoice()
|
||||
if(H.voice)
|
||||
speaker_name = H.voice
|
||||
|
||||
if(hard_to_hear)
|
||||
speaker_name = "unknown"
|
||||
|
||||
if(istype(src, /mob/living/silicon/ai) && !hard_to_hear)
|
||||
var/jobname // the mob's "job"
|
||||
if (ishuman(speaker))
|
||||
var/mob/living/carbon/human/H = speaker
|
||||
jobname = H.get_assignment()
|
||||
else if (iscarbon(speaker)) // Nonhuman carbon mob
|
||||
jobname = "No id"
|
||||
else if (isAI(speaker))
|
||||
jobname = "AI"
|
||||
else if (isrobot(speaker))
|
||||
jobname = "Cyborg"
|
||||
else if (istype(speaker, /mob/living/silicon/pai))
|
||||
jobname = "Personal AI"
|
||||
else
|
||||
jobname = "Unknown"
|
||||
|
||||
track = "<a href='byond://?src=\ref[src];track=\ref[speaker]'>[speaker_name] ([jobname])</a>"
|
||||
|
||||
if(istype(src, /mob/dead/observer))
|
||||
if(speaker_name != speaker.real_name)
|
||||
speaker_name = "[speaker.real_name] ([speaker_name])"
|
||||
track = "[speaker_name] (<a href='byond://?src=\ref[src];track=\ref[speaker]'>follow</a>)"
|
||||
|
||||
if(sdisabilities & DEAF || ear_deaf)
|
||||
if(prob(20))
|
||||
src << "<span class='warning'>You feel your headset vibrate but can hear nothing from it!</span>"
|
||||
else if(track)
|
||||
src << "[part_a][track][part_b]<span class=\"[style]\"> [verb], \"[message]\"</span></span></span>"
|
||||
else
|
||||
src << "[part_a][speaker_name][part_b]<span class=\"[style]\"> [verb], \"[message]\"</span></span></span>"
|
||||
|
||||
@@ -46,6 +46,8 @@
|
||||
var/icon/stand_icon = null
|
||||
var/icon/lying_icon = null
|
||||
|
||||
var/voice = "" //Instead of new say code calling GetVoice() over and over and over, we're just going to ask this variable, which gets updated in Life()
|
||||
|
||||
var/speech_problem_flag = 0
|
||||
|
||||
var/miming = null //Toggle for the mime's abilities.
|
||||
|
||||
@@ -79,6 +79,8 @@
|
||||
if(life_tick%30==15)
|
||||
hud_updateflag = 1022
|
||||
|
||||
voice = GetVoice()
|
||||
|
||||
//No need to update all of these procs if the guy is dead.
|
||||
if(stat != DEAD && !in_stasis)
|
||||
if(air_master.current_cycle%4==2 || failed_last_breath) //First, resolve location and get a breath
|
||||
|
||||
@@ -118,7 +118,7 @@ var/list/department_radio_keys = list(
|
||||
spawn(30) del(speech_bubble)
|
||||
|
||||
if(used_radios.len)
|
||||
for(var/mob/M in hearers(5, src))
|
||||
for(var/mob/living/M in hearers(5, src))
|
||||
if(M != src)
|
||||
M.show_message("<span class='notice'>[src] talks into [used_radios.len ? used_radios[1] : "radio"]</span>")
|
||||
|
||||
@@ -136,5 +136,3 @@ var/list/department_radio_keys = list(
|
||||
|
||||
/mob/living/proc/GetVoice()
|
||||
return name
|
||||
|
||||
|
||||
|
||||
@@ -433,9 +433,13 @@ var/list/ai_list = list()
|
||||
|
||||
if (href_list["track"])
|
||||
var/mob/target = locate(href_list["track"]) in mob_list
|
||||
/*
|
||||
var/mob/living/silicon/ai/A = locate(href_list["track2"]) in mob_list
|
||||
if(A && target)
|
||||
A.ai_actual_track(target)
|
||||
*/
|
||||
if(target)
|
||||
ai_actual_track(target)
|
||||
return
|
||||
|
||||
else if (href_list["faketrack"])
|
||||
|
||||
@@ -2,11 +2,15 @@
|
||||
var/ending = copytext(text, length(text))
|
||||
|
||||
if (ending == "?")
|
||||
return "queries, \"[text]\"";
|
||||
return "queries"
|
||||
else if (ending == "!")
|
||||
return "declares, \"[text]\"";
|
||||
return "declares"
|
||||
|
||||
return "states, \"[text]\"";
|
||||
return "states"
|
||||
|
||||
#define IS_AI 1
|
||||
#define IS_ROBOT 2
|
||||
#define IS_PAI 3
|
||||
|
||||
/mob/living/silicon/say(var/message)
|
||||
if (!message)
|
||||
@@ -23,45 +27,97 @@
|
||||
message = trim(copytext(sanitize(message), 1, MAX_MESSAGE_LEN))
|
||||
return say_dead(message)
|
||||
|
||||
var/bot_type = 0 //Let's not do a fuck ton of type checks, thanks.
|
||||
if(istype(src, /mob/living/silicon/ai))
|
||||
bot_type = IS_AI
|
||||
else if(istype(src, /mob/living/silicon/robot))
|
||||
bot_type = IS_ROBOT
|
||||
else if(istype(src, /mob/living/silicon/pai))
|
||||
bot_type = IS_PAI
|
||||
|
||||
var/mob/living/silicon/ai/AI = src //and let's not declare vars over and over and over for these guys.
|
||||
var/mob/living/silicon/robot/R = src
|
||||
var/mob/living/silicon/pai/P = src
|
||||
|
||||
|
||||
//Must be concious to speak
|
||||
if (stat)
|
||||
return
|
||||
|
||||
if (length(message) >= 2)
|
||||
var/prefix = copytext(message, 1, 3)
|
||||
if (department_radio_keys[prefix] == "binary")
|
||||
if(istype(src, /mob/living/silicon/pai))
|
||||
return ..(message)
|
||||
message = copytext(message, 3)
|
||||
message = trim(copytext(sanitize(message), 1, MAX_MESSAGE_LEN))
|
||||
var/verb = say_quote(message)
|
||||
var/message_mode = null
|
||||
|
||||
// TODO: move the component system up to silicon so we don't have to use this ugly hack..
|
||||
if(istype(src, /mob/living/silicon/robot))
|
||||
var/mob/living/silicon/robot/R = src
|
||||
if(!R.is_component_functioning("comms"))
|
||||
src << "\red Your binary communications component isn't functional."
|
||||
|
||||
if(copytext(message,1,2) == ";")
|
||||
message_mode = "general" // I don't know why but regular radio = fuck you we ain't broadcasting, pAI mode was what was in old say code.
|
||||
message = trim(copytext(message,2))
|
||||
|
||||
else if(length(message) >= 2)
|
||||
var/channel_prefix = copytext(message, 1 ,3)
|
||||
if(!message_mode)
|
||||
message_mode = department_radio_keys[channel_prefix]
|
||||
|
||||
if(message_mode && bot_type == IS_ROBOT)
|
||||
if(message_mode != "binary" && !R.is_component_functioning("radio"))
|
||||
src << "\red Your radio isn't functional at this time."
|
||||
return
|
||||
|
||||
|
||||
if(message_mode && message_mode != "general")
|
||||
message = trim(copytext(message,3))
|
||||
|
||||
switch(message_mode)
|
||||
if("department")
|
||||
switch(bot_type)
|
||||
if(IS_AI)
|
||||
AI.holopad_talk(message)
|
||||
if(IS_ROBOT)
|
||||
log_say("[key_name(src)] : [message]")
|
||||
R.radio.talk_into(src,message,message_mode,verb)
|
||||
if(IS_PAI)
|
||||
log_say("[key_name(src)] : [message]")
|
||||
P.radio.talk_into(src,message,message_mode,verb)
|
||||
return
|
||||
|
||||
if("binary")
|
||||
switch(bot_type)
|
||||
if(IS_ROBOT)
|
||||
if(!R.is_component_functioning("comms"))
|
||||
src << "\red Your binary communications component isn't functional."
|
||||
return
|
||||
if(IS_PAI)
|
||||
src << "You do not appear to have that function"
|
||||
return
|
||||
robot_talk(message)
|
||||
return
|
||||
if("general")
|
||||
switch(bot_type)
|
||||
if(IS_AI)
|
||||
src << "Yeah, not yet, sorry"
|
||||
if(IS_ROBOT)
|
||||
log_say("[key_name(src)] : [message]")
|
||||
R.radio.talk_into(src,message,null,verb)
|
||||
if(IS_PAI)
|
||||
log_say("[key_name(src)] : [message]")
|
||||
P.radio.talk_into(src,message,null,verb)
|
||||
return
|
||||
|
||||
else if (department_radio_keys[prefix] == "alientalk")
|
||||
if(!alien_talk_understand) return
|
||||
message = copytext(message, 3)
|
||||
message = trim(copytext(sanitize(message), 1, MAX_MESSAGE_LEN))
|
||||
|
||||
alien_talk(message)
|
||||
else if (department_radio_keys[prefix] == "department")
|
||||
if(isAI(src)&&client)//For patching directly into AI holopads.
|
||||
var/mob/living/silicon/ai/U = src
|
||||
message = copytext(message, 3)
|
||||
message = trim(copytext(sanitize(message), 1, MAX_MESSAGE_LEN))
|
||||
U.holopad_talk(message)
|
||||
else//Will not allow anyone by an active AI to use this function.
|
||||
src << "This function is not available to you."
|
||||
return
|
||||
else
|
||||
return ..(message)
|
||||
else
|
||||
return ..(message)
|
||||
if(message_mode && message_mode in radiochannels)
|
||||
switch(bot_type)
|
||||
if(IS_AI)
|
||||
src << "You don't have this function yet, I'm working on it"
|
||||
return
|
||||
if(IS_ROBOT)
|
||||
log_say("[key_name(src)] : [message]")
|
||||
R.radio.talk_into(src,message,message_mode,verb)
|
||||
if(IS_PAI)
|
||||
log_say("[key_name(src)] : [message]")
|
||||
P.radio.talk_into(src,message,message_mode,verb)
|
||||
return
|
||||
|
||||
|
||||
return ..(message,null,verb)
|
||||
|
||||
//For holopads only. Usable by AI.
|
||||
/mob/living/silicon/ai/proc/holopad_talk(var/message)
|
||||
@@ -160,4 +216,8 @@
|
||||
for (var/mob/M in dead_mob_list)
|
||||
if(!istype(M,/mob/new_player) && !istype(M,/mob/living/carbon/brain)) //No meta-evesdropping
|
||||
rendered = "<i><span class='game say'>Robotic Talk, <span class='name'>[name]</span> <a href='byond://?src=\ref[M];follow2=\ref[M];follow=\ref[src]'>(Follow)</a> <span class='message'>[message_a]</span></span></i>"
|
||||
M.show_message(rendered, 2)
|
||||
M.show_message(rendered, 2)
|
||||
|
||||
#undef IS_AI
|
||||
#undef IS_ROBOT
|
||||
#undef IS_PAI
|
||||
|
||||
Reference in New Issue
Block a user