Adds in prey transfer (and a bug)

Adds in prey transfer.

Has a bug in which if the pred deletes their tranfer location stomach,
then the prey will be able to be moved there, trapping them in limbo.

Shouldn't happen often if ever, but I still need to figure out how to
fix it.

Merging this in case anyone has a solution of how to do the sanity
check.

Lines 416-428 in belly_vr.dm
This commit is contained in:
killer653
2016-12-12 22:16:33 -05:00
parent b02438e191
commit 379abaa7dc
2 changed files with 41 additions and 2 deletions
+19 -2
View File
@@ -25,6 +25,9 @@
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
@@ -410,7 +413,21 @@
owner << "<span class='notice'>The attempt to escape from your [name] has failed!</span>"
return
else if(prob(absorbchance)) //Next, let's have it run the absorb chance.
else if(prob(transferchance)) //Next, let's have it see if they end up getting into an even bigger mess then when they started.
//if(!(T in owner.vore_organs)) //This section has a bug. If the location that the belly drops someone off at is deleted, then it'll still drop them off at that (now nonexistant) location, resulting in them being trapped. Otherwise, the code works.
//return
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)
@@ -418,7 +435,7 @@
B.digest_mode = DM_ABSORB
return
else if(prob(digestchance))
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)
+22
View File
@@ -176,6 +176,10 @@
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 += "<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>"
@@ -533,6 +537,24 @@
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>" //Currently attempting to fix this bug. Let's warn the user about it until then.
if(href_list["b_soundtest"])