Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Meat Bits dependent on meat Calories #36

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Contents/mods/DefsLTS/media/lua/server/HandlerRecipeReturns.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,17 @@ function giveMaintenanceTools(items, result, player)
player:getInventory():AddItem("Base.Wrench");
end

function GiveMeatBits (items,result,player)
local meat = nil;
for i=0,items:size() - 1 do
if instanceof(items:get(i), "Food") then
meat = items:get(i);
break;
end
end
print("calories:"..meat:getCalories());
local meatBits = math.floor(meat:getCalories()/27)
for i=1,meatBits - 1 do
player:getInventory():AddItem("DLTS.LTSBitsMeat");
end
end
19 changes: 5 additions & 14 deletions Contents/mods/DefsLTS/media/scripts/LTSRecipesFood.txt
Original file line number Diff line number Diff line change
Expand Up @@ -280,21 +280,12 @@ module DLTS {

/** ------------------------------------------------------------------------- **/
/** Preparing Bits from Food Items **/

recipe LTS Cut Bits of Meat {
keep HuntingKnife/KitchenKnife/BreadKnife/MeatCleaver/Machete/FlintKnife,
MuttonChop/PorkChop/Steak/Rabbitmeat/Salmon/FishFillet,
Result:LTSBitsMeat=7,
Sound:PZ_FoodSlicing,
Time:40.0,
Category:LTS-Food,
OnGiveXP:CraftXP_FoodBase,
}


recipe LTS Cut Bits of Meat {
keep HuntingKnife/KitchenKnife/BreadKnife/MeatCleaver/Machete/FlintKnife,
Smallanimalmeat/Smallbirdmeat,
Result:LTSBitsMeat=3,
keep [Recipe.GetItemTypes.SharpKnife]/MeatCleaver/Machete,
MuttonChop/PorkChop/Steak/Rabbitmeat/Salmon/FishFillet/Smallanimalmeat/Smallbirdmeat,
Result:LTSBitsMeat=1,
OnCreate:GiveMeatBits,
Sound:PZ_FoodSlicing,
Time:40.0,
Category:LTS-Food,
Expand Down