tAPI W1K's Prime Needs - Prime Needs for your Primary Needs

W1K

Witch
dde614d325.png
A mod for your needs for primary needs
index.php

index.php
With third party mods support
dde614d325.png

We all love sandbox games, we love Terraria because it's a sandbox game. A lot of games following the same genre (take example Minecraft) have fully implemented simple and effective survival elements to make their own games even more interesting. Specifically refering to Minecraft, which was my main inspiration on producing such a mod, while not particularly complex, I always thought its hunger system was well placed and effective, one of its prime features meant to give the player the feel of constant struggle, no matter how much they advance in technologies and resources, they are human beings, they do and will always need to eat to guarantee their survival. I always felt Terraria was not quite meant to have survival elements in the first place as it is a game much more centered around adventuring and platforming action, but in true sandbox feel, why not have the option for it, why not mix Terraria's amazing fast paced platforming features with survival elements? That's where this mod jumps in.


Prime Needs has one purpose: Introducing primary needs to Terraria.

Currently, only hunger and thirst are supported. Planned features include potentially heat and everything you would expect from a mod involving primary needs.

For now, let me explain how hunger and thirst work.
00d43c6f7a.png

Straight and simple, the player's character will now get hungry and thirsty after a certain time has passed without eating any food or drinking any water. New bars positioned below the health bar (and under the minimap if shown) will make the player aware of the current hunger level. Hovering the mouse over the bar shows the current numerical values.
Hunger has different effects on the character's performances:
- A character with 80% and above of their food AND water bar will have a permanent Well Fed buff (only if the water bar is also above 80% too, when thirst is enabled).
- A character with 20% and less of their food OR water bar will have a permanent Weak debuff and no regeneration as if affected by Bleeding.
- A character with 0% of their food OR water bar will start being damaged by starvation/dehydration at a rate of 3% life per second.
- Standing still does not deplete the food/water bar, moving however depletes it at a rate of 1 point every 10 seconds of movement.
As a result of this mechanic:
- It is not possible to get Well Fed or Weak under normal circumstances anymore.
- Food items include Mushrooms, Vile Mushrooms and every item granting Well Fed buff.
-- Mushrooms replenish the food bar by 7.
-- Vile Mushrooms replenish the food bar by 20 but grants the Poisoned debuff for 10 seconds.
-- Every food granting a Well Fed buff will now instead replenish the food bar by an amount equal to 5 per minute (Bowl of Soup normally grants Well Fed for 10 minutes, it now fills the food bar by 50 on use).

- Drinks, currently only one vanilla drink is supported, Bottled Water:
-- Bottled Water, now called "Bottled Water (Dirty)", will replenish the water bar by 20 with a 25% chance of poisoning for 2 minutes.
-- Dirty water can be purified at a Furnace/Campfire to make "Bottled Water (Purified)", granting 50% extra replenish and 0% chance of poisoning.
-- It is also possible to drink straight from a water source, incurring in the same penalties as drinking Dirty Water.
- Every Bottled Water (Dirty Water, Purified Water) can be used for any crafting recipe requiring Bottled Water.


Along with the vanilla edits, external mods are also supported. Every mod item granting Well Fed bonus will also work as food. There are two ways of making your mod compatible:
- Make your custom food items grant a Well Fed buff. To assign buffTime, follow the formula "3600*X" where X is the food value you want to grant to your item. The item's tooltip will automatically be updated to list the food value it grants (note, if your item has a tooltip, make sure to leave the first tooltip blank so that it is not accidentally replaced).
- In your item's json, add the parameter "W1KPN:Food" or "W1KPN:Water" and give it an int value equal to the food/water value you want the item to grant on use. This is a simpler method, however the tooltip will not automatically update and you'll need to give your item a custom tooltip stating the food value if you wish.
Currently, not all functions from the tConfig version are supported due to some limitations. Changing the vanilla items food values is not possible (however you CAN change the vanilla Well Fed buffs times). Speeding up/slowing down hunger/thirst are not supported by external mods, but they can be changed in the mod's config menu. All these might come back at a later time, but they might need Prime Needs to be set as a dependency for the mod you wish for it to support.
An example plugin mod can be found here.

This is all for now, all feedback is appreciated.

Download
Mirror
Version: 1.0.1
TAPI Version: r15

Last Updated: Jun 11 2015 (GMT)
Consider using the main download link, aka adfly. It provides us programmers with an extremely minimal source of income along with a way of easily keeping track of downloads. We spend our time on free contents, we are not entitled to anybody's gratitude, but be ensured every modder who makes use of adfly links will be grateful for your support if you decide to get through its minimal 5 seconds wait in exchange of hours spent by our hands on such mods.

Changelogs
1.0.1

------------------------------------

Credits
@darthmorf - Thirst bar icons
@Zoodletec - Hunger bar icons

------------------------------------

W1K's main thread of swaggities and mods. Mainly mods.
 
Last edited:
A possible heat system, huh? That would be interesting and original to see in a mod. I've got a few quite a lot of ideas for that...

Players would have a heat meter, represented by a single icon, displaying values ranging from 0 to 100:
Heat Bar.png
Temperature icons far left, middle, and far right, with gradual change in between.
- The player's temperature will approach a temp of 50 at a rate of 1 every 10 seconds. (The player's natural temp control, or "NTC")
- While running around or using Melee items, temp increases 1 every 6 seconds (1/15 seconds against NTC)

Effects:
- When temp > 70 or temp < 30, heat meter begins to flash in warning.
- When temp > 80, the player suffers from perpetual On Fire debuff.
- When temp > 90, the player suffers from perpetual Burning.
- When temp reaches 100, the player incinerates, dying instantly (if they hadn't died already).
- When temp < 20, the player suffers from perpetual Chilled debuff.
- When temp < 10, the player suffers random attacks from the Frozen debuff.
- When temp reaches 0, the player freezes to death.

Environment:
- Environmental temperature effects do not stack. None apply while in a valid housing location.
- At night or underground, temp decreases 1 every 6 seconds (1/15 seconds against NTC)
-- Remaining active causes NTC to act normally (because the temp effects cancel).
- When in a surface Desert during the day, temp decreases 1 every 5 seconds (1/10 seconds against NTC)
- While in the Snow biome, temp decreases 1 every 4 seconds (1/6.7 seconds against NTC)
- Being submerged in water in the Underground Snow biome causes temp to decrease 2 every second.
- While in the Underworld, temp increases 1 every 2 seconds (1/2.5 seconds against NTC)

Hazards:
- Cold attacks no longer inflict Frozen or Chilled, and instead cause the player's temp to decrease by 2.
- Unless the player's temp exceeds 80, the On Fire debuff causes temp to increase 1 every second.
- Touching burning blocks inflicts On Fire instead of the Burning debuff, and causes temp to increase 4 every second.
- Taking damage from Lava immediately increases temperature by 10 in addition to inflicting On Fire.

Prevention:
- Standing by a Camp Fire causes temperature to increase up to 50 temp 1 every 2 seconds.
- Drinking Cold Water reduces the player's temp by 10 when above 55 and by 5 when below.
-- Cold Bottled Water can be crafted from Bottled Water and Ice.
-- 10 second cooldown between uses.
- Drinking Hot Water increases the player's temp by 10 when below 45 and by 5 when above.
-- Hot Bottled Water can be crafted from Bottled Water at a Furnace, Camp Fire, etc.
-- 10 second cooldwon between uses.
- Warmth Buff grants the player 50% resistance to decreasing temp when below 50, along with the usual reduced damage.
-- Eskimo Set would provide the Warmth Buff as a set bonus.
- Obsidian Skin Buff grants the player 50% resistance to increasing temp when above 50, along with the usual immunity to Lava.
- Obsidian Skull grants the player 25% resistance to increasing temp when above 50, along with the usual fire block immunity.
 
Last edited:
A possible heat system, huh? That would be interesting and original to see in a mod. I've got a few quite a lot of ideas for that...

Players would have a heat meter, represented by a single icon, displaying values ranging from 0 to 100:
View attachment 52230 Temperature icons far left, middle, and right, with gradual change in between.
- The player's temperature will approach a temp of 50 at a rate of 1 every 10 seconds. (The player's natural temp control, or "NTC")
- While running around or using Melee items, temp increases 1 every 6 seconds (1/15 seconds against NTC)

Effects:
- When temp > 70 or temp < 30, heat meter begins to flash in warning.
- When temp > 80, the player suffers from perpetual On Fire debuff.
- When temp > 90, the player suffers from perpetual Burning.
- When temp reaches 100, the player incinerates, dying instantly (if they hadn't died already).
- When temp < 20, the player suffers from perpetual Chilled debuff.
- When temp < 10, the player suffers random attacks from the Frozen debuff.
- When temp reaches 0, the player freezes to death.

Environment:
- Environmental temperature effects do not stack. None apply while in a valid housing location.
- At night or underground, temp decreases 1 every 6 seconds (1/15 seconds against NTC)
-- Remaining active causes NTC to act normally (because the temp effects cancel).
- When in a surface Desert during the day, temp decreases 1 every 5 seconds (1/10 seconds against NTC)
- While in the Snow biome, temp decreases 1 every 4 seconds (1/6.7 seconds against NTC)
- While in the Underworld, temp increases 1 every 2 seconds (1/2.5 seconds against NTC)

Hazards:
- Cold attacks no longer inflict Frozen or Chilled, and instead cause the player's temp to decrease by 2.
- Being submerged in water in the Underground Snow biome causes temp to decrease 2 every second.
- Unless the player's temp exceeds 80, the On Fire debuff causes temp to increase 2 every second.
- Touching burning blocks inflicts On Fire instead of the Burning debuff, and causes temp to increase 4 every second.
- Taking damage from Lava immediately increases temperature by 10 in addition to inflicting On Fire.

Prevention:
- Standing by a Camp Fire causes temperature to increase up to 50 temp 1 every 2 seconds.
- Warmth Buff grants the player 50% resistance to decreasing temp when below 50, along with the usual reduced damage.
- Obsidian Skin Buff grants the player 50% resistance to increasing temp when above 50, along with the usual immunity to Lava.
Suggestion sounds alright and solid. I might implement it eventually following this as a guideline. I also like the sprites, which I'll most likely use if you don't mind.

Right now, I think my priority will be thirst. For once, I think it is a more relevant prime need compared to temp (temperature can essentially never be a problem under normal climatic conditions). I just need to think of a legit and valid way of making it both a challenge and not an annoyance. Chance is I'll have to make natural water "contaminated", while giving the player a way of purifying it (such as boiling it, or something of the sort, for once crafting "purified" water out of furnaces sounds like an idea), possibly even warming or cooling it, which can potentially give us more options for the upcoming temp system.
On a side note, temp might also affect thirst, as extreme tempertures tend to increase the rate of thirst.

Overall I still got lots of things to think about, any sort of feedback or suggestion is well accepted.
 
Suggestion sounds alright and solid. I might implement it eventually following this as a guideline. I also like the sprites, which I'll most likely use if you don't mind.
I'll be updating that post as I think of more things or realize possible issues. And I wouldn't want the sprites wasted. :p
Right now, I think my priority will be thirst. For once, I think it is a more relevant prime need compared to temp (temperature can essentially never be a problem under normal climatic conditions). I just need to think of a legit and valid way of making it both a challenge and not an annoyance. Chance is I'll have to make natural water "contaminated", while giving the player a way of purifying it (such as boiling it, or something of the sort, for once crafting "purified" water out of furnaces sounds like an idea), possibly even warming or cooling it, which can potentially give us more options for the upcoming temp system.
On a side note, temp might also affect thirst, as extreme tempertures tend to increase the rate of thirst.
Maybe unclean water could activate a Sickness debuff which prevents consuming items, possibly with an additional chance to Poison the drinker?

Anyways, adding Hot and Cold Bottled Water to the temp post, along with a few other possible changes.
 
Last edited:
Maybe unclean water could activate a Sickness debuff which prevents consuming items, possibly with an additional chance to Poison the drinker?
I was thinking of making it an hookin for diseases, however, I can't exactly make diseases mere debuffs as they could easily fill up the buffs array. I need to work something different for em, in the meanwhile, I was thinking I could simply give them a chance to give you a really long poisoned debuff, maybe also have reduced effectiveness as otherwise one could simply equip a Bezoar without bothering to purify (but that means you wouldn't gain the benefit for it being warmth water, which is already a penalty per-se, which makes me unsure about it).
 
Big fan of your difficulty mod went ahead and threw this Primary Needs on cause i feel hunger should be in the game.

However, upon using an item (left click for weapon swing or any action aside from moving that would cause hunger points to be used) tAPI crashes

The following error message is provided:

System.NullReferenceException: Object reference not set to an instance of an object.
at W1KMMPN.MItem.UseItem(Terraria.Player player)
at TAPI.Hooks.CallConditional( ts, a)
at TAPI.CodableItem.UseItem(Terraria.Player player)
at Terraria.Player.ItemCheckReal(System.Int32 i)
at Terraria.Player.ItemCheck(System.Int32 i)
at Terraria.Player.UpdatePlayer(System.Int32 i)
at Terraria.Main.UpdateReal(Microsoft.Xna.Framework.GameTime gameTime)

Is this error something on my clients end or something else?
 
Big fan of your difficulty mod went ahead and threw this Primary Needs on cause i feel hunger should be in the game.

However, upon using an item (left click for weapon swing or any action aside from moving that would cause hunger points to be used) tAPI crashes

The following error message is provided:

System.NullReferenceException: Object reference not set to an instance of an object.
at W1KMMPN.MItem.UseItem(Terraria.Player player)
at TAPI.Hooks.CallConditional( ts, a)
at TAPI.CodableItem.UseItem(Terraria.Player player)
at Terraria.Player.ItemCheckReal(System.Int32 i)
at Terraria.Player.ItemCheck(System.Int32 i)
at Terraria.Player.UpdatePlayer(System.Int32 i)
at Terraria.Main.UpdateReal(Microsoft.Xna.Framework.GameTime gameTime)

Is this error something on my clients end or something else?
Been trying to replicate and have not been successful so far. Swinging weapons does not actually consume hunger, only moving does. What other mods do you have loaded?

EDIT: I might have found the issue. Working my way thro a fix.

EDIT2: Sorry for the bump and potential extra alert, but I uploaded a fixed version. The bug seemed to be fairly major (and today I learned I really need to test stuffs without any other mod loaded before uploading).
 
Been trying to replicate and have not been successful so far. Swinging weapons does not actually consume hunger, only moving does. What other mods do you have loaded?

EDIT: I might have found the issue. Working my way thro a fix.

EDIT2: Sorry for the bump and potential extra alert, but I uploaded a fixed version. The bug seemed to be fairly major (and today I learned I really need to test stuffs without any other mod loaded before uploading).

Tested with fixed version. Working like a charm. Let's just go ahead and say you're amazing ;)

I really appreciate the fast response and fix, I'm sure I'll love the extra little elements this mod will bring to the game in the future. Really looking forward to Thirst!
 
  • Like
Reactions: W1K
So, who feels the mighty need of spriting me a 14x18 water drop and a half water drop sprite for the thirst bar?
 
For "half" I mean an icon which would represent an half-depleted icon on the bar. Example
55d8f07cc5.png

I'm using a cyan hue'd apple icon for now.
ah, ok then. Would teh second work for that? Or would you prefer something else?
 
Back
Top Bottom