Adds recycling feature for vorebellies (#6815)

This commit is contained in:
Verkister
2023-08-15 19:11:53 +03:00
committed by GitHub
parent 2826b02088
commit 32b16773c0
7 changed files with 98 additions and 20 deletions

View File

@@ -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"

View File

@@ -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

View File

@@ -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

View File

@@ -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
/////////////

View File

@@ -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))

View File

@@ -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
* <Tabs.Tab selected={tabIndex === 5} onClick={() => 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'}
/>
</LabeledList.Item>
<LabeledList.Item label="Recycling">
<Button
onClick={() => act('set_attribute', { attribute: 'b_recycling' })}
icon={recycling ? 'toggle-on' : 'toggle-off'}
selected={recycling}
content={recycling ? 'Enabled' : 'Disabled'}
/>
</LabeledList.Item>
<LabeledList.Item label="Selective Mode Preference">
<Button
onClick={() =>

File diff suppressed because one or more lines are too long