diff --git a/media/lua/client/DogFoodIsntThatBad.lua b/media/lua/client/DogFoodIsntThatBad.lua index 59ca482..5912e79 100644 --- a/media/lua/client/DogFoodIsntThatBad.lua +++ b/media/lua/client/DogFoodIsntThatBad.lua @@ -1,39 +1,177 @@ -local base_perform = ISEatFoodAction.perform +local function adjustFoodNotPicky(item) + print("adjust not picky") -function ISEatFoodAction:perform() - if getPlayer():getTraits():contains("NotAPickyEater") then - self.item:setUnhappyChange(math.min(self.item:getUnhappyChange(), 0)) - self.item:setBoredomChange(math.min(self.item:getBoredomChange(), 0)) - print("NotAPickyEater trait active, removing negative effects from food") -- DEBUG + item:setUnhappyChange(math.min(item:getUnhappyChange(), 0)) + item:setBoredomChange(math.min(item:getBoredomChange(), 0)) +end + +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 - 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 local base_tooltip_render = ISToolTipInv.render function ISToolTipInv:render() - local unhappyChange = self.item:getUnhappyChange() - local boredomChange = self.item:getBoredomChange() - if getPlayer():getTraits():contains("NotAPickyEater") then - self.item:setUnhappyChange(math.min(unhappyChange, 0)) - self.item:setBoredomChange(math.min(boredomChange, 0)) + local origUnhappyChange = self.item:getUnhappyChange() + local origBoredomChange = self.item:getBoredomChange() + + -- Adjust food effects based on traits + 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 + + -- Call original function base_tooltip_render(self) - if getPlayer():getTraits():contains("NotAPickyEater") then - self.item:setUnhappyChange(unhappyChange) - self.item:setBoredomChange(boredomChange) + + -- Reset food effects + 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 -local function initTraits() - TraitFactory.addTrait( - "NotAPickyEater", - getText("UI_trait_NotAPickyEater"), - -1, - getText("UI_trait_NotAPickyEater_description"), - false, - false - ) -end + -- Call original function + base_perform(self) -Events.OnGameBoot.Add(initTraits) + -- Reset food effects + self.item:setUnhappyChange(origUnhappyChange) + self.item:setBoredomChange(origBoredomChange) +end diff --git a/media/lua/shared/DogFoodIsntThatBad.lua b/media/lua/shared/DogFoodIsntThatBad.lua new file mode 100644 index 0000000..4c5c6f8 --- /dev/null +++ b/media/lua/shared/DogFoodIsntThatBad.lua @@ -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) diff --git a/media/lua/shared/Translate/EN/UI_EN.txt b/media/lua/shared/Translate/EN/UI_EN.txt index 3edafe1..941797c 100644 --- a/media/lua/shared/Translate/EN/UI_EN.txt +++ b/media/lua/shared/Translate/EN/UI_EN.txt @@ -1,4 +1,6 @@ UI_EN = { 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.", } diff --git a/media/ui/Traits/trait_NotAPickyEater.png b/media/ui/Traits/trait_NotAPickyEater.png new file mode 100644 index 0000000..8fe29e9 Binary files /dev/null and b/media/ui/Traits/trait_NotAPickyEater.png differ diff --git a/media/ui/Traits/trait_RefinedPalate.png b/media/ui/Traits/trait_RefinedPalate.png new file mode 100644 index 0000000..96b7b61 Binary files /dev/null and b/media/ui/Traits/trait_RefinedPalate.png differ