hunger 0.1

This commit is contained in:
unid15
2015-12-08 20:22:25 +01:00
parent 82fae97d21
commit a9f3a5e5f4
18 changed files with 423 additions and 276 deletions

View File

@@ -152,3 +152,8 @@
dview_mob.loc = center; \
dview_mob.see_invisible = invis_flags; \
for(type in view(range, dview_mob))
//HARDCORE MODE STUFF (mainly hunger)
#define hardcore_mode_on ((ticker) && (ticker.hardcore_mode))
#define eligible_for_hardcore_mode(M) (M.ckey && M.client)

View File

@@ -27,6 +27,9 @@ var/global/datum/controller/gameticker/ticker
var/random_players = 0 // if set to nonzero, ALL players who latejoin or declare-ready join will have random appearances/genders
var/hardcore_mode = 0 //If set to nonzero, hardcore mode is enabled (current hardcore mode features: damage from hunger)
//Use the hardcore_mode_on macro - if(hardcore_mode_on) to_chat(user,"You're hardcore!")
var/list/syndicate_coalition = list() // list of traitor-compatible factions
var/list/factions = list() // list of all factions
var/list/availablefactions = list() // list of factions with openings

View File

@@ -179,8 +179,14 @@ Subject's pulse: ??? BPM"})
if(M.status_flags & FAKEDEATH)
OX = fake_oxy > 50 ? "<font color='blue'><b>Severe oxygen deprivation detected</b></font>" : "Subject bloodstream oxygen level normal"
message += ("<br>[OX] | [TX] | [BU] | [BR]")
if(M.reagents.total_volume)
message += "<br><span class='warning'>Warning: Unknown substance detected in subject's blood.</span>"
if(hardcore_mode_on && ishuman(M) && eligible_for_hardcore_mode(M))
var/mob/living/carbon/human/H = M
if(H.nutrition < STARVATION_MIN)
message += "<br><span class='danger'>Warning: Severe lack of essential nutriments detected in subject's blood.</span>"
if(iscarbon(M))
var/mob/living/carbon/C = M
if(C.virus2.len)

View File

@@ -757,6 +757,7 @@ var/global/floorIsLava = 0
<BR>
<B>Fun Secrets</B><BR>
<BR>
<A href='?src=\ref[src];secretsfun=hardcore_mode'>[ticker&&ticker.hardcore_mode ? "Disable" : "Enable"] hardcore mode (makes starvation kill!)</A><BR>
<A href='?src=\ref[src];secretsfun=sec_clothes'>Remove 'internal' clothing</A><BR>
<A href='?src=\ref[src];secretsfun=sec_all_clothes'>Remove ALL clothing</A><BR>
<A href='?src=\ref[src];secretsfun=monkey'>Turn all humans into monkeys</A><BR>

View File

@@ -2986,6 +2986,23 @@
var/emag = input("Emag the turret?") in list("Yes", "No")
if(emag=="Yes")
Turret.emag(usr)
if("hardcore_mode")
if(!ticker) return
var/choice = input("Are you sure you want to [ticker.hardcore_mode ? "disable" : "enable"] hardcore mode? Starvation will [ticker.hardcore_mode ? "no longer":""]slowly kill player-controlled humans.", "Admin Abuse") in list("Yes", "No!")
if(choice == "Yes")
if(!ticker.hardcore_mode)
log_admin("[key_name(usr)] has ENABLED hardcore mode!")
ticker.hardcore_mode = 1
to_chat(world, "<h5><span class='danger'>Hardcore mode has been enabled</span></h5>")
to_chat(world, "<span class='info'>Not eating for a prolonged period of time will slowly kill player-controlled characters (braindead and catatonic characters are not affected).</span>")
to_chat(world, "<span class='info'>If your hunger indicator starts flashing red and black, your character is starving and may die soon!</span>")
else
log_admin("[key_name(usr)] has DISABLED hardcore mode!")
ticker.hardcore_mode = 0
to_chat(world, "<h5><span class='danger'>Hardcore mode has been disabled</span></h5>")
to_chat(world, "<span class='info'>Starvation will no longer kill player-controlled characters.</span>")
if(usr)
log_admin("[key_name(usr)] used secret [href_list["secretsfun"]]")
if(ok)

View File

@@ -225,6 +225,9 @@
msg += "<span class='warning'>"
if(nutrition < 100)
if(hardcore_mode_on && eligible_for_hardcore_mode(src))
msg += "<span class='danger'>[t_He] [t_is] severely malnourished.</span>\n"
else
msg += "[t_He] [t_is] severely malnourished.\n"
else if(nutrition >= 500)
if(user.nutrition < 100)

View File

@@ -132,6 +132,15 @@
if(!delay_ready_dna)
dna.ready_dna(src)
if(hardcore_mode_on)
spawn(2 SECONDS)
//Hardcore mode stuff
//Warn the player that not eating will lead to his death
if(eligible_for_hardcore_mode(src))
to_chat(src, "<h5><span class='notice'>Hardcode mode is enabled!</span></h5>")
to_chat(src, "<b>You must eat to survive. Starvation for extended periods of time will kill you!</b>")
to_chat(src, "<b>Keep an eye out on the hunger indicator on the right of your screen; it will start flashing red and black when you're close to starvation.</b>")
/mob/living/carbon/human/player_panel_controls()
var/html=""

View File

@@ -78,7 +78,13 @@
//Nutrition decrease
if(nutrition > 0 && stat != 2)
nutrition = max (0, nutrition - HUNGER_FACTOR)
//Nutrition decreases slower when you're sleeping
var/reduce_nutrition_by = HUNGER_FACTOR
if(sleeping)
reduce_nutrition_by *= 0.25 //Reduce hunger factor by 75%
nutrition = max (0, nutrition - reduce_nutrition_by)
if(nutrition > 450)
if(overeatduration < 600) //capped so people don't take forever to unfat

View File

@@ -195,6 +195,10 @@
if(150 to 250) nutrition_icon.icon_state = "nutrition3"
else nutrition_icon.icon_state = "nutrition4"
if(ticker && ticker.hardcore_mode) //Hardcore mode: flashing nutrition indicator when starving!
if(nutrition < STARVATION_MIN)
nutrition_icon.icon_state = "nutrition5"
if(pressure)
pressure.icon_state = "pressure[pressure_alert]"

View File

@@ -17,3 +17,71 @@
if(!(M.status_flags & GODMODE))
M.adjustBruteLoss(5)
nutrition += 10
//I put the nutriment stuff here
if(!hardcore_mode_on) return //If hardcore mode isn't on, return
if(!eligible_for_hardcore_mode(src)) return //If our mob isn't affected by hardcore mode (like it isn't player controlled), return
if(src.isDead()) return //Don't affect dead dudes
if(nutrition < 100) //Nutrition is below 100 = starvation
var/list/hunger_phrases = list(
"You feel weak and malnourished. You must find something to eat now!",
"You haven't eaten in ages, and your body feels weak! It's time to eat something.",
"You can barely remember the last time you had a proper, nutritional meal. Your body will shut down soon if you don't eat something!",
"Your body is running out of essential nutrients! You have to eat something soon.",
"If you don't eat something very soon, you're going to starve to death."
)
//When you're starving, the rate at which oxygen damage is healed is reduced by 80% (you only restore 1 oxygen damage per life tick, instead of 5)
switch(nutrition)
if(STARVATION_NOTICE to STARVATION_MIN) //60-80
if(sleeping) return
if(prob(2))
to_chat(src, "<span class='notice'>[pick("You're very hungry.","You really could use a meal right now.")]</span>")
if(STARVATION_WEAKNESS to STARVATION_NOTICE) //30-60
if(sleeping) return
if(prob(3)) //3% chance of a tiny amount of oxygen damage (1-10)
adjustOxyLoss(rand(1,10))
to_chat(src, "<span class='danger'>[pick(hunger_phrases)]</span>")
else if(prob(5)) //5% chance of being weakened
eye_blurry += 10
Weaken(10)
adjustOxyLoss(rand(1,15))
to_chat(src, "<span class='danger'>You're starving! The lack of strength makes you black out for a few moments...</span>")
if(STARVATION_NEARDEATH to STARVATION_WEAKNESS) //5-30, 5% chance of weakening and 1-230 oxygen damage. 5% chance of a seizure. 10% chance of dropping item
if(sleeping) return
if(prob(5))
adjustOxyLoss(rand(1,20))
to_chat(src, "<span class='danger'>You're starving. You feel your life force slowly leaving your body...</span>")
eye_blurry += 20
if(weakened < 1) Weaken(20)
else if(paralysis<1 && prob(5)) //Mini seizure (25% duration and strength of a normal seizure)
visible_message("<span class='danger'>\The [src] starts having a seizure!</span>", \
"<span class='warning'>You have a seizure!</span>")
Paralyse(2.5)
Jitter(250)
adjustOxyLoss(rand(1,25))
eye_blurry += 20
if(-INFINITY to STARVATION_NEARDEATH) //Fuck the whole body up at this point
to_chat(src, "<span class='danger'>You are dying from starvation!</span>")
adjustToxLoss(STARVATION_TOX_DAMAGE)
adjustOxyLoss(STARVATION_OXY_DAMAGE)
adjustBrainLoss(STARVATION_BRAIN_DAMAGE)
if(prob(10))
Weaken(15)

View File

@@ -225,7 +225,14 @@ var/global/list/whitelisted_species = list("Human")
else // We're in safe limits
H.failed_last_breath = 0
H.adjustOxyLoss(-5)
var/oxy_restored = 5
if(hardcore_mode_on && eligible_for_hardcore_mode(H)) //HARDCORE MODE stuff
if(H.nutrition < STARVATION_MIN) //Starvation makes oxygen damage heal at a slower rate!
oxy_restored = STARVATION_OXY_HEAL_RATE //Defined as 1
H.adjustOxyLoss(-oxy_restored)
oxygen_used = breath.oxygen/6
H.oxygen_alert = 0

View File

@@ -1343,3 +1343,21 @@ var/proccalls = 1
#define MODE_CHANGELING "changeling"
#define MODE_CULTCHAT "cultchat"
#define MODE_ANCIENT "ancientchat"
//Hardcore mode stuff
#define STARVATION_MIN 60 //If you have less nutrition than this value, the hunger indicator starts flashing
#define STARVATION_NOTICE 45 //If you have more nutrition than this value, you get an occasional message reminding you that you're going to starve soon
#define STARVATION_WEAKNESS 20 //Otherwise, if you have more nutrition than this value, you occasionally become weak and receive minor damage
#define STARVATION_NEARDEATH 5 //Otherwise, if you have more nutrition than this value, you have seizures and occasionally receive damage
//If you have less nutrition than STARVATION_NEARDEATH, you start getting damage
#define STARVATION_OXY_DAMAGE 2.5
#define STARVATION_TOX_DAMAGE 2.5
#define STARVATION_BRAIN_DAMAGE 2.5
#define STARVATION_OXY_HEAL_RATE 1 //While starving, THIS much oxygen damage is restored per life tick (instead of the default 5)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 154 KiB

After

Width:  |  Height:  |  Size: 155 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 141 KiB

After

Width:  |  Height:  |  Size: 141 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 140 KiB

After

Width:  |  Height:  |  Size: 140 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 130 KiB

After

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 114 KiB

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 28 KiB