Add "Refined Palate" trait
- Increase or decrease happiness for a variety of foods and food categories based on subjective quality when the Refined Palate trait is active. - Move the trait definition to the shared code. - Add icons for the "Refined Palate" and "Not a Picky Eater" traits.
This commit is contained in:
parent
da7344d749
commit
f981c23379
5 changed files with 189 additions and 28 deletions
|
|
@ -1,39 +1,177 @@
|
||||||
local base_perform = ISEatFoodAction.perform
|
local function adjustFoodNotPicky(item)
|
||||||
|
print("adjust not picky")
|
||||||
|
|
||||||
function ISEatFoodAction:perform()
|
item:setUnhappyChange(math.min(item:getUnhappyChange(), 0))
|
||||||
if getPlayer():getTraits():contains("NotAPickyEater") then
|
item:setBoredomChange(math.min(item:getBoredomChange(), 0))
|
||||||
self.item:setUnhappyChange(math.min(self.item:getUnhappyChange(), 0))
|
end
|
||||||
self.item:setBoredomChange(math.min(self.item:getBoredomChange(), 0))
|
|
||||||
print("NotAPickyEater trait active, removing negative effects from food") -- DEBUG
|
local function adjustFoodVeryPicky(item)
|
||||||
|
print("adjust very picky")
|
||||||
|
|
||||||
|
local unhappyChange = item:getUnhappyChange()
|
||||||
|
local boredomChange = item:getBoredomChange()
|
||||||
|
|
||||||
|
-- Microwaved food is gross
|
||||||
|
if item:isCookedInMicrowave() then
|
||||||
|
unhappyChange = unhappyChange + 5
|
||||||
|
boredomChange = boredomChange + 10
|
||||||
|
print("microwaved")
|
||||||
end
|
end
|
||||||
base_perform(self)
|
|
||||||
|
-- Canned food is gross
|
||||||
|
if string.match(item:getDisplayName(), "Canned ") then
|
||||||
|
unhappyChange = unhappyChange + 5
|
||||||
|
boredomChange = boredomChange + 10
|
||||||
|
print("canned")
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Dog food is very gross
|
||||||
|
if string.match(item:getDisplayName(), "Dog Food") then
|
||||||
|
unhappyChange = unhappyChange + 20
|
||||||
|
print("dog food")
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Tea Bag is very gross
|
||||||
|
if item:getDisplayName() == "Tea Bag" then
|
||||||
|
unhappyChange = unhappyChange + 20
|
||||||
|
print("tea bag")
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Dry Ramen Noodles are pretty gross
|
||||||
|
if item:getDisplayName() == "Dry Ramen Noodles" then
|
||||||
|
unhappyChange = unhappyChange + 10
|
||||||
|
boredomChange = boredomChange + 10
|
||||||
|
print("dry ramen")
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Pickled jars are a little gross
|
||||||
|
if string.match(item:getDisplayName(), "Jar of ") then
|
||||||
|
unhappyChange = unhappyChange + 10
|
||||||
|
boredomChange = boredomChange + 10
|
||||||
|
print("jar")
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Fried food is a little gross
|
||||||
|
if string.match(item:getDisplayName(), "Fried ") then
|
||||||
|
unhappyChange = unhappyChange + 10
|
||||||
|
boredomChange = boredomChange + 10
|
||||||
|
print("fried")
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Beer is a little gross
|
||||||
|
if item:getFoodType() == "Beer" then
|
||||||
|
unhappyChange = unhappyChange + 10
|
||||||
|
print("beer")
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Wine is very good
|
||||||
|
if item:getFoodType() == "Wine" then
|
||||||
|
unhappyChange = unhappyChange - 15
|
||||||
|
boredomChange = boredomChange - 5
|
||||||
|
print("wine")
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Vegetables are pretty good
|
||||||
|
if item:getFoodType() == "Vegetables" then
|
||||||
|
unhappyChange = unhappyChange - 5
|
||||||
|
boredomChange = boredomChange - 10
|
||||||
|
print("vegetables")
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Fruits are pretty good
|
||||||
|
if item:getFoodType() == "Fruits" then
|
||||||
|
unhappyChange = unhappyChange - 5
|
||||||
|
boredomChange = boredomChange - 10
|
||||||
|
print("fruits")
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Egg is pretty good
|
||||||
|
if item:getFoodType() == "Egg" then
|
||||||
|
unhappyChange = unhappyChange - 5
|
||||||
|
print("egg")
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Bread is pretty good
|
||||||
|
if item:getFoodType() == "Bread" then
|
||||||
|
unhappyChange = unhappyChange - 5
|
||||||
|
print("bread")
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Processed Cheese food is gross
|
||||||
|
if item:getDisplayName() == "Processed Cheese" then
|
||||||
|
unhappyChange = unhappyChange + 5
|
||||||
|
boredomChange = boredomChange + 10
|
||||||
|
print("processed cheese")
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Candy is a little gross
|
||||||
|
if item:getFoodType() == "Candy" then
|
||||||
|
unhappyChange = unhappyChange + 5
|
||||||
|
print("candy")
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Dead critters are extremely gross
|
||||||
|
if string.match(item:getDisplayName(), "Dead ") then
|
||||||
|
unhappyChange = unhappyChange + 40
|
||||||
|
print("dead")
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Increase negative effects by 50%
|
||||||
|
if unhappyChange > 0 then
|
||||||
|
unhappyChange = unhappyChange * 1.5
|
||||||
|
end
|
||||||
|
if boredomChange > 0 then
|
||||||
|
boredomChange = boredomChange * 1.5
|
||||||
|
end
|
||||||
|
|
||||||
|
item:setUnhappyChange(unhappyChange)
|
||||||
|
item:setBoredomChange(boredomChange)
|
||||||
end
|
end
|
||||||
|
|
||||||
local base_tooltip_render = ISToolTipInv.render
|
local base_tooltip_render = ISToolTipInv.render
|
||||||
|
|
||||||
function ISToolTipInv:render()
|
function ISToolTipInv:render()
|
||||||
local unhappyChange = self.item:getUnhappyChange()
|
local origUnhappyChange = self.item:getUnhappyChange()
|
||||||
local boredomChange = self.item:getBoredomChange()
|
local origBoredomChange = self.item:getBoredomChange()
|
||||||
if getPlayer():getTraits():contains("NotAPickyEater") then
|
|
||||||
self.item:setUnhappyChange(math.min(unhappyChange, 0))
|
-- Adjust food effects based on traits
|
||||||
self.item:setBoredomChange(math.min(boredomChange, 0))
|
if self.item:getType() == "Food" then
|
||||||
|
local traits = getPlayer():getTraits()
|
||||||
|
if traits:contains("NotAPickyEater") then
|
||||||
|
adjustFoodNotPicky(self.item)
|
||||||
|
elseif traits:contains("RefinedPalate") then
|
||||||
|
adjustFoodVeryPicky(self.item)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Call original function
|
||||||
base_tooltip_render(self)
|
base_tooltip_render(self)
|
||||||
if getPlayer():getTraits():contains("NotAPickyEater") then
|
|
||||||
self.item:setUnhappyChange(unhappyChange)
|
-- Reset food effects
|
||||||
self.item:setBoredomChange(boredomChange)
|
self.item:setUnhappyChange(origUnhappyChange)
|
||||||
|
self.item:setBoredomChange(origBoredomChange)
|
||||||
|
end
|
||||||
|
|
||||||
|
local base_perform = ISEatFoodAction.perform
|
||||||
|
|
||||||
|
function ISEatFoodAction:perform()
|
||||||
|
local origUnhappyChange = self.item:getUnhappyChange()
|
||||||
|
local origBoredomChange = self.item:getBoredomChange()
|
||||||
|
|
||||||
|
-- Adjust food effects based on traits
|
||||||
|
local traits = getPlayer():getTraits()
|
||||||
|
if traits:contains("NotAPickyEater") then
|
||||||
|
adjustFoodNotPicky(self.item)
|
||||||
|
print("negated negative emotional effects")
|
||||||
|
elseif traits:contains("RefiendPalate") then
|
||||||
|
adjustFoodVeryPicky(self.item)
|
||||||
|
print("amplified negative emotional effects")
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
local function initTraits()
|
-- Call original function
|
||||||
TraitFactory.addTrait(
|
base_perform(self)
|
||||||
"NotAPickyEater",
|
|
||||||
getText("UI_trait_NotAPickyEater"),
|
|
||||||
-1,
|
|
||||||
getText("UI_trait_NotAPickyEater_description"),
|
|
||||||
false,
|
|
||||||
false
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
Events.OnGameBoot.Add(initTraits)
|
-- Reset food effects
|
||||||
|
self.item:setUnhappyChange(origUnhappyChange)
|
||||||
|
self.item:setBoredomChange(origBoredomChange)
|
||||||
|
end
|
||||||
|
|
|
||||||
21
media/lua/shared/DogFoodIsntThatBad.lua
Normal file
21
media/lua/shared/DogFoodIsntThatBad.lua
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
local function initTraits()
|
||||||
|
TraitFactory.addTrait(
|
||||||
|
"NotAPickyEater",
|
||||||
|
getText("UI_trait_NotAPickyEater"),
|
||||||
|
1,
|
||||||
|
getText("UI_trait_NotAPickyEaterdesc"),
|
||||||
|
false,
|
||||||
|
false
|
||||||
|
)
|
||||||
|
TraitFactory.addTrait(
|
||||||
|
"RefinedPalate",
|
||||||
|
getText("UI_trait_RefinedPalate"),
|
||||||
|
-2,
|
||||||
|
getText("UI_trait_RefinedPalatedesc"),
|
||||||
|
false,
|
||||||
|
false
|
||||||
|
)
|
||||||
|
TraitFactory.setMutualExclusive("NotAPickyEater", "RefinedPalate")
|
||||||
|
end
|
||||||
|
|
||||||
|
Events.OnGameBoot.Add(initTraits)
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
UI_EN = {
|
UI_EN = {
|
||||||
UI_trait_NotAPickyEater = "Not a Picky Eater",
|
UI_trait_NotAPickyEater = "Not a Picky Eater",
|
||||||
UI_trait_NotAPickyEater_description = "No foods make you unhappy or bored.",
|
UI_trait_NotAPickyEaterdesc = "Foods never increases unhappiness or boredom.",
|
||||||
|
UI_trait_RefinedPalate = "Refined Palate",
|
||||||
|
UI_trait_RefinedPalatedesc = "Many additional low quality foods increase unhappiness and boredom.",
|
||||||
}
|
}
|
||||||
|
|
|
||||||
BIN
media/ui/Traits/trait_NotAPickyEater.png
Normal file
BIN
media/ui/Traits/trait_NotAPickyEater.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2 KiB |
BIN
media/ui/Traits/trait_RefinedPalate.png
Normal file
BIN
media/ui/Traits/trait_RefinedPalate.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
Loading…
Add table
Add a link
Reference in a new issue