mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
Adds ability to set up and edit idle bellymode messages
This commit is contained in:
@@ -439,7 +439,7 @@
|
||||
// This is useful in customization boxes and such. The delimiter right now is \n\n so
|
||||
// in message boxes, this looks nice and is easily delimited.
|
||||
/obj/belly/proc/get_messages(type, delim = "\n\n")
|
||||
ASSERT(type == "smo" || type == "smi" || type == "dmo" || type == "dmp" || type == "em")
|
||||
ASSERT(type == "smo" || type == "smi" || type == "dmo" || type == "dmp" || type == "em" || type == "im_digest" || type == "im_hold" || type == "im_absorb" || type == "im_heal" || type == "im_drain")
|
||||
|
||||
var/list/raw_messages
|
||||
switch(type)
|
||||
@@ -453,15 +453,27 @@
|
||||
raw_messages = digest_messages_prey
|
||||
if("em")
|
||||
raw_messages = examine_messages
|
||||
if("im_digest")
|
||||
raw_messages = emote_lists[DM_DIGEST]
|
||||
if("im_hold")
|
||||
raw_messages = emote_lists[DM_HOLD]
|
||||
if("im_absorb")
|
||||
raw_messages = emote_lists[DM_ABSORB]
|
||||
if("im_heal")
|
||||
raw_messages = emote_lists[DM_HEAL]
|
||||
if("im_drain")
|
||||
raw_messages = emote_lists[DM_DRAIN]
|
||||
|
||||
var/messages = list2text(raw_messages, delim)
|
||||
var/messages = null
|
||||
if(raw_messages)
|
||||
messages = list2text(raw_messages, delim)
|
||||
return messages
|
||||
|
||||
// The next function sets the messages on the belly, from human-readable var
|
||||
// replacement strings and linebreaks as delimiters (two \n\n by default).
|
||||
// They also sanitize the messages.
|
||||
/obj/belly/proc/set_messages(raw_text, type, delim = "\n\n")
|
||||
ASSERT(type == "smo" || type == "smi" || type == "dmo" || type == "dmp" || type == "em")
|
||||
ASSERT(type == "smo" || type == "smi" || type == "dmo" || type == "dmp" || type == "em" || type == "im_digest" || type == "im_hold" || type == "im_absorb" || type == "im_heal" || type == "im_drain")
|
||||
|
||||
var/list/raw_list = text2list(html_encode(raw_text),delim)
|
||||
if(raw_list.len > 10)
|
||||
@@ -469,9 +481,12 @@
|
||||
log_debug("[owner] tried to set [lowertext(name)] with 11+ messages")
|
||||
|
||||
for(var/i = 1, i <= raw_list.len, i++)
|
||||
if(length(raw_list[i]) > 160 || length(raw_list[i]) < 10) //160 is fudged value due to htmlencoding increasing the size
|
||||
if((length(raw_list[i]) > 160 || length(raw_list[i]) < 10) && !(type == "im_digest" || type == "im_hold" || type == "im_absorb" || type == "im_heal" || type == "im_drain")) //160 is fudged value due to htmlencoding increasing the size
|
||||
raw_list.Cut(i,i)
|
||||
log_debug("[owner] tried to set [lowertext(name)] with >121 or <10 char message")
|
||||
else if((type == "im_digest" || type == "im_hold" || type == "im_absorb" || type == "im_heal" || type == "im_drain") && (length(raw_list[i]) > 510 || length(raw_list[i]) < 10))
|
||||
raw_list.Cut(i,i)
|
||||
log_debug("[owner] tried to set [lowertext(name)] idle message with >501 or <10 char message")
|
||||
else
|
||||
raw_list[i] = readd_quotes(raw_list[i])
|
||||
//Also fix % sign for var replacement
|
||||
@@ -490,6 +505,16 @@
|
||||
digest_messages_prey = raw_list
|
||||
if("em")
|
||||
examine_messages = raw_list
|
||||
if("im_digest")
|
||||
emote_lists[DM_DIGEST] = raw_list
|
||||
if("im_hold")
|
||||
emote_lists[DM_HOLD] = raw_list
|
||||
if("im_absorb")
|
||||
emote_lists[DM_ABSORB] = raw_list
|
||||
if("im_heal")
|
||||
emote_lists[DM_HEAL] = raw_list
|
||||
if("im_drain")
|
||||
emote_lists[DM_DRAIN] = raw_list
|
||||
|
||||
return
|
||||
|
||||
|
||||
@@ -61,7 +61,18 @@
|
||||
for(var/mob/living/M in contents)
|
||||
if(digest_mode == DM_DIGEST && !M.digestable)
|
||||
continue // don't give digesty messages to indigestible people
|
||||
to_chat(M, "<span class='notice'>[pick(EL)]</span>")
|
||||
var/living_count = 0
|
||||
for(var/mob/living/L in contents)
|
||||
living_count++
|
||||
|
||||
var/raw_message = pick(EL)
|
||||
var/formatted_message
|
||||
formatted_message = replacetext(raw_message, "%belly", lowertext(name))
|
||||
formatted_message = replacetext(formatted_message, "%pred", owner)
|
||||
formatted_message = replacetext(formatted_message, "%prey", english_list(contents))
|
||||
formatted_message = replacetext(formatted_message, "%count", contents.len)
|
||||
formatted_message = replacetext(formatted_message, "%countprey", living_count)
|
||||
to_chat(M, "<span class='notice'>[formatted_message]</span>")
|
||||
|
||||
if(!digestion_noise_chance)
|
||||
digestion_noise_chance = DM.noise_chance
|
||||
|
||||
@@ -734,7 +734,7 @@
|
||||
host.vore_selected.desc = new_desc
|
||||
. = TRUE
|
||||
if("b_msgs")
|
||||
alert(user,"Setting abusive or deceptive messages will result in a ban. Consider this your warning. Max 150 characters per message, max 10 messages per topic.","Really, don't.")
|
||||
alert(user,"Setting abusive or deceptive messages will result in a ban. Consider this your warning. Max 150 characters per message (500 for idle messages), max 10 messages per topic.","Really, don't.")
|
||||
var/help = " Press enter twice to separate messages. '%pred' will be replaced with your name. '%prey' will be replaced with the prey's name. '%belly' will be replaced with your belly's name. '%count' will be replaced with the number of anything in your belly. '%countprey' will be replaced with the number of living prey in your belly."
|
||||
switch(params["msgtype"])
|
||||
if("dmp")
|
||||
@@ -762,6 +762,31 @@
|
||||
if(new_message)
|
||||
host.vore_selected.set_messages(new_message,"em")
|
||||
|
||||
if("im_digest")
|
||||
var/new_message = input(user,"These are sent to prey every minute when you are on Digest mode. Write them in 2nd person ('%pred's %belly squishes down on you.')."+help,"Idle Message (Digest)",host.vore_selected.get_messages("im_digest")) as message
|
||||
if(new_message)
|
||||
host.vore_selected.set_messages(new_message,"im_digest")
|
||||
|
||||
if("im_hold")
|
||||
var/new_message = input(user,"These are sent to prey every minute when you are on Hold mode. Write them in 2nd person ('%pred's %belly squishes down on you.')"+help,"Idle Message (Hold)",host.vore_selected.get_messages("im_hold")) as message
|
||||
if(new_message)
|
||||
host.vore_selected.set_messages(new_message,"im_hold")
|
||||
|
||||
if("im_absorb")
|
||||
var/new_message = input(user,"These are sent to prey every minute when you are on Absorb mode. Write them in 2nd person ('%pred's %belly squishes down on you.')"+help,"Idle Message (Absorb)",host.vore_selected.get_messages("im_absorb")) as message
|
||||
if(new_message)
|
||||
host.vore_selected.set_messages(new_message,"im_absorb")
|
||||
|
||||
if("im_heal")
|
||||
var/new_message = input(user,"These are sent to prey every minute when you are on Heal mode. Write them in 2nd person ('%pred's %belly squishes down on you.')"+help,"Idle Message (Heal)",host.vore_selected.get_messages("im_heal")) as message
|
||||
if(new_message)
|
||||
host.vore_selected.set_messages(new_message,"im_heal")
|
||||
|
||||
if("im_drain")
|
||||
var/new_message = input(user,"These are sent to prey every minute when you are on Drain mode. Write them in 2nd person ('%pred's %belly squishes down on you.')"+help,"Idle Message (Drain)",host.vore_selected.get_messages("im_drain")) as message
|
||||
if(new_message)
|
||||
host.vore_selected.set_messages(new_message,"im_drain")
|
||||
|
||||
if("reset")
|
||||
var/confirm = alert(user,"This will delete any custom messages. Are you sure?","Confirmation","DELETE","Cancel")
|
||||
if(confirm == "DELETE")
|
||||
@@ -769,6 +794,8 @@
|
||||
host.vore_selected.digest_messages_owner = initial(host.vore_selected.digest_messages_owner)
|
||||
host.vore_selected.struggle_messages_outside = initial(host.vore_selected.struggle_messages_outside)
|
||||
host.vore_selected.struggle_messages_inside = initial(host.vore_selected.struggle_messages_inside)
|
||||
host.vore_selected.examine_messages = initial(host.vore_selected.examine_messages)
|
||||
host.vore_selected.emote_lists = initial(host.vore_selected.emote_lists)
|
||||
. = TRUE
|
||||
if("b_verb")
|
||||
var/new_verb = html_encode(input(usr,"New verb when eating (infinitive tense, e.g. nom or swallow):","New Verb") as text|null)
|
||||
|
||||
@@ -420,6 +420,21 @@ const VoreSelectedBelly = (props, context) => {
|
||||
<Button
|
||||
onClick={() => act("set_attribute", { attribute: "b_msgs", msgtype: "em" })}
|
||||
content="Examine Message (when full)" />
|
||||
<Button
|
||||
onClick={() => act("set_attribute", { attribute: "b_msgs", msgtype: "im_digest" })}
|
||||
content="Idle Messages (Digest)" />
|
||||
<Button
|
||||
onClick={() => act("set_attribute", { attribute: "b_msgs", msgtype: "im_hold" })}
|
||||
content="Idle Messages (Hold)" />
|
||||
<Button
|
||||
onClick={() => act("set_attribute", { attribute: "b_msgs", msgtype: "im_absorb" })}
|
||||
content="Idle Messages (Absorb)" />
|
||||
<Button
|
||||
onClick={() => act("set_attribute", { attribute: "b_msgs", msgtype: "im_heal" })}
|
||||
content="Idle Messages (Heal)" />
|
||||
<Button
|
||||
onClick={() => act("set_attribute", { attribute: "b_msgs", msgtype: "im_drain" })}
|
||||
content="Idle Messages (Drain)" />
|
||||
<Button
|
||||
color="red"
|
||||
onClick={() => act("set_attribute", { attribute: "b_msgs", msgtype: "reset" })}
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user