Merge pull request #758 from Cameron653/master

Special Stomach Interactions
This commit is contained in:
Spades
2016-12-13 21:52:23 -05:00
committed by GitHub
2 changed files with 145 additions and 2 deletions

View File

@@ -22,6 +22,11 @@
var/immutable = 0 // Prevents this belly from being deleted
var/escapable = 0 // Belly can be resisted out of at any time
var/escapetime = 600 // Deciseconds, how long to escape this belly
var/digestchance = 0 // % Chance of stomach beginning to digest if prey struggles
var/absorbchance = 0 // % Chance of stomach beginning to absorb if prey struggles
var/escapechance = 0 // % Chance of prey beginning to escape if prey struggles.
var/transferchance = 0 // % Chance of prey being
var/transferlocation = null // Location that the prey is released if they struggle and get dropped off.
var/tmp/digest_mode = DM_HOLD // Whether or not to digest. Default to not digest.
var/tmp/list/digest_modes = list(DM_HOLD,DM_DIGEST,DM_HEAL,DM_ABSORB,DM_DRAIN,DM_UNABSORB) // Possible digest modes
@@ -351,7 +356,7 @@
R.setClickCooldown(50)
if(owner.stat || escapable) //If owner is stat (dead, KO) we can actually escape, or if belly is set to escapable (non-default)
if(owner.stat) //If owner is stat (dead, KO) we can actually escape
R << "<span class='warning'>You attempt to climb out of \the [name]. (This will take around [escapetime/10] seconds.)</span>"
owner << "<span class='warning'>Someone is attempting to climb out of your [name]!</span>"
@@ -366,7 +371,6 @@
owner << "<span class='notice'>The attempt to escape from your [name] has failed!</span>"
return
return
var/struggle_outer_message = pick(struggle_messages_outside)
var/struggle_user_message = pick(struggle_messages_inside)
@@ -389,6 +393,57 @@
var/strsound = struggle_sounds[strpick]
playsound(R.loc, strsound, 50, 1)
if(escapable) //If the stomach has escapable enabled.
R << "<span class='warning'>You attempt to climb out of \the [name].</span>"
owner << "<span class='warning'>Someone is attempting to climb out of your [name]!</span>"
if(prob(escapechance)) //Let's have it check to see if the prey escapes first.
if(do_after(R, escapetime))
if((escapable) && (R in internal_contents)) //Does the owner still have escapable enabled?
release_specific_contents(R)
R << "<span class='warning'>You climb out of \the [name].</span>"
owner << "<span class='warning'>[R] climbs out of your [name]!</span>"
for(var/mob/M in hearers(4, owner))
M.show_message("<span class='warning'>[R] climbs out of [owner]'s [name]!</span>", 2)
return
else if(!(R in internal_contents)) //Aren't even in the belly. Quietly fail.
return
else //Belly became inescapable.
R << "<span class='warning'>Your attempt to escape [name] has failed!</span>"
owner << "<span class='notice'>The attempt to escape from your [name] has failed!</span>"
return
else if(prob(transferchance)) //Next, let's have it see if they end up getting into an even bigger mess then when they started.
var/datum/belly/T = transferlocation
for(var/K in owner.vore_organs)
var/datum/belly/B = owner.vore_organs[K]
var/datum/belly/TL = B.transferlocation
if(TL != null)
B.internal_contents -= R
T.internal_contents += R
R << "<span class='warning'>Your attempt to escape [name] has failed and your struggles only results in you sliding into [owner]'s [transferlocation]</span>"
owner << "<span class='warning'>Someone slid into your [transferlocation] due to their struggling inside your [name]!</span>"
return
else if(prob(absorbchance)) //After that, let's have it run the absorb chance.
R << "<span class='warning'>In responce to your struggling, \the [name] begins to get more active...</span>"
owner << "<span class='warning'>You feel your [name] beginning to become active!</span>"
for(var/K in owner.vore_organs)
var/datum/belly/B = owner.vore_organs[K]
B.digest_mode = DM_ABSORB
return
else if(prob(digestchance)) //Finally, let's see if it should run the digest chance.
R << "<span class='warning'>In responce to your struggling, \the [name] begins to get more active...</span>"
owner << "<span class='warning'>You feel your [name] beginning to become active!</span>"
for(var/K in owner.vore_organs)
var/datum/belly/B = owner.vore_organs[K]
B.digest_mode = DM_DIGEST
return
else //Nothing interesting happened.
R << "<span class='warning'>But make no progress in escaping [owner]'s [name].</span>"
owner << "<span class='warning'>But appears to be unable to make any progress in escaping your [name].</span>"
return
// Belly copies and then returns the copy
// Needs to be updated for any var changes
/datum/belly/proc/copy(mob/new_owner)
@@ -408,6 +463,11 @@
dupe.immutable = immutable
dupe.escapable = escapable
dupe.escapetime = escapetime
dupe.digestchance = digestchance
dupe.absorbchance = absorbchance
dupe.escapechance = escapechance
dupe.transferchance = transferchance
dupe.transferlocation = transferlocation
//// Object-holding variables
//struggle_messages_outside - strings

View File

@@ -171,6 +171,22 @@
//Belly messages
dat += "<br><a href='?src=\ref[src];b_msgs=\ref[selected]'>Belly Messages</a>"
//Belly escapability
dat += "<br><a href='?src=\ref[src];b_escapable=\ref[selected]'>Set Belly Interactions (below)</a>"
dat += "<br><a href='?src=\ref[src];b_escapechance=\ref[selected]'>Set Belly Escape Chance</a>"
dat += "<br><a href='?src=\ref[src];b_transferchance=\ref[selected]'>Set Belly Transfer Chance</a>"
dat += "<br><a href='?src=\ref[src];b_transferlocation=\ref[selected]'>Set Belly Transfer Location</a>"
dat += " [selected.transferlocation]"
dat += "<br><a href='?src=\ref[src];b_absorbchance=\ref[selected]'>Set Belly Absorb Chance</a>"
dat += "<br><a href='?src=\ref[src];b_digestchance=\ref[selected]'>Set Belly Digest Chance</a>"
dat += "<br><a href='?src=\ref[src];b_escapetime=\ref[selected]'>Set Belly Escape Time</a>"
//Delete button
dat += "<br><a style='background:#990000;' href='?src=\ref[src];b_del=\ref[selected]'>Delete Belly</a>"
@@ -475,6 +491,72 @@
selected.vore_sound = vore_sounds[choice]
if(href_list["b_escapable"])
if(selected.escapable == 0) //Possibly escapable and special interactions.
selected.escapable = 1
usr << "<span class='warning'>Prey now have special interactions with your [selected.name] depending on your settings.</span>"
else if(selected.escapable == 1) //Never escapable.
selected.escapable = 0
usr << "<span class='warning'>Prey will not be able to have special interactions with your [selected.name].</span>"
else
usr << "<span class='warning'>Something went wrong. Your stomach will now not have special interactions. Press the button enable them again.</span>" //If they somehow have a varable that's not 0 or 1
selected.escapable = 0
if(href_list["b_escapechance"])
var/escape_chance_input = input(user, "Choose the (%) chance that prey that attempt to escape will be able to escape.\
Stomach special interactions must be enabled for this to work.\
Ranges from -1(disabled) to 100.\n\
(-1-100)", "Prey Escape Chance") as num|null
if(escape_chance_input)
escape_chance_input = round(text2num(escape_chance_input),4)
selected.escapechance = sanitize_integer(escape_chance_input, 0, 100, selected.escapechance)
if(href_list["b_absorbchance"])
var/absorb_chance_input = input(user, "Choose the (%) chance that prey that attempt to escape will be absorbed into your [selected.name].\
Stomach special interactions must be enabled for this to work.\
Ranges from -1(disabled) to 100.\n\
(-1-100)", "Prey Absorb Chance") as num|null
if(absorb_chance_input)
absorb_chance_input = round(text2num(absorb_chance_input),4)
selected.absorbchance = sanitize_integer(absorb_chance_input, 0, 100, selected.absorbchance)
if(href_list["b_digestchance"])
var/digest_chance_input = input(user, "Choose the (%) chance that prey that attempt to escape will begin to digest inside of your [selected.name].\
Stomach special interactions must be enabled for this to work.\
Ranges from -1(disabled) to 100.\n\
(-1-100)", "Prey Digest Chance") as num|null
if(digest_chance_input)
digest_chance_input = round(text2num(digest_chance_input),4)
selected.digestchance = sanitize_integer(digest_chance_input, 0, 100, selected.digestchance)
if(href_list["b_escapetime"])
var/escape_time_input = input(user, "Choose the amount of time it will take for prey to be able to escape.\
Stomach special interactions must be enabled for this to effect anything, along with the escape chance\
Ranges from 10 to 600.(10 = 1 second, 600 = 60 seconds)\n\
(10-600)", "Prey Escape Time") as num|null
if(escape_time_input)
escape_time_input = round(text2num(escape_time_input),4)
selected.escapetime = sanitize_integer(escape_time_input, 9, 600, selected.escapetime) //Set to 9 to stop rounding problems.
if(href_list["b_transferchance"])
var/transfer_chance_input = input(user, "Choose the chance that that prey will be dropped off if they attempt to struggle.\
Stomach special interactions must be enabled for this to effect anything, along with a transfer location set\
Ranges from -1(disabled) to 100.\n\
(-1-100)", "Prey Escape Time") as num|null
if(transfer_chance_input)
transfer_chance_input = round(text2num(transfer_chance_input),4)
selected.transferchance = sanitize_integer(transfer_chance_input, 9, 600, selected.transferchance) //Set to 9 to stop rounding problems.
if(href_list["b_transferlocation"])
var/choice = input("Where do you want your [selected.name] to lead if prey struggles??","Select Belly") in user.vore_organs + "Cancel - None - Remove"
if(choice == "Cancel - None - Remove")
selected.transferlocation = null
return 1
else
selected.transferlocation = user.vore_organs[choice]
usr << "<span class='warning'>Note: Do not delete your [choice] while this is enabled. This will cause your prey to be unable to escape. If you want to delete your [choice], select Cancel - None - Remove and then delete it.</span>"
if(href_list["b_soundtest"])
user << selected.vore_sound
@@ -492,6 +574,7 @@
user.vore_organs.Remove(selected)
selected = user.vore_organs[1]
user.vore_selected = user.vore_organs[1]
usr << "<span class='warning'>Note: If you had this organ selected as a transfer location, please remove the transfer location by selecting Cancel - None - Remove on this stomach.</span>" //If anyone finds a fix to this bug, please tell me. I, for the life of me, can't find any way to fix it.
if(href_list["saveprefs"])
if(!user.save_vore_prefs())