From 32b16773c0ef361f39e36965c2746ec40c237a20 Mon Sep 17 00:00:00 2001 From: Verkister Date: Tue, 15 Aug 2023 19:11:53 +0300 Subject: [PATCH] Adds recycling feature for vorebellies (#6815) --- code/modules/recycling/recycling.dm | 17 ++++++++- code/modules/vore/eating/belly_obj_ch.dm | 31 +++++++++++++++ code/modules/vore/eating/belly_obj_vr.dm | 2 + code/modules/vore/eating/digest_act_vr.dm | 38 ++++++++++++------- code/modules/vore/eating/vorepanel_vr.dm | 16 +++++++- tgui/packages/tgui_ch/interfaces/VorePanel.js | 12 +++++- tgui/public/tgui.bundle.js | 2 +- 7 files changed, 98 insertions(+), 20 deletions(-) diff --git a/code/modules/recycling/recycling.dm b/code/modules/recycling/recycling.dm index ff299eaa5d..356de4fbfe 100644 --- a/code/modules/recycling/recycling.dm +++ b/code/modules/recycling/recycling.dm @@ -103,10 +103,23 @@ update_use_power(USE_POWER_ACTIVE) sleep(5 SECONDS) var/list/modified_mats = list() - if(istype(O,/obj/item/trash))//CHOMPEDIT: Trash multiplier + if(istype(O,/obj/item/trash))//CHOMPEDIT Start: Trash multiplier trash = 5 //CHOMPEDIT: Trash good + if(istype(O,/obj/item/stack)) + var/obj/item/stack/S = O + trash = S.amount for(var/mat in O.matter) - modified_mats[mat] = O.matter[mat]*effic_factor*trash//CHOMPEDIT: Trash multiplier + modified_mats[mat] = O.matter[mat] * effic_factor * trash//CHOMPEDIT: Trash multiplier + var/turf/T = get_step(src, dir) + for(var/obj/item/debris_pack/D in T.contents) + if(istype(D)) + for(var/mat in modified_mats) + D.matter[mat] += modified_mats[mat] + update_use_power(USE_POWER_IDLE) + icon_state = "crusher" + qdel(O) + working = FALSE + return //CHOMPEdit End new /obj/item/debris_pack(get_step(src, dir), modified_mats) update_use_power(USE_POWER_IDLE) icon_state = "crusher" diff --git a/code/modules/vore/eating/belly_obj_ch.dm b/code/modules/vore/eating/belly_obj_ch.dm index b1129e6ecf..4448b2c54a 100644 --- a/code/modules/vore/eating/belly_obj_ch.dm +++ b/code/modules/vore/eating/belly_obj_ch.dm @@ -122,6 +122,7 @@ var/speedy_mob_processing = FALSE // Independent belly processing to utilize SSobj instead of SSbellies 3x speed. var/cycle_sloshed = FALSE // Has vorgan entrance made a wet slosh this cycle? Soundspam prevention for multiple items entered. var/egg_cycles = 0 // Process egg mode after 10 cycles. + var/recycling = FALSE // Recycling mode. /obj/belly/proc/GetFullnessFromBelly() if(!affects_vore_sprites) @@ -500,3 +501,33 @@ START_PROCESSING(SSobj, src) else START_PROCESSING(SSbellies, src) + +/obj/item/debris_pack/digested + name = "digested material" + desc = "Some thoroughly digested mass of ... something. Might be useful for recycling." + icon = 'icons/obj/recycling.dmi' + icon_state = "matdust" + color = "#664330" + w_class = ITEMSIZE_SMALL + +/obj/belly/proc/recycle(var/obj/item/O) + if(!recycling || !LAZYLEN(O.matter)) + return FALSE + var/list/modified_mats = list() + var/trash = 1 + if(istype(O,/obj/item/trash)) + trash = 5 + if(istype(O,/obj/item/stack)) + var/obj/item/stack/S = O + trash = S.amount + for(var/mat in O.matter) + modified_mats[mat] = O.matter[mat] * 0.5 * trash + for(var/obj/item/debris_pack/digested/D in contents) + if(istype(D)) + for(var/mat in modified_mats) + D.matter[mat] += modified_mats[mat] + if(O.w_class > D.w_class) + D.w_class = O.w_class + return TRUE + new /obj/item/debris_pack/digested(src, modified_mats) + return TRUE \ No newline at end of file diff --git a/code/modules/vore/eating/belly_obj_vr.dm b/code/modules/vore/eating/belly_obj_vr.dm index d50ba82770..55b7d3e9bb 100644 --- a/code/modules/vore/eating/belly_obj_vr.dm +++ b/code/modules/vore/eating/belly_obj_vr.dm @@ -314,6 +314,7 @@ "sound_volume", "speedy_mob_processing", "egg_name", + "recycling", "is_feedable", //CHOMP end of variables from CHOMP "egg_type", "save_digest_mode", @@ -1714,6 +1715,7 @@ dupe.slow_brutal = slow_brutal dupe.sound_volume = sound_volume dupe.egg_name = egg_name + dupe.recycling = recycling dupe.is_feedable = is_feedable //CHOMP end of variables from CHOMP dupe.belly_fullscreen = belly_fullscreen diff --git a/code/modules/vore/eating/digest_act_vr.dm b/code/modules/vore/eating/digest_act_vr.dm index d704c3a2e4..8a8289ec1d 100644 --- a/code/modules/vore/eating/digest_act_vr.dm +++ b/code/modules/vore/eating/digest_act_vr.dm @@ -91,7 +91,22 @@ O.forceMove(item_storage) else O.forceMove(src.loc) - if(istype(src,/obj/item/stack)) + GLOB.items_digested_roundstat++ + var/g_sound_volume = 100 + if(istype(B)) + g_sound_volume = B.sound_volume + var/soundfile + if(w_class >= 4) + soundfile = pick('sound/vore/shortgurgles/gurgle_L1.ogg', 'sound/vore/shortgurgles/gurgle_L2.ogg', 'sound/vore/shortgurgles/gurgle_L3.ogg') + else if(w_class >= 3) + soundfile = pick('sound/vore/shortgurgles/gurgle_M1.ogg', 'sound/vore/shortgurgles/gurgle_M2.ogg', 'sound/vore/shortgurgles/gurgle_M3.ogg') + else + soundfile = pick('sound/vore/shortgurgles/gurgle_S1.ogg', 'sound/vore/shortgurgles/gurgle_S2.ogg', 'sound/vore/shortgurgles/gurgle_S3.ogg') + playsound(src, soundfile, vol = g_sound_volume, vary = 1, falloff = VORE_SOUND_FALLOFF, preference = /datum/client_preference/eating_noises, volume_channel = VOLUME_CHANNEL_VORE) + if(istype(B) && B.recycle(src)) + g_damage = w_class / 2 + qdel(src) + else if(istype(src,/obj/item/stack)) var/obj/item/stack/S = src if(S.get_amount() <= 1) qdel(src) @@ -99,19 +114,7 @@ S.use(1) digest_stage = w_class else - GLOB.items_digested_roundstat++ - var/g_sound_volume = 100 - if(istype(B)) - g_sound_volume = B.sound_volume - var/soundfile - if(w_class >= 4) - soundfile = pick('sound/vore/shortgurgles/gurgle_L1.ogg', 'sound/vore/shortgurgles/gurgle_L2.ogg', 'sound/vore/shortgurgles/gurgle_L3.ogg') - else if(w_class >= 3) - soundfile = pick('sound/vore/shortgurgles/gurgle_M1.ogg', 'sound/vore/shortgurgles/gurgle_M2.ogg', 'sound/vore/shortgurgles/gurgle_M3.ogg') - else - soundfile = pick('sound/vore/shortgurgles/gurgle_S1.ogg', 'sound/vore/shortgurgles/gurgle_S2.ogg', 'sound/vore/shortgurgles/gurgle_S3.ogg') - playsound(src, soundfile, vol = g_sound_volume, vary = 1, falloff = VORE_SOUND_FALLOFF, preference = /datum/client_preference/eating_noises, volume_channel = VOLUME_CHANNEL_VORE) //CHOMPEdit End - qdel(src) + qdel(src)//CHOMPEdit End if(g_damage > w_class) return w_class return g_damage @@ -186,6 +189,13 @@ . = ..() +/obj/item/debris_pack/digested/digest_act(atom/movable/item_storage = null) //CHOMPAdd + if(isbelly(item_storage)) + var/obj/belly/B = item_storage + if(istype(B) && B.recycling) + return FALSE + . = ..() + ///////////// // Some more complicated stuff ///////////// diff --git a/code/modules/vore/eating/vorepanel_vr.dm b/code/modules/vore/eating/vorepanel_vr.dm index 419b7f8d25..159ca30e43 100644 --- a/code/modules/vore/eating/vorepanel_vr.dm +++ b/code/modules/vore/eating/vorepanel_vr.dm @@ -211,6 +211,7 @@ var/global/list/belly_colorable_only_fullscreens = list("a_synth_flesh_mono", "is_feedable" = selected.is_feedable, //CHOMPAdd "egg_type" = selected.egg_type, "egg_name" = selected.egg_name, //CHOMPAdd + "recycling" = selected.recycling, //CHOMPAdd "nutrition_percent" = selected.nutrition_percent, "digest_brute" = selected.digest_brute, "digest_burn" = selected.digest_burn, @@ -295,6 +296,7 @@ var/global/list/belly_colorable_only_fullscreens = list("a_synth_flesh_mono", selected_list["egg_type"] = selected.egg_type selected_list["egg_name"] = selected.egg_name //CHOMPAdd + selected_list["recycling"] = selected.recycling //CHOMPAdd selected_list["contaminates"] = selected.contaminates selected_list["contaminate_flavor"] = null selected_list["contaminate_color"] = null @@ -855,13 +857,20 @@ var/global/list/belly_colorable_only_fullscreens = list("a_synth_flesh_mono", if(new_egg_type in global_vore_egg_types) new_belly.egg_type = new_egg_type - if(istext(belly_data["egg_name"])) + if(istext(belly_data["egg_name"])) //CHOMPAdd Start var/new_egg_name = html_encode(belly_data["egg_name"]) if(new_egg_name) new_egg_name = readd_quotes(new_egg_name) if(length(new_egg_name) >= BELLIES_NAME_MIN && length(new_egg_name) <= BELLIES_NAME_MAX) new_belly.egg_name = new_egg_name + if(isnum(belly_data["recycling"])) + var/new_recycling = belly_data["recycling"] + if(new_recycling == 0) + new_belly.recycling = FALSE + if(new_recycling == 1) + new_belly.recycling = TRUE //CHOMPAdd End + if(istext(belly_data["selective_preference"])) var/new_selective_preference = belly_data["selective_preference"] if(new_selective_preference == "Digest") @@ -2188,7 +2197,10 @@ var/global/list/belly_colorable_only_fullscreens = list("a_synth_flesh_mono", tgui_alert_async(usr, "Entered name too long (max [BELLIES_NAME_MAX]).","Error") return FALSE host.vore_selected.egg_name = new_egg_name - . = TRUE //CHOMPAdd End + . = TRUE + if("b_recycling") + host.vore_selected.recycling = !host.vore_selected.recycling + . = TRUE//CHOMPAdd End if("b_desc") var/new_desc = html_encode(tgui_input_text(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, multiline = TRUE, prevent_enter = TRUE)) diff --git a/tgui/packages/tgui_ch/interfaces/VorePanel.js b/tgui/packages/tgui_ch/interfaces/VorePanel.js index ee435ac687..feae739aa8 100644 --- a/tgui/packages/tgui_ch/interfaces/VorePanel.js +++ b/tgui/packages/tgui_ch/interfaces/VorePanel.js @@ -49,7 +49,8 @@ const digestModeToPreyMode = { * show_liq, liq_interacts, liq_reagent_gen, liq_reagent_type, liq_reagent_name, * liq_reagent_transfer_verb, liq_reagent_nutri_rate, liq_reagent_capacity, liq_sloshing, liq_reagent_addons, * show_liq_fullness, liq_messages, liq_msg_toggle1, liq_msg_toggle2, liq_msg_toggle3, liq_msg_toggle4, - * liq_msg_toggle5, liq_msg1, liq_msg2, liq_msg3, liq_msg4, liq_msg5, sound_volume, egg_name, + * liq_msg_toggle5, liq_msg1, liq_msg2, liq_msg3, liq_msg4, liq_msg5, sound_volume, egg_name, recycling, + * custom_reagentcolor, custom_reagentalpha, liquid_overlay, max_liquid_level, mush_overlay, mush_color, mush_alpha, max_mush, min_mush, item_mush_val * * To the tabs section of VoreSelectedBelly return * setTabIndex(5)}> @@ -686,6 +687,7 @@ const VoreSelectedBellyOptions = (props, context) => { contaminate_color, egg_type, egg_name, + recycling, selective_preference, save_digest_mode, eating_privacy_local, @@ -882,6 +884,14 @@ const VoreSelectedBellyOptions = (props, context) => { content={egg_name ? egg_name : 'Default'} /> + + ",$e+='
',$e+='
',$e+="Addons:
"+function(e){var t=[];return null==e||e.forEach((function(e){t.push(''+e+"")})),0===t.length&&t.push("No Addons Set"),t}(m)+"

",$e+="== Descriptions ==
",$e+="Vore Verb:
"+i+"

",$e+="Release Verb:
"+a+"

",$e+='Description:
"'+o+'"

',$e+='Absorbed Description:
"'+r+'"

',$e+="
",$e+="== Messages ==
",$e+='
',$e+='
",$e+='
',$e+='
',$e+='
',null==A||A.forEach((function(e){$e+=e+"
"})),$e+="
",$e+='
',null==M||M.forEach((function(e){$e+=e+"
"})),$e+="
",$e+='
',null==E||E.forEach((function(e){$e+=e+"
"})),$e+="
",$e+='
',null==O||O.forEach((function(e){$e+=e+"
"})),$e+="
",$e+='
',null==P||P.forEach((function(e){$e+=e+"
"})),$e+="
",$e+='
',null==F||F.forEach((function(e){$e+=e+"
"})),$e+="
",$e+='
',null==D||D.forEach((function(e){$e+=e+"
"})),$e+="
",$e+='
',null==R||R.forEach((function(e){$e+=e+"
"})),$e+="
",$e+='
',null==j||j.forEach((function(e){$e+=e+"
"})),$e+="
",$e+='
',null==W||W.forEach((function(e){$e+=e+"
"})),$e+="
",$e+='
',null==z||z.forEach((function(e){$e+=e+"
"})),$e+="
",$e+='
',null==U||U.forEach((function(e){$e+=e+"
"})),$e+="
",$e+="
",$e+="
",$e+="
",$e+="
= Idle Messages =

",$e+="

Idle Messages (Hold):

",null==q||q.forEach((function(e){$e+=e+"
"})),$e+="


",$e+="
Idle Messages (Hold Absorbed):

",null==G||G.forEach((function(e){$e+=e+"
"})),$e+="


",$e+="
Idle Messages (Digest):

",null==H||H.forEach((function(e){$e+=e+"
"})),$e+="


",$e+="
Idle Messages (Absorb):

",null==K||K.forEach((function(e){$e+=e+"
"})),$e+="


",$e+="
Idle Messages (Unabsorb):

",null==ee||ee.forEach((function(e){$e+=e+"
"})),$e+="


",$e+="
Idle Messages (Drain):

",null==$||$.forEach((function(e){$e+=e+"
"})),$e+="


",$e+="
Idle Messages (Heal):

",null==Y||Y.forEach((function(e){$e+=e+"
"})),$e+="


",$e+="
Idle Messages (Size Steal):

",null==X||X.forEach((function(e){$e+=e+"
"})),$e+="


",$e+="
Idle Messages (Shrink):

",null==J||J.forEach((function(e){$e+=e+"
"})),$e+="


",$e+="
Idle Messages (Grow):

",null==Z||Z.forEach((function(e){$e+=e+"
"})),$e+="


",$e+="
Idle Messages (Encase In Egg):

",null==Q||Q.forEach((function(e){$e+=e+"
"})),$e+="


",$e+="


",$e+="
",$e+='
',$e+='
',$e+='

',$e+='

",$e+='
',$e+='
',$e+='
    ',$e+='
  • Can Taste: '+(b?'Yes':'No')+"
  • ",$e+='
  • Feedable: '+(N?'Yes':'No')+"
  • ",$e+='
  • Contaminates: '+(g?'Yes':'No')+"
  • ",$e+='
  • Contamination Flavor: '+V+"
  • ",$e+='
  • Contamination Color: '+v+"
  • ",$e+='
  • Nutritional Gain: '+_+"%
  • ",$e+='
  • Required Examine Size: '+100*y+"%
  • ",$e+='
  • Display Absorbed Examines: '+(k?'True':'False')+"
  • ",$e+='
  • Save Digest Mode: '+(x?'True':'False')+"
  • ",$e+='
  • Idle Emotes: '+(w?'Active':'Inactive')+"
  • ",$e+='
  • Idle Emote Delay: '+L+" seconds
  • ",$e+='
  • Shrink/Grow Size: '+100*B+"%
  • ",$e+='
  • Vore Spawn Blacklist: '+(S?'Yes':'No')+"
  • ",$e+='
  • Egg Type: '+I+"
  • ",$e+='
  • Selective Mode Preference: '+T+"
  • ",$e+="
",$e+="
",$e+='
',$e+='

',$e+='

",$e+='
',$e+='
',$e+='
    ',$e+='
  • Fleshy Belly: '+(te?'Yes':'No')+"
  • ",$e+='
  • Internal Loop: '+(ne?'Yes':'No')+"
  • ",$e+='
  • Use Fancy Sounds: '+(oe?'Yes':'No')+"
  • ",$e+='
  • Vore Sound: '+re+"
  • ",$e+='
  • Release Sound: '+ie+"
  • ",$e+="
",$e+="
",$e+='
',$e+='

',$e+='

",$e+='
",$e+='
',$e+="Vore Sprites",$e+='
    ',$e+='
  • Affect Vore Sprites: '+(ae?'Yes':'No')+"
  • ",$e+='
  • Count Absorbed prey for vore sprites: '+(ce?'Yes':'No')+"
  • ",$e+='
  • Animation when prey resist: '+(le?'Yes':'No')+"
  • ",$e+='
  • Vore Sprite Size Factor: '+de+"
  • ",$e+='
  • Belly Sprite to affect: '+se+"
  • ",$e+="
",$e+="Belly Fullscreens Preview and Coloring",$e+='
    ',$e+='
  • Color: '+ue+"",$e+="
",$e+="Vore FX",$e+='
    ',$e+='
  • Disable Prey HUD: '+(me?'Yes':'No')+"
  • ",$e+="
",$e+="
",$e+='
',$e+='

',$e+='

",$e+='
',$e+='
',$e+="Belly Interactions ("+(pe?'Enabled':'Disabled')+")",$e+='
    ',$e+='
  • Escape Chance: '+fe+"%
  • ",$e+='
  • Escape Time: '+he/10+"s
  • ",$e+='
  • Transfer Chance: '+Ce+"%
  • ",$e+='
  • Transfer Location: '+be+"
  • ",$e+='
  • Secondary Transfer Chance: '+Ne+"%
  • ",$e+='
  • Secondary Transfer Location: '+ge+"
  • ",$e+='
  • Absorb Chance: '+Ve+"%
  • ",$e+='
  • Digest Chance: '+ve+"%
  • ",$e+="
",$e+="
",$e+="Auto-Transfer Options ("+(Le?'Enabled':'Disabled')+")",$e+='
    ',$e+='
  • Auto-Transfer Time: '+_e/10+"s
  • ",$e+='
  • Auto-Transfer Chance: '+ye+"%
  • ",$e+='
  • Auto-Transfer Location: '+ke+"
  • ",$e+='
  • Auto-Transfer Chance: '+xe+"%
  • ",$e+='
  • Auto-Transfer Location: '+we+"
  • ",$e+='
  • Auto-Transfer Min Amount: '+Be+"
  • ",$e+='
  • Auto-Transfer Max Amount: '+Se+"
  • ",$e+="
",$e+="
",$e+='
',$e+='

',$e+='

",$e+='
',$e+='
',$e+='
    ',$e+='
  • Generate Liquids: '+(Te?'On':'Off')+"
  • ",$e+='
  • Liquid Type: '+Ae+"
  • ",$e+='
  • Liquid Name: '+Me+"
  • ",$e+='
  • Transfer Verb: '+Ee+"
  • ",$e+='
  • Generation Time: '+Oe+"
  • ",$e+='
  • Liquid Capacity: '+Pe+"
  • ",$e+='
  • Slosh Sounds: '+(Fe?'On':'Off')+"
  • ",$e+='
  • Liquid Addons: '+function(e){var t=[];return null==e||e.forEach((function(e){t.push(''+e+"")})),0===t.length&&t.push("No Addons Set"),t}(De)+"
  • ",$e+="
",$e+="
",$e+='
',$e+='

',$e+='

",$e+='
',$e+='
',$e+='
',$e+='
",$e+='
',$e+='
',$e+='
',null==He||He.forEach((function(e){$e+=e+"
"})),$e+="
",$e+='
',null==qe||qe.forEach((function(e){$e+=e+"
"})),$e+="
",$e+='
',null==Ge||Ge.forEach((function(e){$e+=e+"
"})),$e+="
",$e+='
',null==Ke||Ke.forEach((function(e){$e+=e+"
"})),$e+="
",$e+='
',null==Ye||Ye.forEach((function(e){$e+=e+"
"})),$e+="
",$e+="
",$e+="
",$e+="
",$e+="
",$e+="
"},m=function(e,t){var n,o=(0,r.useBackend)(e),i=(o.act,o.data),a=i.db_version,c=i.db_repo,l=i.mob_name,d=i.bellies,s=function(){var e=new Date,t=String(e.getHours());t.length<2&&(t="0"+t);var n=String(e.getMinutes());n.length<2&&(n="0"+n);var o=String(e.getDate());o.length<2&&(o="0"+o);var r=String(e.getMonth()+1);return r.length<2&&(r="0"+r)," "+String(e.getFullYear())+"-"+r+"-"+o+" ("+t+" "+n+")"}(),m=l+s+t;if(".html"===t){n=new Blob([''+d.length+" Exported Bellies (DB_VER: "+c+"-"+a+')

Bellies of '+l+'

Generated on: '+s+'

'],{type:"text/html;charset=utf8"}),d.forEach((function(e,t){n=new Blob([n,u(e,t)],{type:"text/html;charset=utf8"})})),n=new Blob([n,"
",'