mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 10:12:45 +00:00
[MIRROR] porting healthbars from roguestar + disassemble mat fixes (#7649)
Co-authored-by: Heroman3003 <31296024+Heroman3003@users.noreply.github.com> Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
This commit is contained in:
@@ -22,3 +22,12 @@ GLOBAL_DATUM_INIT(stat_set_event, /decl/observ/stat_set, new)
|
||||
. = ..()
|
||||
if(stat != old_stat)
|
||||
GLOB.stat_set_event.raise_event(src, old_stat, new_stat)
|
||||
|
||||
if(isbelly(src.loc))
|
||||
var/obj/belly/ourbelly = src.loc
|
||||
if(!ourbelly.owner.client)
|
||||
return
|
||||
if(stat == CONSCIOUS)
|
||||
to_chat(ourbelly.owner, "<span class='notice'>\The [src.name] is awake.</span>")
|
||||
else if(stat == UNCONSCIOUS)
|
||||
to_chat(ourbelly.owner, "<span class='red'>\The [src.name] has fallen unconscious!</span>")
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
if(W.has_tool_quality(TOOL_WELDER) && material.shard_can_repair)
|
||||
var/obj/item/weapon/weldingtool/WT = W.get_welder()
|
||||
if(WT.remove_fuel(0, user))
|
||||
material.place_sheet(loc)
|
||||
material.place_sheet(loc, 1)
|
||||
qdel(src)
|
||||
return
|
||||
return ..()
|
||||
|
||||
@@ -159,7 +159,7 @@
|
||||
|
||||
/obj/structure/bed/proc/remove_padding()
|
||||
if(padding_material)
|
||||
padding_material.place_sheet(get_turf(src))
|
||||
padding_material.place_sheet(get_turf(src), 1)
|
||||
padding_material = null
|
||||
update_icon()
|
||||
|
||||
@@ -168,9 +168,9 @@
|
||||
update_icon()
|
||||
|
||||
/obj/structure/bed/proc/dismantle()
|
||||
material.place_sheet(get_turf(src))
|
||||
material.place_sheet(get_turf(src), 1)
|
||||
if(padding_material)
|
||||
padding_material.place_sheet(get_turf(src))
|
||||
padding_material.place_sheet(get_turf(src), 1)
|
||||
|
||||
/obj/structure/bed/psych
|
||||
name = "psychiatrist's couch"
|
||||
|
||||
@@ -67,7 +67,7 @@ var/global/list/stool_cache = list() //haha stool
|
||||
|
||||
/obj/item/weapon/stool/proc/remove_padding()
|
||||
if(padding_material)
|
||||
padding_material.place_sheet(get_turf(src))
|
||||
padding_material.place_sheet(get_turf(src), 1)
|
||||
padding_material = null
|
||||
update_icon()
|
||||
|
||||
@@ -104,9 +104,9 @@ var/global/list/stool_cache = list() //haha stool
|
||||
|
||||
/obj/item/weapon/stool/proc/dismantle()
|
||||
if(material)
|
||||
material.place_sheet(get_turf(src))
|
||||
material.place_sheet(get_turf(src), 1)
|
||||
if(padding_material)
|
||||
padding_material.place_sheet(get_turf(src))
|
||||
padding_material.place_sheet(get_turf(src), 1)
|
||||
qdel(src)
|
||||
|
||||
/obj/item/weapon/stool/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
|
||||
@@ -344,6 +344,12 @@ var/list/_client_preferences_by_type
|
||||
enabled_description = "On"
|
||||
disabled_description = "Off"
|
||||
|
||||
/datum/client_preference/vore_health_bars
|
||||
description = "Vore Health Bars"
|
||||
key = "VORE_HEALTH_BARS"
|
||||
enabled_description = "Enabled"
|
||||
disabled_description = "Disabled"
|
||||
|
||||
/datum/client_preference/runechat_mob
|
||||
description = "Runechat (Mobs)"
|
||||
key = "RUNECHAT_MOB"
|
||||
|
||||
@@ -481,6 +481,19 @@ CHOMPRemove. Bundled voice sounds into emote/whisper/subtle. Going this extra le
|
||||
feedback_add_details("admin_verb","TSubtleSounds")
|
||||
*/
|
||||
|
||||
/client/verb/toggle_vore_health_bars()
|
||||
set name = "Toggle Vore Health Bars"
|
||||
set category = "Preferences"
|
||||
set desc = "Toggle the display of vore related health bars"
|
||||
|
||||
var/pref_path = /datum/client_preference/vore_health_bars
|
||||
toggle_preference(pref_path)
|
||||
SScharacter_setup.queue_preferences_save(prefs)
|
||||
|
||||
to_chat(src, "Vore related health bars - [(is_preference_enabled(/datum/client_preference/vore_health_bars)) ? "Enabled" : "Disabled"]")
|
||||
|
||||
feedback_add_details("admin_verb","TVoreHealthBars")
|
||||
|
||||
// Not attached to a pref datum because those are strict binary toggles
|
||||
/client/verb/toggle_examine_mode()
|
||||
set name = "Toggle Examine Mode"
|
||||
|
||||
@@ -322,7 +322,7 @@ var/list/name_to_material
|
||||
// General wall debris product placement.
|
||||
// Not particularly necessary aside from snowflakey cult girders.
|
||||
/datum/material/proc/place_dismantled_product(var/turf/target)
|
||||
place_sheet(target)
|
||||
place_sheet(target, 1)
|
||||
|
||||
// Debris product. Used ALL THE TIME.
|
||||
/datum/material/proc/place_sheet(var/turf/target, amount)
|
||||
|
||||
@@ -696,6 +696,7 @@
|
||||
stat("Keys Held", keys2text(client.move_keys_held | client.mod_keys_held))
|
||||
stat("Next Move ADD", dirs2text(client.next_move_dir_add))
|
||||
stat("Next Move SUB", dirs2text(client.next_move_dir_sub))
|
||||
stat("Current size:", size_multiplier * 100)
|
||||
|
||||
if(statpanel("MC"))
|
||||
stat("Location:", "([x], [y], [z]) [loc]")
|
||||
|
||||
@@ -305,13 +305,13 @@ var/list/table_icon_cache = list()
|
||||
var/obj/item/weapon/material/shard/S = null
|
||||
if(reinforced)
|
||||
if(reinforced.stack_type && (full_return || prob(20)))
|
||||
reinforced.place_sheet(loc)
|
||||
reinforced.place_sheet(loc, 1)
|
||||
else
|
||||
S = reinforced.place_shard(loc)
|
||||
if(S) shards += S
|
||||
if(material)
|
||||
if(material.stack_type && (full_return || prob(20)))
|
||||
material.place_sheet(loc)
|
||||
material.place_sheet(loc, 1)
|
||||
else
|
||||
S = material.place_shard(loc)
|
||||
if(S) shards += S
|
||||
|
||||
113
code/modules/vore/chat_healthbars.dm
Normal file
113
code/modules/vore/chat_healthbars.dm
Normal file
@@ -0,0 +1,113 @@
|
||||
//Health bars in the game window would be pretty challenging and I don't know how to do that, so I thought this would be a good alternative
|
||||
|
||||
/mob/living/proc/chat_healthbar(var/mob/living/reciever, override = FALSE)
|
||||
if(!reciever) //No one to send it to, don't bother
|
||||
return
|
||||
if(!reciever.client) //No one is home, don't bother
|
||||
return
|
||||
if(!override) //Did the person push the verb? Ignore the pref
|
||||
if(!reciever.client.is_preference_enabled(/datum/client_preference/vore_health_bars))
|
||||
return
|
||||
var/ourpercent = 0
|
||||
|
||||
if(ishuman(src)) //humans don't die or become unconcious at 0%, it's actually like -50% or something, so, let's pretend they have 50 more health than they do
|
||||
ourpercent = ((health + 50) / (maxHealth + 50)) * 100
|
||||
else
|
||||
ourpercent = (health / maxHealth) * 100
|
||||
|
||||
var/ourbar = ""
|
||||
var/obj/belly/ourbelly = src.loc
|
||||
var/which_var = "Health"
|
||||
if(ourbelly.digest_mode == "Absorb" || ourbelly.digest_mode == "Drain")
|
||||
ourpercent = round(((nutrition - 100) / 500) * 100)
|
||||
which_var = "Nutrition" //It's secretly also a nutrition bar depending on your digest mode
|
||||
|
||||
ourpercent = round(ourpercent)
|
||||
|
||||
switch(ourpercent) //I thought about trying to do this in a more automated way but my brain isn't very large so enjoy my stupid switch statement
|
||||
if(100)
|
||||
ourbar = "|▓▓▓▓▓▓▓▓▓▓|"
|
||||
if(95 to 99)
|
||||
ourbar = "|▓▓▓▓▓▓▓▓▓▒|"
|
||||
if(90 to 94)
|
||||
ourbar = "|▓▓▓▓▓▓▓▓▓░|"
|
||||
if(85 to 89)
|
||||
ourbar = "|▓▓▓▓▓▓▓▓▒░|"
|
||||
if(80 to 84)
|
||||
ourbar = "|▓▓▓▓▓▓▓▓░░|"
|
||||
if(75 to 79)
|
||||
ourbar = "|▓▓▓▓▓▓▓▒░░|"
|
||||
if(70 to 74)
|
||||
ourbar = "|▓▓▓▓▓▓▓░░░|"
|
||||
if(65 to 69)
|
||||
ourbar = "|▓▓▓▓▓▓▒░░░|"
|
||||
if(60 to 64)
|
||||
ourbar = "|▓▓▓▓▓▓░░░░|"
|
||||
if(55 to 59)
|
||||
ourbar = "|▓▓▓▓▓▒░░░░|"
|
||||
if(50 to 54)
|
||||
ourbar = "|▓▓▓▓▓░░░░░|"
|
||||
if(45 to 49)
|
||||
ourbar = "|▓▓▓▓▒░░░░░|"
|
||||
if(40 to 44)
|
||||
ourbar = "|▓▓▓▓░░░░░░|"
|
||||
if(35 to 39)
|
||||
ourbar = "|▓▓▓▒░░░░░░|"
|
||||
if(30 to 34)
|
||||
ourbar = "|▓▓▓░░░░░░░|"
|
||||
if(25 to 29)
|
||||
ourbar = "|▓▓▒░░░░░░░|"
|
||||
if(20 to 24)
|
||||
ourbar = "|▓▓░░░░░░░░|"
|
||||
if(15 to 19)
|
||||
ourbar = "|▓▒░░░░░░░░|"
|
||||
if(10 to 14)
|
||||
ourbar = "|▓░░░░░░░░░|"
|
||||
if(5 to 9)
|
||||
ourbar = "|▒░░░░░░░░░|"
|
||||
if(0)
|
||||
ourbar = "|░░░░░░░░░░|"
|
||||
else
|
||||
ourbar = "!░░░░░░░░░░!"
|
||||
|
||||
ourbar = "[ourbar] [which_var] - [src.name]"
|
||||
|
||||
if(stat == UNCONSCIOUS)
|
||||
ourbar = "[ourbar] - [span_orange("<b>UNCONSCIOUS</b>")]"
|
||||
else if(stat == DEAD)
|
||||
ourbar = "[ourbar] - [span_red("<b>DEAD</b>")]"
|
||||
if(absorbed)
|
||||
ourbar = span_purple("[ourbar] - ABSORBED") //Absorb is a little funny, I didn't want it to say 'absorbing ABSORBED' so we did it different
|
||||
else if(ourpercent > 75)
|
||||
ourbar = span_green("[ourbar] - [ourbelly.digest_mode]ing")
|
||||
else if(ourpercent > 50)
|
||||
ourbar = span_yellow("[ourbar] - [ourbelly.digest_mode]ing")
|
||||
else if(ourpercent > 25)
|
||||
ourbar = span_orange("[ourbar] - [ourbelly.digest_mode]ing")
|
||||
else if(ourpercent > 0)
|
||||
ourbar = span_red("[ourbar] - [ourbelly.digest_mode]ing")
|
||||
else
|
||||
ourbar = "<span class='vdanger'>[ourbar] - [ourbelly.digest_mode]ing</span>"
|
||||
|
||||
to_chat(reciever,"<span class='vnotice'>[ourbar]</span>")
|
||||
|
||||
/mob/living/verb/print_healthbars()
|
||||
set name = "Print Prey Healthbars"
|
||||
set category = "Abilities"
|
||||
|
||||
var/nuffin = TRUE
|
||||
for(var/obj/belly/b in vore_organs)
|
||||
if(!b.contents.len)
|
||||
continue
|
||||
var/belly_announce = FALSE //We only want to announce the belly once
|
||||
for(var/thing as anything in b.contents)
|
||||
if(!isliving(thing))
|
||||
continue
|
||||
if(!belly_announce)
|
||||
to_chat(src, "<span class='vnotice'>[b.digest_mode] - Within [b.name]:</span>") //We only want to announce the belly if we found something
|
||||
belly_announce = TRUE
|
||||
var/mob/living/ourmob = thing
|
||||
ourmob.chat_healthbar(src, TRUE)
|
||||
nuffin = FALSE
|
||||
if(nuffin)
|
||||
to_chat(src, "<span class='vwarning'>There are no mobs within any of your bellies to print health bars for.</span>")
|
||||
@@ -62,7 +62,7 @@ GLOBAL_LIST_INIT(digest_modes, list())
|
||||
//CHOMPedit end
|
||||
|
||||
// Deal digestion damage (and feed the pred)
|
||||
var/old_health = L.health; //CHOMPEdit - Store old health for the hard crit calculation
|
||||
var/old_health = L.health
|
||||
var/old_brute = L.getBruteLoss()
|
||||
var/old_burn = L.getFireLoss()
|
||||
var/old_oxy = L.getOxyLoss()
|
||||
@@ -87,6 +87,8 @@ GLOBAL_LIST_INIT(digest_modes, list())
|
||||
damage_gain = damage_gain * 0.5
|
||||
var/offset = (1 + ((L.weight - 137) / 137)) // 130 pounds = .95 140 pounds = 1.02
|
||||
var/difference = B.owner.size_multiplier / L.size_multiplier
|
||||
|
||||
consider_healthbar(L, old_health, B.owner)
|
||||
if(B.health_impacts_size) //CHOMPEdit - Health probably changed so...
|
||||
B.owner.update_fullness() //CHOMPEdit - This is run whenever a belly's contents are changed.
|
||||
/*if(isrobot(B.owner)) //CHOMPEdit: Borgos can now use nutrition too
|
||||
@@ -117,12 +119,17 @@ GLOBAL_LIST_INIT(digest_modes, list())
|
||||
/datum/digest_mode/absorb/process_mob(obj/belly/B, mob/living/L)
|
||||
if(!L.absorbable || L.absorbed)
|
||||
return null
|
||||
|
||||
var/old_nutrition = L.nutrition
|
||||
B.steal_nutrition(L)
|
||||
if(L.nutrition < 100)
|
||||
B.absorb_living(L)
|
||||
if(B.reagent_mode_flags & DM_FLAG_REAGENTSABSORB && B.reagents.total_volume < B.reagents.maximum_volume) //CHOMPedit: absorption reagent production
|
||||
B.GenerateBellyReagents_absorbed() //CHOMPedit end: A bonus for pred, I know for a fact prey is usually at zero nutrition when absorption finally happens
|
||||
consider_healthbar(L, old_nutrition, B.owner)
|
||||
return list("to_update" = TRUE)
|
||||
else
|
||||
consider_healthbar(L, old_nutrition, B.owner)
|
||||
|
||||
/datum/digest_mode/unabsorb
|
||||
id = DM_UNABSORB
|
||||
@@ -138,7 +145,9 @@ GLOBAL_LIST_INIT(digest_modes, list())
|
||||
noise_chance = 10
|
||||
|
||||
/datum/digest_mode/drain/process_mob(obj/belly/B, mob/living/L)
|
||||
var/old_nutrition = L.nutrition
|
||||
B.steal_nutrition(L)
|
||||
consider_healthbar(L, old_nutrition, B.owner)
|
||||
|
||||
/datum/digest_mode/drain/shrink
|
||||
id = DM_SHRINK
|
||||
@@ -377,3 +386,106 @@ GLOBAL_LIST_INIT(digest_modes, list())
|
||||
else
|
||||
tempmode = DM_DRAIN // Otherwise drain.
|
||||
return tempmode
|
||||
|
||||
/datum/digest_mode/proc/consider_healthbar()
|
||||
return
|
||||
|
||||
/datum/digest_mode/digest/consider_healthbar(mob/living/L, old_health, mob/living/reciever)
|
||||
|
||||
if(old_health <= L.health)
|
||||
return
|
||||
|
||||
var/old_percent
|
||||
var/new_percent
|
||||
|
||||
if(ishuman(L))
|
||||
old_percent = ((old_health + 50) / (L.maxHealth + 50)) * 100
|
||||
new_percent = ((L.health + 50) / (L.maxHealth + 50)) * 100
|
||||
else
|
||||
old_percent = (old_health / L.maxHealth) * 100
|
||||
new_percent = (L.health / L.maxHealth) * 100
|
||||
|
||||
var/lets_announce = FALSE
|
||||
if(new_percent <= 75 && old_percent > 75)
|
||||
lets_announce = TRUE
|
||||
else if(new_percent <= 50 && old_percent > 50)
|
||||
lets_announce = TRUE
|
||||
else if(new_percent <= 25 && old_percent > 25)
|
||||
lets_announce = TRUE
|
||||
else if(new_percent <= 5 && old_percent > 5)
|
||||
lets_announce = TRUE
|
||||
|
||||
if(lets_announce)
|
||||
L.chat_healthbar(reciever)
|
||||
L.chat_healthbar(L)
|
||||
|
||||
/datum/digest_mode/heal/consider_healthbar(mob/living/L, old_health, mob/living/reciever)
|
||||
|
||||
if(old_health >= L.health)
|
||||
return
|
||||
|
||||
var/old_percent
|
||||
var/new_percent
|
||||
|
||||
if(ishuman(L))
|
||||
old_percent = ((old_health + 50) / (L.maxHealth + 50)) * 100
|
||||
new_percent = ((L.health + 50) / (L.maxHealth + 50)) * 100
|
||||
else
|
||||
old_percent = (old_health / L.maxHealth) * 100
|
||||
new_percent = (L.health / L.maxHealth) * 100
|
||||
|
||||
var/lets_announce = FALSE
|
||||
if(new_percent >= 75 && old_percent < 75)
|
||||
lets_announce = TRUE
|
||||
else if(new_percent >= 50 && old_percent < 50)
|
||||
lets_announce = TRUE
|
||||
else if(new_percent >= 25 && old_percent < 25)
|
||||
lets_announce = TRUE
|
||||
else if(new_percent >= 5 && old_percent < 5)
|
||||
lets_announce = TRUE
|
||||
|
||||
if(lets_announce)
|
||||
L.chat_healthbar(reciever)
|
||||
L.chat_healthbar(L)
|
||||
|
||||
/datum/digest_mode/absorb/consider_healthbar(mob/living/L, old_nutrition, mob/living/reciever)
|
||||
if(old_nutrition <= L.nutrition)
|
||||
return
|
||||
|
||||
var/old_percent = ((old_nutrition - 100) / 500) * 100
|
||||
var/new_percent = ((L.nutrition - 100) / 500) * 100
|
||||
var/lets_announce = FALSE
|
||||
if(new_percent <= 75 && old_percent > 75)
|
||||
lets_announce = TRUE
|
||||
else if(new_percent <= 50 && old_percent > 50)
|
||||
lets_announce = TRUE
|
||||
else if(new_percent <= 25 && old_percent > 25)
|
||||
lets_announce = TRUE
|
||||
else if(new_percent <= 0 && old_percent > 0)
|
||||
lets_announce = TRUE
|
||||
|
||||
if(lets_announce)
|
||||
L.chat_healthbar(reciever)
|
||||
L.chat_healthbar(L)
|
||||
|
||||
/datum/digest_mode/drain/consider_healthbar(mob/living/L, old_nutrition, mob/living/reciever)
|
||||
|
||||
if(old_nutrition <= L.nutrition)
|
||||
return
|
||||
|
||||
var/old_percent = ((old_nutrition - 100) / 500) * 100
|
||||
var/new_percent = ((L.nutrition - 100) / 500) * 100
|
||||
|
||||
var/lets_announce = FALSE
|
||||
if(new_percent <= 75 && old_percent > 75)
|
||||
lets_announce = TRUE
|
||||
else if(new_percent <= 50 && old_percent > 50)
|
||||
lets_announce = TRUE
|
||||
else if(new_percent <= 25 && old_percent > 25)
|
||||
lets_announce = TRUE
|
||||
else if(new_percent <= 0 && old_percent > 0)
|
||||
lets_announce = TRUE
|
||||
|
||||
if(lets_announce)
|
||||
L.chat_healthbar(reciever)
|
||||
L.chat_healthbar(L)
|
||||
|
||||
@@ -1970,6 +1970,9 @@ var/global/list/belly_colorable_only_fullscreens = list("a_synth_flesh_mono",
|
||||
if(!results || !results.len)
|
||||
results = list("You were unable to examine that. Tell a developer!")
|
||||
to_chat(user, jointext(results, "<br>"))
|
||||
if(isliving(target))
|
||||
var/mob/living/ourtarget = target
|
||||
ourtarget.chat_healthbar(user)
|
||||
return TRUE
|
||||
|
||||
if("Use Hand")
|
||||
@@ -2087,6 +2090,9 @@ var/global/list/belly_colorable_only_fullscreens = list("a_synth_flesh_mono",
|
||||
if(!results || !results.len)
|
||||
results = list("You were unable to examine that. Tell a developer!")
|
||||
to_chat(user, jointext(results, "<br>"))
|
||||
if(isliving(target))
|
||||
var/mob/living/ourtarget = target
|
||||
ourtarget.chat_healthbar(user)
|
||||
return TRUE
|
||||
|
||||
if("Eject")
|
||||
|
||||
@@ -4397,6 +4397,7 @@
|
||||
#include "code\modules\virus2\helpers.dm"
|
||||
#include "code\modules\virus2\isolator.dm"
|
||||
#include "code\modules\virus2\items_devices.dm"
|
||||
#include "code\modules\vore\chat_healthbars.dm"
|
||||
#include "code\modules\vore\hook-defs_vr.dm"
|
||||
#include "code\modules\vore\mouseray.dm"
|
||||
#include "code\modules\vore\trycatch_vr.dm"
|
||||
|
||||
Reference in New Issue
Block a user