//
// Vore management panel for players
//
#define BELLIES_MAX 20
#define BELLIES_NAME_MIN 2
#define BELLIES_NAME_MAX 12
#define BELLIES_DESC_MAX 1024
#define FLAVOR_MAX 40
/mob/living/proc/insidePanel()
set name = "Vore Panel"
set category = "Vore"
var/datum/vore_look/picker_holder = new()
picker_holder.loop = picker_holder
picker_holder.selected = vore_organs[vore_selected]
var/dat = picker_holder.gen_vui(src)
picker_holder.popup = new(src, "insidePanel","Vore Panel", 400, 600, picker_holder)
picker_holder.popup.set_content(dat)
picker_holder.popup.open()
//
// Callback Handler for the Inside form
//
/datum/vore_look
var/datum/belly/selected
var/show_interacts = TRUE
var/datum/browser/popup
var/loop = null; // Magic self-reference to stop the handler from being GC'd before user takes action.
/datum/vore_look/Destroy()
loop = null
selected = null
return QDEL_HINT_HARDDEL
/datum/vore_look/Topic(href,href_list[])
if (vp_interact(href, href_list))
popup.set_content(gen_vui(usr))
usr << output(popup.get_content(), "insidePanel.browser")
/datum/vore_look/proc/gen_vui(var/mob/living/user)
var/dat
if (is_vore_predator(user.loc))
var/mob/living/eater = user.loc
var/datum/belly/inside_belly
//This big block here figures out where the prey is
inside_belly = check_belly(user)
if(inside_belly)
dat += "You are currently inside [eater]'s [inside_belly]!
"
if(inside_belly.inside_flavor)
dat += "[inside_belly.inside_flavor]
"
if (inside_belly.internal_contents.len > 1)
dat += "You can see the following around you:
"
for (var/atom/movable/O in inside_belly.internal_contents)
if(istype(O,/mob/living))
var/mob/living/M = O
//That's just you
if(M == user)
continue
//Anything else
dat += "[O]"
//Zero-width space, for wrapping
dat += ""
else
dat += "You aren't inside anyone."
dat += "
"
dat += ""
for(var/K in user.vore_organs) //Fuggin can't iterate over values
var/datum/belly/B = user.vore_organs[K]
if(B == selected)
dat += "- [B.name]"
else
dat += "
- [B.name]"
var/spanstyle
switch(B.digest_mode)
if(DM_HOLD)
spanstyle = ""
if(DM_DIGEST)
spanstyle = "color:red;"
if(DM_HEAL)
spanstyle = "color:green;"
dat += " ([B.internal_contents.len])
"
if(user.vore_organs.len < BELLIES_MAX)
dat += "- New+
"
dat += "
"
dat += "
"
// Selected Belly (contents, configuration)
if(!selected)
dat += "No belly selected. Click one to select it."
else
if(selected.internal_contents.len > 0)
dat += "Contents: "
for(var/O in selected.internal_contents)
dat += "[O]"
//Zero-width space, for wrapping
dat += ""
//If there's more than one thing, add an [All] button
if(selected.internal_contents.len > 1)
dat += "\[All\]"
dat += "
"
//Belly Name Button
dat += "Name:"
dat += " '[selected.name]'"
//Digest Mode Button
dat += "
Belly Mode:"
dat += " [selected.digest_mode]"
//Belly verb
dat += "
Vore Verb:"
dat += " '[selected.vore_verb]'"
//Inside flavortext
dat += "
Flavor Text:"
dat += " '[selected.inside_flavor]'"
//Belly sound
dat += "
Set Vore Sound"
dat += "Test"
// //Belly silence
// dat += "
Belly Silence ([selected.silenced ? "Silenced" : "Noisy"])"
//Belly messages
dat += "
Belly Messages"
//Can belly taste?
dat += "
Can Taste:"
dat += " [selected.can_taste ? "Yes" : "No"]"
//Belly escapability
dat += "
Belly Interactions ([selected.escapable ? "On" : "Off"])"
if(selected.escapable)
dat += "[show_interacts ? "Hide" : "Show"]"
if(show_interacts && selected.escapable)
dat += "
"
dat += "Interaction Settings ?"
dat += "
Set Belly Escape Chance"
dat += " [selected.escapechance]%"
dat += "
Set Belly Escape Time"
dat += " [selected.escapetime/10]s"
//Special
here to add a gap
dat += "
"
dat += "
Set Belly Transfer Chance"
dat += " [selected.transferchance]%"
dat += "
Set Belly Transfer Location"
dat += " [selected.transferlocation ? selected.transferlocation : "Disabled"]"
//Special
here to add a gap
dat += "
"
dat += "
Set Belly Digest Chance"
dat += " [selected.digestchance]%"
dat += "
"
//Delete button
dat += "
Delete Belly"
dat += "
"
//Under the last HR, save and stuff.
dat += "Save Prefs"
dat += "Refresh"
dat += "Set Flavor"
dat += "
"
switch(user.digestable)
if(TRUE)
dat += "Toggle Digestable (Currently: ON)"
if(FALSE)
dat += "Toggle Digestable (Currently: OFF)"
switch(user.devourable)
if(TRUE)
dat += "Toggle Devourable (Currently: ON)"
if(FALSE)
dat += "Toggle Devourable (Currently: OFF)"
//Returns the dat html to the vore_look
return dat
/datum/vore_look/proc/vp_interact(href, href_list)
var/mob/living/user = usr
for(var/H in href_list)
if(href_list["close"])
qdel(src) // Cleanup
return
if(href_list["show_int"])
show_interacts = !show_interacts
return TRUE //Force update
if(href_list["int_help"])
to_chat(usr,"These control how your belly responds to someone using 'resist' while inside you. The percent chance to trigger each is listed below, \
and you can change them to whatever you see fit. Setting them to 0% will disable the possibility of that interaction. \
These only function as long as interactions are turned on in general. Keep in mind, the 'belly mode' interactions (digest) \
will affect all prey in that belly, if one resists and triggers digestion. If multiple trigger at the same time, \
only the first in the order of 'Escape > Transfer > Digest' will occur.")
return TRUE //Force update
if(href_list["outsidepick"])
var/atom/movable/tgt = locate(href_list["outsidepick"])
var/datum/belly/OB = locate(href_list["outsidebelly"])
if(!(tgt in OB.internal_contents)) //Aren't here anymore, need to update menu.
return TRUE
var/intent = "Examine"
if(istype(tgt,/mob/living))
var/mob/living/M = tgt
intent = alert("What do you want to do to them?","Query","Examine","Help Out","Devour")
switch(intent)
if("Examine") //Examine a mob inside another mob
M.examine(user)
if("Help Out") //Help the inside-mob out
to_chat(user, "You begin to push [M] to freedom!")
to_chat(M, "[usr] begins to push you to freedom!")
M.loc << "Someone is trying to escape from inside you!"
sleep(50)
if(prob(33))
OB.release_specific_contents(M)
to_chat(usr, "You manage to help [M] to safety!")
to_chat(M, "[user] pushes you free!")
M.loc << "[M] forces free of the confines of your body!"
else
to_chat(user, "[M] slips back down inside despite your efforts.")
to_chat(M, " Even with [user]'s help, you slip back inside again.")
M.loc << "Your body efficiently shoves [M] back where they belong."
if("Devour") //Eat the inside mob
if(!user.vore_selected)
to_chat(user, "Pick a belly on yourself first!")
return
var/datum/belly/TB = user.vore_organs[user.vore_selected]
to_chat(user, "You begin to [lowertext(TB.vore_verb)] [M] into your [lowertext(TB.name)]!")
to_chat(M, "[user] begins to [lowertext(TB.vore_verb)] you into their [lowertext(TB.name)]!")
M.loc << "Someone inside you is eating someone else!"
sleep(TB.nonhuman_prey_swallow_time)
if((user in OB.internal_contents) && (M in OB.internal_contents))
to_chat(user, "You manage to [lowertext(TB.vore_verb)] [M] into your [lowertext(TB.name)]!")
to_chat(M, "[user] manages to [lowertext(TB.vore_verb)] you into their [lowertext(TB.name)]!")
M.loc << "Someone inside you has eaten someone else!"
M.loc = user
TB.nom_mob(M)
OB.internal_contents -= M
else if(istype(tgt,/obj/item))
var/obj/item/T = tgt
if(!(tgt in OB.internal_contents))
//Doesn't exist anymore, update.
return TRUE
intent = alert("What do you want to do to that?","Query","Examine","Use Hand")
switch(intent)
if("Examine")
T.examine(user)
if("Use Hand")
if(user.stat)
to_chat(user, "You can't do that in your state!")
return
user.ClickOn(T)
sleep(5) //Seems to exit too fast for the panel to update
if(href_list["insidepick"])
var/intent
//Handle the [All] choice. Ugh inelegant. Someone make this pretty.
if(href_list["pickall"])
intent = alert("Eject all, Move all?","Query","Eject all","Cancel","Move all")
switch(intent)
if("Cancel")
return
if("Eject all")
if(user.stat)
to_chat(user, "You can't do that in your state!")
return
selected.release_all_contents()
playsound(user, 'sound/vore/pred/escape.ogg', vol=80)
to_chat(user.loc,"Everything is released from [user]!")
if("Move all")
if(user.stat)
to_chat(user, "You can't do that in your state!")
return
var/choice = input("Move all where?","Select Belly") in user.vore_organs + "Cancel - Don't Move"
if(choice == "Cancel - Don't Move")
return
else
var/datum/belly/B = user.vore_organs[choice]
for(var/atom/movable/tgt in selected.internal_contents)
to_chat(tgt, "You're squished from [user]'s [selected] to their [B]!")
selected.transfer_contents(tgt, B, 1)
for(var/mob/hearer in range(1,user))
hearer << sound('sound/vore/pred/stomachmove.ogg',volume=80)
var/atom/movable/tgt = locate(href_list["insidepick"])
if(!(tgt in selected.internal_contents)) //Old menu, needs updating because they aren't really there.
return TRUE//Forces update
intent = "Examine"
intent = alert("Examine, Eject, Move? Examine if you want to leave this box.","Query","Examine","Eject","Move")
switch(intent)
if("Examine")
tgt.examine(user)
if("Eject")
if(user.stat)
to_chat(user, "You can't do that in your state!")
return FALSE
selected.release_specific_contents(tgt)
playsound(user, 'sound/effects/splat.ogg', 50, 1)
user.loc << "[tgt] is released from [user]!"
if("Move")
if(user.stat)
to_chat(user, "You can't do that in your state!")
return FALSE
var/choice = input("Move [tgt] where?","Select Belly") in user.vore_organs + "Cancel - Don't Move"
if(choice == "Cancel - Don't Move")
return
else
var/datum/belly/B = user.vore_organs[choice]
if (!(tgt in selected.internal_contents))
return FALSE
to_chat(tgt, "You're moved from [user]'s [lowertext(selected.name)] to their [lowertext(B.name)]!")
for(var/mob/hearer in range(1,user))
hearer << sound('sound/vore/pred/stomachmove.ogg',volume=80)
selected.transfer_contents(tgt, B)
if(href_list["newbelly"])
if(user.vore_organs.len >= BELLIES_MAX)
return TRUE
var/new_name = html_encode(input(usr,"New belly's name:","New Belly") as text|null)
if(length(new_name) > BELLIES_NAME_MAX || length(new_name) < BELLIES_NAME_MIN)
to_chat(usr, "Entered belly name is too long.")
return FALSE
if(new_name in user.vore_organs)
to_chat(usr, "No duplicate belly names, please.")
return FALSE
var/datum/belly/NB = new(user)
NB.name = new_name
NB.owner = user //might be the thing we all needed.
user.vore_organs[new_name] = NB
selected = NB
if(href_list["bellypick"])
selected = locate(href_list["bellypick"])
user.vore_selected = selected.name
////
//Please keep these the same order they are on the panel UI for ease of coding
////
if(href_list["b_name"])
var/new_name = html_encode(input(usr,"Belly's new name:","New Name") as text|null)
if(length(new_name) > BELLIES_NAME_MAX || length(new_name) < BELLIES_NAME_MIN)
to_chat(usr, "Entered belly name length invalid (must be longer than 2, shorter than 12).")
return FALSE
if(new_name in user.vore_organs)
to_chat(usr, "No duplicate belly names, please.")
return FALSE
user.vore_organs[new_name] = selected
user.vore_organs -= selected.name
selected.name = new_name
if(href_list["b_mode"])
var/list/menu_list = selected.digest_modes
if(selected.digest_modes.len == 1) // Don't do anything
return 1
if(selected.digest_modes.len == 2) // Just toggle... there's probably a more elegant way to do this...
var/index = selected.digest_modes.Find(selected.digest_mode)
switch(index)
if(1)
selected.digest_mode = selected.digest_modes[2]
if(2)
selected.digest_mode = selected.digest_modes[1]
else
selected.digest_mode = input("Choose Mode (currently [selected.digest_mode])") in menu_list
if(href_list["b_desc"])
var/new_desc = html_encode(input(usr,"Belly Description (1024 char limit):","New Description",selected.inside_flavor) as message|null)
if(new_desc)
new_desc = readd_quotes(new_desc)
if(length(new_desc) > BELLIES_DESC_MAX)
to_chat(usr, "Entered belly desc too long. [BELLIES_DESC_MAX] character limit.")
return FALSE
selected.inside_flavor = new_desc
else //Returned null
return FALSE
if(href_list["b_msgs"])
var/list/messages = list(
"Digest Message (to prey)",
"Digest Message (to you)",
"Struggle Message (outside)",
"Struggle Message (inside)",
"Examine Message (when full)",
"Reset All To Default",
"Cancel - No Changes"
)
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.")
var/choice = input(user,"Select a type to modify. Messages from each topic are pulled at random when needed.","Pick Type") in messages
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."
switch(choice)
if("Digest Message (to prey)")
var/new_message = input(user,"These are sent to prey when they expire. Write them in 2nd person ('you feel X'). Avoid using %prey in this type."+help,"Digest Message (to prey)",selected.get_messages("dmp")) as message
if(new_message)
selected.set_messages(new_message,"dmp")
if("Digest Message (to you)")
var/new_message = input(user,"These are sent to you when prey expires in you. Write them in 2nd person ('you feel X'). Avoid using %pred in this type."+help,"Digest Message (to you)",selected.get_messages("dmo")) as message
if(new_message)
selected.set_messages(new_message,"dmo")
if("Struggle Message (outside)")
var/new_message = input(user,"These are sent to those nearby when prey struggles. Write them in 3rd person ('X's Y bulges')."+help,"Struggle Message (outside)",selected.get_messages("smo")) as message
if(new_message)
selected.set_messages(new_message,"smo")
if("Struggle Message (inside)")
var/new_message = input(user,"These are sent to prey when they struggle. Write them in 2nd person ('you feel X'). Avoid using %prey in this type."+help,"Struggle Message (inside)",selected.get_messages("smi")) as message
if(new_message)
selected.set_messages(new_message,"smi")
if("Examine Message (when full)")
var/new_message = input(user,"These are sent to people who examine you when this belly has contents. Write them in 3rd person ('Their %belly is bulging'). "+help,"Examine Message (when full)",selected.get_messages("em")) as message
if(new_message)
selected.set_messages(new_message,"em")
if("Reset All To Default")
var/confirm = alert(user,"This will delete any custom messages. Are you sure?","Confirmation","DELETE","Cancel")
if(confirm == "DELETE")
selected.digest_messages_prey = initial(selected.digest_messages_prey)
selected.digest_messages_owner = initial(selected.digest_messages_owner)
selected.struggle_messages_outside = initial(selected.struggle_messages_outside)
selected.struggle_messages_inside = initial(selected.struggle_messages_inside)
if("Cancel - No Changes")
return
if(href_list["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)
if(length(new_verb) > BELLIES_NAME_MAX || length(new_verb) < BELLIES_NAME_MIN)
to_chat(usr, "Entered verb length invalid (must be longer than [BELLIES_NAME_MIN], no longer than [BELLIES_NAME_MAX]).")
return FALSE
selected.vore_verb = new_verb
if(href_list["b_sound"])
var/choice = input(user,"Currently set to [selected.vore_sound]","Select Sound") in GLOB.pred_vore_sounds + "Cancel - No Changes"
if(choice == "Cancel")
return
selected.vore_sound = GLOB.pred_vore_sounds[choice]
if(href_list["b_soundtest"])
user << selected.vore_sound
/*
if(href_list["silenced"])
if(selected.silenced == FALSE)
selected.silenced = TRUE
to_chat(usr,"The [selected.name] is now silenced, it will not play the internal loop to prey within it.")
else if(selected.silenced == TRUE)
selected.silenced = FALSE
to_chat(usr,"The [selected.name] will play the internal loop to prey within it.")
*/
if(href_list["b_tastes"])
selected.can_taste = !selected.can_taste
if(href_list["b_escapable"])
if(selected.escapable == FALSE) //Possibly escapable and special interactions.
selected.escapable = TRUE
to_chat(usr,"Prey now have special interactions with your [selected.name] depending on your settings.")
else if(selected.escapable == TRUE) //Never escapable.
selected.escapable = FALSE
to_chat(usr,"Prey will not be able to have special interactions with your [selected.name].")
show_interacts = FALSE //Force the hiding of the panel
else
to_chat(usr,"Something went wrong. Your stomach will now not have special interactions. Press the button enable them again and tell a dev.") //If they somehow have a varable that's not 0 or 1
selected.escapable = FALSE
show_interacts = FALSE //Force the hiding of the panel
if(href_list["b_escapechance"])
var/escape_chance_input = input(user, "Set prey escape chance on resist (as %)", "Prey Escape Chance") as num|null
if(!isnull(escape_chance_input)) //These have to be 'null' because both cancel and 0 are valid, separate options
selected.escapechance = sanitize_integer(escape_chance_input, 0, 100, initial(selected.escapechance))
if(href_list["b_escapetime"])
var/escape_time_input = input(user, "Set number of seconds for prey to escape on resist (1-60)", "Prey Escape Time") as num|null
if(!isnull(escape_time_input))
selected.escapetime = sanitize_integer(escape_time_input*10, 10, 600, initial(selected.escapetime))
if(href_list["b_transferchance"])
var/transfer_chance_input = input(user, "Set belly transfer chance on resist (as %). You must also set the location for this to have any effect.", "Prey Escape Time") as num|null
if(!isnull(transfer_chance_input))
selected.transferchance = sanitize_integer(transfer_chance_input, 0, 100, initial(selected.transferchance))
if(href_list["b_transferlocation"])
var/choice = input("Where do you want your [selected.name] to lead if prey resists?","Select Belly") as null|anything in (user.vore_organs + "None - Remove" - selected.name)
if(!choice) //They cancelled, no changes
return
else if(choice == "None - Remove")
selected.transferlocation = null
else
selected.transferlocation = user.vore_organs[choice]
if(href_list["b_digestchance"])
var/digest_chance_input = input(user, "Set belly digest mode chance on resist (as %)", "Prey Digest Chance") as num|null
if(!isnull(digest_chance_input))
selected.digestchance = sanitize_integer(digest_chance_input, 0, 100, initial(selected.digestchance))
if(href_list["b_del"])
var/dest_for = FALSE //Check to see if it's the destination of another vore organ.
for(var/I in user.vore_organs)
var/datum/belly/B = user.vore_organs[I]
if(B.transferlocation == selected)
dest_for = B.name
break
if(dest_for)
alert("This is the destiantion for at least '[dest_for]' belly transfers. Remove it as the destination from any bellies before deleting it.","Error")
return TRUE
else if(selected.internal_contents.len)
alert("Can't delete bellies with contents!","Error")
return TRUE
if(selected.internal_contents.len)
to_chat(usr, "Can't delete bellies with contents!")
return
else if(selected.immutable)
to_chat(usr, "This belly is marked as undeletable.")
return
else if(user.vore_organs.len == 1)
to_chat(usr, "You must have at least one belly.")
return
else
var/alert = alert("Are you sure you want to delete [selected]?","Confirmation","Delete","Cancel")
if(alert == "Delete" && !selected.internal_contents.len)
user.vore_organs -= selected.name
user.vore_organs.Remove(selected)
selected = user.vore_organs[1]
user.vore_selected = user.vore_organs[1]
to_chat(usr,"Note: If you had this organ selected as a transfer location, please remove the transfer location by selecting Cancel - None - Remove on this stomach.")
if(href_list["saveprefs"])
if(user.save_vore_prefs())
to_chat(user, "Belly Preferences saved!")
else
to_chat(user, "ERROR: Belly Preferences were not saved!")
log_admin("Could not save vore prefs on USER: [user].")
if(href_list["setflavor"])
var/new_flavor = html_encode(input(usr,"What your character tastes like (40ch limit). This text will be printed to the pred after 'X tastes of...' so just put something like 'strawberries and cream':","Character Flavor",user.vore_taste) as text|null)
if(new_flavor)
new_flavor = readd_quotes(new_flavor)
if(length(new_flavor) > FLAVOR_MAX)
alert("Entered flavor/taste text too long. [FLAVOR_MAX] character limit.","Error")
return FALSE
user.vore_taste = new_flavor
else //Returned null
return FALSE
if(href_list["toggledg"])
var/choice = alert(user, "This button is for those who don't like being digested. It can make you undigestable to all mobs. Digesting you is currently: [user.digestable ? "Allowed" : "Prevented"]", "", "Allow Digestion", "Cancel", "Prevent Digestion")
switch(choice)
if("Cancel")
return
if("Allow Digestion")
user.digestable = TRUE
if("Prevent Digestion")
user.digestable = FALSE
if(user.client.prefs_vr)
user.client.prefs_vr.digestable = user.digestable
if(href_list["toggledvor"])
var/choice = alert(user, "This button is for those who don't like vore at all. Devouring you is currently: [user.devourable ? "Allowed" : "Prevented"]", "", "Allow Devourment", "Cancel", "Prevent Devourment")
switch(choice)
if("Cancel")
return
if("Allow Devourment")
user.devourable = TRUE
if("Prevent Devourment")
user.devourable = FALSE
if(user.client.prefs_vr)
user.client.prefs_vr.devourable = user.devourable
//Refresh when interacted with, returning 1 makes vore_look.Topic update
return TRUE