mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2026-01-08 16:32:54 +00:00
Make digest_act even more generic (and contaminate)
Now returns nutrition that should be gained, and accepts an internal_contents list and where you want subobjects placed
This commit is contained in:
@@ -404,10 +404,11 @@
|
||||
else
|
||||
var/obj/item/T = target
|
||||
if(istype(T))
|
||||
var/digested = T.digest_act()
|
||||
var/digested = T.digest_act(item_storage = src)
|
||||
if(!digested)
|
||||
items_preserved |= T
|
||||
return
|
||||
else
|
||||
hound.cell.charge += (50 * digested)
|
||||
|
||||
if(UI_open == 1)
|
||||
update_patient()
|
||||
|
||||
@@ -355,6 +355,20 @@
|
||||
B.internal_contents -= Mm
|
||||
absorb_living(Mm)
|
||||
|
||||
//Digest a single item
|
||||
//Receives a return value from digest_act that's how much nutrition
|
||||
//the item should be worth
|
||||
/datum/belly/proc/digest_item(var/obj/item/item)
|
||||
var/digested = item.digest_act(internal_contents, owner)
|
||||
if(!digested)
|
||||
items_preserved |= item
|
||||
else
|
||||
internal_contents -= item
|
||||
owner.nutrition += (digested)
|
||||
if(isrobot(owner))
|
||||
var/mob/living/silicon/robot/R = owner
|
||||
R.cell.charge += (50 * digested)
|
||||
|
||||
//Handle a mob struggling
|
||||
// Called from /mob/living/carbon/relaymove()
|
||||
/datum/belly/proc/relay_resist(var/mob/living/R)
|
||||
|
||||
@@ -87,14 +87,10 @@
|
||||
var/obj/item/T = pick(touchable_items)
|
||||
if(istype(T))
|
||||
if(digest_mode == DM_ITEMWEAK)
|
||||
T.gurgle_contaminate(src)
|
||||
T.gurgle_contaminate(internal_contents, owner)
|
||||
items_preserved |= T
|
||||
else
|
||||
var/digested = T.digest_act(belly = src) //Isn't this much better?
|
||||
if(!digested)
|
||||
items_preserved |= T
|
||||
else
|
||||
internal_contents -= T
|
||||
digest_item(T)
|
||||
|
||||
owner.updateVRPanel()
|
||||
return
|
||||
@@ -113,11 +109,7 @@
|
||||
// Handle loose items first.
|
||||
var/obj/item/T = pick(touchable_items)
|
||||
if(istype(T))
|
||||
var/digested = T.digest_act(belly = src) //Isn't this much better?
|
||||
if(!digested)
|
||||
items_preserved |= T
|
||||
else
|
||||
internal_contents -= T
|
||||
digest_item(T)
|
||||
|
||||
for(var/mob/living/carbon/human/M in internal_contents)
|
||||
if (M.absorbed)
|
||||
@@ -128,7 +120,7 @@
|
||||
M.unEquip(thingy,force = TRUE)
|
||||
thingy.forceMove(owner)
|
||||
internal_contents |= thingy
|
||||
thingy.digest_act(src) //Shame to move it just before gurgling it, but it might be indigestible.
|
||||
digest_item(T)
|
||||
M.updateVRPanel()
|
||||
|
||||
owner.updateVRPanel()
|
||||
|
||||
@@ -5,7 +5,7 @@ var/image/gurgled_overlay = image('icons/effects/sludgeoverlay_vr.dmi')
|
||||
var/cleanname
|
||||
var/cleandesc
|
||||
|
||||
/obj/item/proc/gurgle_contaminate(var/datum/belly/belly = null)
|
||||
/obj/item/proc/gurgle_contaminate(var/list/internal_contents = null, var/atom/movable/item_storage = null)
|
||||
if(!can_gurgle())
|
||||
return FALSE
|
||||
|
||||
@@ -18,7 +18,7 @@ var/image/gurgled_overlay = image('icons/effects/sludgeoverlay_vr.dmi')
|
||||
name = "[gurgleflavor] [cleanname]"
|
||||
desc = "[cleandesc] It seems to be covered in ominously foul residue and needs a wash."
|
||||
for(var/obj/item/O in contents)
|
||||
gurgle_contaminate(belly)
|
||||
gurgle_contaminate(internal_contents, item_storage)
|
||||
return TRUE
|
||||
|
||||
/obj/item/proc/can_gurgle()
|
||||
@@ -93,34 +93,34 @@ var/image/gurgled_overlay = image('icons/effects/sludgeoverlay_vr.dmi')
|
||||
//////////////
|
||||
// Special handling of gurgle_contaminate
|
||||
//////////////
|
||||
/obj/item/weapon/card/id/gurgle_contaminate(var/datum/belly/belly = null)
|
||||
digest_act(belly) //Digesting these anyway
|
||||
/obj/item/weapon/card/id/gurgle_contaminate(var/list/internal_contents = null, var/atom/movable/item_storage = null)
|
||||
digest_act(internal_contents, item_storage) //Digesting these anyway
|
||||
return TRUE
|
||||
|
||||
/obj/item/weapon/reagent_containers/food/gurgle_contaminate(var/datum/belly/belly = null)
|
||||
digest_act(belly)
|
||||
/obj/item/weapon/reagent_containers/food/gurgle_contaminate(var/list/internal_contents = null, var/atom/movable/item_storage = null)
|
||||
digest_act(internal_contents, item_storage)
|
||||
return TRUE
|
||||
|
||||
/obj/item/weapon/holder/gurgle_contaminate(var/datum/belly/belly = null)
|
||||
digest_act(belly)
|
||||
/obj/item/weapon/holder/gurgle_contaminate(var/list/internal_contents = null, var/atom/movable/item_storage = null)
|
||||
digest_act(internal_contents, item_storage)
|
||||
return TRUE
|
||||
|
||||
/obj/item/organ/gurgle_contaminate(var/datum/belly/belly = null)
|
||||
digest_act(belly)
|
||||
/obj/item/organ/gurgle_contaminate(var/list/internal_contents = null, var/atom/movable/item_storage = null)
|
||||
digest_act(internal_contents, item_storage)
|
||||
return TRUE
|
||||
|
||||
/obj/item/weapon/cell/gurgle_contaminate(var/datum/belly/belly = null)
|
||||
/obj/item/weapon/cell/gurgle_contaminate(var/list/internal_contents = null, var/atom/movable/item_storage = null)
|
||||
if(!gurgled)
|
||||
//Don't make them wet, just drain
|
||||
var/obj/item/weapon/cell/C = src
|
||||
C.charge = 0
|
||||
return TRUE
|
||||
|
||||
/obj/item/weapon/storage/box/gurgle_contaminate(var/datum/belly/belly = null)
|
||||
/obj/item/weapon/storage/box/gurgle_contaminate(var/list/internal_contents = null, var/atom/movable/item_storage = null)
|
||||
if((. = ..()))
|
||||
name = "soggy [cleanname]"
|
||||
desc = "This soggy box is about to fall apart any time."
|
||||
|
||||
/obj/item/device/pda/gurgle_contaminate(var/datum/belly/belly = null)
|
||||
/obj/item/device/pda/gurgle_contaminate(var/list/internal_contents = null, var/atom/movable/item_storage = null)
|
||||
if((. = ..()))
|
||||
desc = "This device seems completely unresponsive while drenched with sludge. Perhaps you could still wash it."
|
||||
|
||||
@@ -1,88 +1,88 @@
|
||||
//Please make sure to:
|
||||
//return FALSE: You are not going away, stop asking me to digest.
|
||||
//return TRUE: You are going away.
|
||||
//return non-negative integer: Amount of nutrition/charge gained (scaled to nutrition, other end can multiply for charge scale).
|
||||
|
||||
// Ye default implementation.
|
||||
/obj/item/proc/digest_act(var/datum/belly/belly = null)
|
||||
if(belly)
|
||||
for(var/obj/item/AM in contents)
|
||||
AM.forceMove(belly.owner)
|
||||
belly.internal_contents |= AM
|
||||
/obj/item/proc/digest_act(var/list/internal_contents = null, var/atom/movable/item_storage = null)
|
||||
for(var/obj/item/O in contents)
|
||||
if(internal_contents)
|
||||
internal_contents |= O
|
||||
if(item_storage)
|
||||
O.forceMove(item_storage)
|
||||
|
||||
belly.owner.nutrition += (1 * w_class)
|
||||
if(isrobot(belly.owner))
|
||||
var/mob/living/silicon/robot/R = belly.owner
|
||||
R.cell.charge += (50 * w_class)
|
||||
qdel(src)
|
||||
return TRUE
|
||||
return w_class
|
||||
|
||||
/////////////
|
||||
// Some indigestible stuff
|
||||
/////////////
|
||||
/obj/item/weapon/hand_tele/digest_act(var/datum/belly/belly = null)
|
||||
/obj/item/weapon/hand_tele/digest_act(var/list/internal_contents = null, var/atom/movable/item_storage = null)
|
||||
return FALSE
|
||||
/obj/item/weapon/card/id/gold/captain/spare/digest_act(var/datum/belly/belly = null)
|
||||
/obj/item/weapon/card/id/gold/captain/spare/digest_act(var/list/internal_contents = null, var/atom/movable/item_storage = null)
|
||||
return FALSE
|
||||
/obj/item/device/aicard/digest_act(var/datum/belly/belly = null)
|
||||
/obj/item/device/aicard/digest_act(var/list/internal_contents = null, var/atom/movable/item_storage = null)
|
||||
return FALSE
|
||||
/obj/item/device/paicard/digest_act(var/datum/belly/belly = null)
|
||||
/obj/item/device/paicard/digest_act(var/list/internal_contents = null, var/atom/movable/item_storage = null)
|
||||
return FALSE
|
||||
/obj/item/weapon/gun/digest_act(var/datum/belly/belly = null)
|
||||
/obj/item/weapon/gun/digest_act(var/list/internal_contents = null, var/atom/movable/item_storage = null)
|
||||
return FALSE
|
||||
/obj/item/weapon/pinpointer/digest_act(var/datum/belly/belly = null)
|
||||
/obj/item/weapon/pinpointer/digest_act(var/list/internal_contents = null, var/atom/movable/item_storage = null)
|
||||
return FALSE
|
||||
/obj/item/blueprints/digest_act(var/datum/belly/belly = null)
|
||||
/obj/item/blueprints/digest_act(var/list/internal_contents = null, var/atom/movable/item_storage = null)
|
||||
return FALSE
|
||||
/obj/item/weapon/disk/nuclear/digest_act(var/datum/belly/belly = null)
|
||||
/obj/item/weapon/disk/nuclear/digest_act(var/list/internal_contents = null, var/atom/movable/item_storage = null)
|
||||
return FALSE
|
||||
/obj/item/device/perfect_tele_beacon/digest_act(var/datum/belly/belly = null)
|
||||
/obj/item/device/perfect_tele_beacon/digest_act(var/list/internal_contents = null, var/atom/movable/item_storage = null)
|
||||
return FALSE //Sorta important to not digest your own beacons.
|
||||
|
||||
/////////////
|
||||
// Some special treatment
|
||||
/////////////
|
||||
//PDAs need to lose their ID to not take it with them, so we can get a digested ID
|
||||
/obj/item/device/pda/digest_act(var/datum/belly/belly = null)
|
||||
/obj/item/device/pda/digest_act(var/list/internal_contents = null, var/atom/movable/item_storage = null)
|
||||
if(id)
|
||||
id = null
|
||||
if(belly)
|
||||
id.forceMove(belly.owner)
|
||||
|
||||
/* Doesn't appear to be necessary anymore.
|
||||
if(item_storage)
|
||||
id.forceMove(item_storage)
|
||||
if(internal_contents)
|
||||
internal_contents |= id
|
||||
*/
|
||||
|
||||
. = ..()
|
||||
|
||||
/obj/item/weapon/card/id/digest_act(var/datum/belly/belly = null)
|
||||
/obj/item/weapon/card/id/digest_act(var/list/internal_contents = null, var/atom/movable/item_storage = null)
|
||||
desc = "A partially digested card that has seen better days. Much of it's data has been destroyed."
|
||||
icon = 'icons/obj/card_vr.dmi'
|
||||
icon_state = "digested"
|
||||
access = list() // No access
|
||||
return FALSE
|
||||
|
||||
/obj/item/weapon/reagent_containers/food/digest_act(var/datum/belly/belly = null)
|
||||
if(belly)
|
||||
if(istype(belly.owner,/mob/living/carbon/human))
|
||||
var/mob/living/carbon/human/H = belly.owner
|
||||
reagents.trans_to_holder(H.ingested, (reagents.total_volume * 0.3), 1, 0)
|
||||
/obj/item/weapon/reagent_containers/food/digest_act(var/list/internal_contents = null, var/atom/movable/item_storage = null)
|
||||
if(ishuman(item_storage))
|
||||
var/mob/living/carbon/human/H = item_storage
|
||||
reagents.trans_to_holder(H.ingested, (reagents.total_volume * 0.3), 1, 0)
|
||||
|
||||
else if(isrobot(belly.owner))
|
||||
var/mob/living/silicon/robot/R = belly.owner
|
||||
R.cell.charge += 150
|
||||
else if(isrobot(item_storage))
|
||||
var/mob/living/silicon/robot/R = item_storage
|
||||
R.cell.charge += 150
|
||||
|
||||
. = ..()
|
||||
|
||||
/obj/item/weapon/holder/digest_act(var/datum/belly/belly = null)
|
||||
/obj/item/weapon/holder/digest_act(var/list/internal_contents = null, var/atom/movable/item_storage = null)
|
||||
held_mob = null
|
||||
|
||||
. = ..()
|
||||
|
||||
/obj/item/organ/digest_act(var/datum/belly/belly = null)
|
||||
if(belly)
|
||||
belly.owner.nutrition += 66
|
||||
/obj/item/organ/digest_act(var/list/internal_contents = null, var/atom/movable/item_storage = null)
|
||||
if((. = ..()))
|
||||
. += 70 //Organs give a little more
|
||||
|
||||
. = ..()
|
||||
|
||||
/////////////
|
||||
// Some more complicated stuff
|
||||
/////////////
|
||||
/obj/item/device/mmi/digital/posibrain/digest_act(var/datum/belly/belly = null)
|
||||
/obj/item/device/mmi/digital/posibrain/digest_act(var/list/internal_contents = null, var/atom/movable/item_storage = null)
|
||||
//Replace this with a VORE setting so all types of posibrains can/can't be digested on a whim
|
||||
return FALSE
|
||||
|
||||
@@ -105,7 +105,7 @@
|
||||
else
|
||||
RemoveHood_roiz()
|
||||
|
||||
/obj/item/clothing/suit/storage/hooded/wintercoat/roiz/digest_act(var/datum/belly/belly = null)
|
||||
/obj/item/clothing/suit/storage/hooded/wintercoat/roiz/digest_act(var/list/internal_contents = null, var/atom/movable/item_storage = null)
|
||||
return FALSE
|
||||
|
||||
//ketrai:Ketrai
|
||||
@@ -679,7 +679,7 @@
|
||||
else
|
||||
return 1
|
||||
|
||||
/obj/item/clothing/under/fluff/screesuit/digest_act(var/datum/belly/belly = null)
|
||||
/obj/item/clothing/under/fluff/screesuit/digest_act(var/list/internal_contents = null, var/atom/movable/item_storage = null)
|
||||
return FALSE
|
||||
|
||||
//HOS Hardsuit
|
||||
@@ -769,7 +769,7 @@
|
||||
|
||||
action_button_name = "Toggle pom-pom"
|
||||
|
||||
/obj/item/clothing/head/fluff/pompom/digest_act(var/datum/belly/belly = null)
|
||||
/obj/item/clothing/head/fluff/pompom/digest_act(var/list/internal_contents = null, var/atom/movable/item_storage = null)
|
||||
return FALSE
|
||||
|
||||
/obj/item/clothing/head/fluff/pompom/attack_self(mob/user)
|
||||
|
||||
Reference in New Issue
Block a user