Skip to content

Commit

Permalink
Merge pull request tgstation#22596 from XDTM/NowListenClosely
Browse files Browse the repository at this point in the history
[Ready]Several Voice of God fixes
  • Loading branch information
ChangelingRain authored Jan 4, 2017
2 parents c0bdb98 + 9337cea commit 4098613
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 29 deletions.
8 changes: 5 additions & 3 deletions code/modules/mob/living/say.dm
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ var/list/department_radio_keys = list(

var/list/crit_allowed_modes = list(MODE_WHISPER,MODE_CHANGELING,MODE_ALIEN)

/mob/living/say(message, bubble_type,var/list/spans = list())
message = trim(copytext(sanitize(message), 1, MAX_MESSAGE_LEN))
/mob/living/say(message, bubble_type,var/list/spans = list(), sanitize = TRUE)
if(sanitize)
message = trim(copytext(sanitize(message), 1, MAX_MESSAGE_LEN))
if(!message || message == "")
return

Expand Down Expand Up @@ -250,7 +251,8 @@ var/list/crit_allowed_modes = list(MODE_WHISPER,MODE_CHANGELING,MODE_ALIEN)
var/mob/living/carbon/C = src
var/obj/item/organ/vocal_cords/V = C.getorganslot("vocal_cords")
if(V && V.can_speak_with())
C.say(V.speak_with(message), spans = V.spans)
C.say(V.handle_speech(message), spans = V.spans, sanitize = FALSE)
V.speak_with(message) //words come before actions
return TRUE
return FALSE

Expand Down
12 changes: 6 additions & 6 deletions code/modules/mob/living/silicon/silicon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@
return


/mob/living/silicon/proc/statelaws()
/mob/living/silicon/proc/statelaws(force = 0)

//"radiomod" is inserted before a hardcoded message to change if and how it is handled by an internal radio.
src.say("[radiomod] Current Active Laws:")
Expand All @@ -203,29 +203,29 @@

if (src.laws.devillaws && src.laws.devillaws.len)
for(var/index = 1, index <= src.laws.devillaws.len, index++)
if (src.devillawcheck[index] == "Yes")
if (src.devillawcheck[index] == "Yes" || force)
src.say("[radiomod] 666. [src.laws.devillaws[index]]")
sleep(10)


if (src.laws.zeroth)
if (src.lawcheck[1] == "Yes")
if (src.lawcheck[1] == "Yes" || force)
src.say("[radiomod] 0. [src.laws.zeroth]")
sleep(10)

for (var/index = 1, index <= src.laws.ion.len, index++)
var/law = src.laws.ion[index]
var/num = ionnum()
if (length(law) > 0)
if (src.ioncheck[index] == "Yes")
if (src.ioncheck[index] == "Yes" || force)
src.say("[radiomod] [num]. [law]")
sleep(10)

for (var/index = 1, index <= src.laws.inherent.len, index++)
var/law = src.laws.inherent[index]

if (length(law) > 0)
if (src.lawcheck[index+1] == "Yes")
if (src.lawcheck[index+1] == "Yes" || force)
src.say("[radiomod] [number]. [law]")
sleep(10)
number++
Expand All @@ -236,7 +236,7 @@

if (length(law) > 0)
if(src.lawcheck.len >= number+1)
if (src.lawcheck[number+1] == "Yes")
if (src.lawcheck[number+1] == "Yes" || force)
src.say("[radiomod] [number]. [law]")
sleep(10)
number++
Expand Down
55 changes: 35 additions & 20 deletions code/modules/surgery/organs/vocal_cords.dm
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,11 @@ var/static/regex/multispin_words = regex("like a record baby")
/obj/item/organ/vocal_cords/proc/can_speak_with() //if there is any limitation to speaking with these cords
return TRUE

/obj/item/organ/vocal_cords/proc/speak_with(message) //do what the organ does and modify speech if needed
return message
/obj/item/organ/vocal_cords/proc/speak_with(message) //do what the organ does
return

/obj/item/organ/vocal_cords/proc/handle_speech(message) //change the message
return message

//Colossus drop, forces the listeners to obey certain commands
/obj/item/organ/vocal_cords/colossus
Expand Down Expand Up @@ -91,7 +93,7 @@ var/static/regex/multispin_words = regex("like a record baby")
if(world.time < cords.next_command)
owner << "<span class='notice'>You must wait [(cords.next_command - world.time)/10] seconds before Speaking again.</span>"
return
var/command = stripped_input(owner, "Speak with the Voice of God", "Command", max_length = 140)
var/command = input(owner, "Speak with the Voice of God", "Command")
if(!command)
return
owner.say(".x[command]")
Expand All @@ -109,9 +111,11 @@ var/static/regex/multispin_words = regex("like a record baby")
return FALSE
return TRUE

/obj/item/organ/vocal_cords/colossus/handle_speech(message)
return uppertext(message)

/obj/item/organ/vocal_cords/colossus/speak_with(message)
message = lowertext(message)
var/spoken = uppertext(message)
playsound(get_turf(owner), 'sound/magic/clockwork/invoke_general.ogg', 300, 1, 5)

var/mob/living/list/listeners = list()
Expand Down Expand Up @@ -145,23 +149,33 @@ var/static/regex/multispin_words = regex("like a record baby")
power_multiplier *= 2
spans = list("ratvar")

//Try to check if the speaker specified a name or a job to focus on
var/list/specific_listeners = list()
var/found_string = null

for(var/V in listeners)
var/mob/living/L = V
var/start
if(L.mind && L.mind.devilinfo && findtext(message, L.mind.devilinfo.truename))
start = findtext(message, L.mind.devilinfo.truename)
listeners = list(L)
var/start = findtext(message, L.mind.devilinfo.truename)
listeners = list(L) //let's be honest you're never going to find two devils with the same name
power_multiplier *= 5 //if you're a devil and god himself addressed you, you fucked up
//Cut out the name so it doesn't trigger commands
message = copytext(message, 0, start)+copytext(message, start + length(L.mind.devilinfo.truename), length(message) + 1)
break
else if(findtext(message, L.real_name))
start = findtext(message, L.real_name)
listeners = list(L) //focus on a particular person
power_multiplier *= 2
else if(findtext(message, L.real_name) == 1)
specific_listeners += L //focus on those with the specified name
//Cut out the name so it doesn't trigger commands
message = copytext(message, 0, start)+copytext(message, start + length(L.real_name), length(message) + 1)
break
found_string = L.real_name

else if(L.mind && findtext(message, L.mind.assigned_role) == 1)
specific_listeners += L //focus on those with the specified job
//Cut out the job so it doesn't trigger commands
found_string = L.mind.assigned_role

if(specific_listeners.len)
listeners = specific_listeners
power_multiplier *= (1 + (1/specific_listeners.len)) //2x on a single guy, 1.5x on two and so on
message = copytext(message, 0, 1)+copytext(message, 1 + length(found_string), length(message) + 1)

//STUN
if(findtext(message, stun_words))
Expand All @@ -181,7 +195,7 @@ var/static/regex/multispin_words = regex("like a record baby")
else if((findtext(message, sleep_words)))
for(var/V in listeners)
var/mob/living/L = V
L.Sleeping(3 * power_multiplier)
L.Sleeping(2 * power_multiplier)
next_command = world.time + cooldown_stun

//VOMIT
Expand All @@ -203,7 +217,7 @@ var/static/regex/multispin_words = regex("like a record baby")
for(var/V in listeners)
var/mob/living/L = V
new /obj/effect/hallucination/delusion(get_turf(L),L,duration=150 * power_multiplier,skip_nearby=0)
next_command = world.time + cooldown_damage
next_command = world.time + cooldown_meme

//WAKE UP
else if((findtext(message, wakeup_words)))
Expand Down Expand Up @@ -275,8 +289,9 @@ var/static/regex/multispin_words = regex("like a record baby")
//STATE LAWS
else if((findtext(message, statelaws_words)))
for(var/mob/living/silicon/S in listeners)
S.statelaws()
next_command = world.time + cooldown_meme
S.checklaws()
S.statelaws(force = 1)
next_command = world.time + cooldown_stun

//MOVE
else if((findtext(message, move_words)))
Expand Down Expand Up @@ -416,7 +431,9 @@ var/static/regex/multispin_words = regex("like a record baby")
if(owner.mind && owner.mind.assigned_role == "Clown")
for(var/mob/living/carbon/C in listeners)
C.slip(0,7 * power_multiplier)
next_command = world.time + cooldown_meme
next_command = world.time + cooldown_stun
else
next_command = world.time + cooldown_meme

//RIGHT ROUND
else if((findtext(message, multispin_words)))
Expand All @@ -428,5 +445,3 @@ var/static/regex/multispin_words = regex("like a record baby")
else
next_command = world.time + cooldown_none

return spoken

0 comments on commit 4098613

Please sign in to comment.