Merge pull request #3652 from CHOMPStation2/upstream-merge-12190

[MIRROR] Adding text variables to vore-belly descriptions
This commit is contained in:
Razgriz
2022-02-13 01:17:24 -07:00
committed by GitHub
2 changed files with 30 additions and 5 deletions
+19 -3
View File
@@ -294,10 +294,21 @@
if(isliving(thing))
var/mob/living/M = thing
M.updateVRPanel()
var/raw_desc //Let's use this to avoid needing to write the reformat code twice
if(absorbed_desc && M.absorbed)
to_chat(M, "<span class='notice'><B>[absorbed_desc]</B></span>")
raw_desc = absorbed_desc
else if(desc)
to_chat(M, "<span class='notice'><B>[desc]</B></span>")
raw_desc = desc
//Was there a description text? If so, it's time to format it!
if(raw_desc)
//Replace placeholder vars
var/formatted_desc
formatted_desc = replacetext(raw_desc, "%belly", lowertext(name)) //replace with this belly's name
formatted_desc = replacetext(formatted_desc, "%pred", owner) //replace with this belly's owner
formatted_desc = replacetext(formatted_desc, "%prey", M) //replace with whatever mob entered into this belly
to_chat(M, "<span class='notice'><B>[formatted_desc]</B></span>")
var/taste
if(can_taste && (taste = M.get_taste_message(FALSE)))
to_chat(owner, "<span class='notice'>[M] tastes of [taste].</span>")
@@ -758,7 +769,12 @@
if(absorbed_desc)
to_chat(M, "<span class='notice'><B>[absorbed_desc]</B></span>")
//Replace placeholder vars
var/formatted_abs_desc
formatted_abs_desc = replacetext(absorbed_desc, "%belly", lowertext(name)) //replace with this belly's name
formatted_abs_desc = replacetext(formatted_abs_desc, "%pred", owner) //replace with this belly's owner
formatted_abs_desc = replacetext(formatted_abs_desc, "%prey", M) //replace with whatever mob entered into this belly
to_chat(M, "<span class='notice'><B>[formatted_abs_desc]</B></span>")
//Update owner
owner.updateVRPanel()
+11 -2
View File
@@ -118,6 +118,15 @@
else if(inside_belly.desc)
inside_desc = inside_belly.desc
//I'd rather not copy-paste this code twice into the previous if-statement
//Technically we could just format the text anyway, but IDK how demanding unnecessary text-replacements are
if((host.absorbed && inside_belly.absorbed_desc) || (inside_belly.desc))
var/formatted_desc
formatted_desc = replacetext(inside_desc, "%belly", lowertext(inside_belly.name)) //replace with this belly's name
formatted_desc = replacetext(formatted_desc, "%pred", pred) //replace with the pred of this belly
formatted_desc = replacetext(formatted_desc, "%prey", host) //replace with whoever's reading this
inside_desc = formatted_desc
inside = list(
"absorbed" = host.absorbed,
"belly_name" = inside_belly.name,
@@ -812,7 +821,7 @@
host.vore_selected.egg_type = new_egg_type
. = TRUE
if("b_desc")
var/new_desc = html_encode(input(usr,"Belly Description ([BELLIES_DESC_MAX] char limit):","New Description",host.vore_selected.desc) as message|null)
var/new_desc = html_encode(input(usr,"Belly Description, '%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. ([BELLIES_DESC_MAX] char limit):","New Description",host.vore_selected.desc) as message|null)
if(new_desc)
new_desc = readd_quotes(new_desc)
@@ -822,7 +831,7 @@
host.vore_selected.desc = new_desc
. = TRUE
if("b_absorbed_desc")
var/new_desc = html_encode(input(usr,"Belly Description for absorbed prey ([BELLIES_DESC_MAX] char limit):","New Description",host.vore_selected.absorbed_desc) as message|null)
var/new_desc = html_encode(input(usr,"Belly Description for absorbed prey, '%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. ([BELLIES_DESC_MAX] char limit):","New Description",host.vore_selected.absorbed_desc) as message|null)
if(new_desc)
new_desc = readd_quotes(new_desc)