Dont starve mods

This commit is contained in:
Santje Finke 2023-06-18 12:44:26 +02:00
commit 0ffb58a890
2 changed files with 383 additions and 0 deletions

218
Dominik/modinfo.lua Normal file
View file

@ -0,0 +1,218 @@
-- This information tells other players more about the mod
name = "Dominik"
description = "Changes for Shira and eNBeWe"
author = "Shira"
version = "0.1"
-- icon_atlas = "spoilageChangesIconAtlas.xml"
-- icon = "spoilageChangesIcon.tex"
forumthread = ""
-- This lets other players know if your mod is out of date, update it to match the current version in the game
api_version_dst = 10
priority = 0
-- Only compatible with DST
dont_starve_compatible = false
reign_of_giants_compatible = false
shipwrecked_compatible = false
dst_compatible = true
--This lets clients know if they need to get the mod from the Steam Workshop to join the game
all_clients_require_mod = false
--This determines whether it causes a server to be marked as modded (and shows in the mod list)
client_only_mod = false
-- https://steamcommunity.com/sharedfiles/filedetails/?id=2191732916 Spoilage Tweaks: Seeds by TequilaSeLai
-- https://steamcommunity.com/sharedfiles/filedetails/?id=1578269972 Spoilage Tweaks: Jerky by TequilaSeLai
-- https://steamcommunity.com/sharedfiles/filedetails/?id=2559921206 Spoilage Tweaks: Honey by TequilaSeLai
-- https://steamcommunity.com/sharedfiles/filedetails/?id=399726269 Seed Balance by Hiddigeigei
-- https://steamcommunity.com/sharedfiles/filedetails/?id=2915069324 Player Damage Taken Modifier by Swaggy
-- fireproof structures 1842845837
configuration_options =
{
{
name = "honey_spoilage",
label = "Honey spoilage",
hover = "Set the spoilage rate of honey",
options = {
{description = "Default DST rate", data = -1, hover = "mod disabled"},
{description = "Realistic", data = 0, hover = "Honey lasts forever."},
},
default = 0,
},
{
name = "meat_dried_spoilage",
label = "Jerky spoilage",
hover = "Set the spoilage rate for jerky",
options = {
{description = "Normal DST rate", data = -1, hover = "mod disabled (Base 20 days)"},
{description = "Year", data = 0, hover = "Jerky takes 81 days to spoil"},
{description = "None", data = 1, hover = "Jerky lasts forever."},
},
default = 0,
},
{
name = "smallmeat_dried_spoilage",
label = "Small jerky spoilage",
hover = "Set the spoilage rate for small jerky",
options = {
{description = "Normal DST rate", data = -1, hover = "mod disabled (Base 20 days)"},
{description = "Year", data = 0, hover = "Jerky takes 81 days to spoil"},
{description = "none", data = 1, hover = "Jerky lasts forever."},
},
default = 0,
},
{
name = "monstermeat_dried_spoilage",
label = "Monster jerky spoilage",
hover = "Set the spoilage rate for monster jerky",
options = {
{description = "Normal DST rate", data = -1, hover = "The usual spoilage rate. (Base 20 days)"},
{description = "Year", data = 0, hover = "Jerky takes 81 days to spoil"},
{description = "None", data = 1, hover = "Jerky lasts forever."},
},
default = 0,
},
{
name = "kelp_dried_spoilage",
label = "Dried kelp spoilage",
hover = "Set the spoilage rate for dried kelp",
options = {
{description = "Normal DST rate", data = -1, hover = "The usual spoilage rate. (Base 20 days)"},
{description = "Year", data = 0, hover = "Jerky takes 81 days to spoil"},
{description = "None", data = 1, hover = "Jerky lasts forever."},
},
default = 0,
},
{
name = "seed_spoilage",
label = "Seed spoilage",
hover = "Set the spoilage rate for regular seeds.",
options = {
{description = "Normal DST rate", data = -1, hover = "mod disabled (Base 40 days)"},
{description = "None", data = 0, hover = "Seeds last forever."},
},
default = 0,
},
{
name = "crop_seed_spoilage",
label = "Crop seed spoilage",
hover = "Set the spoilage rate for crop seeds.",
options = {
{description = "Normal DST rate", data = -1, hover = "mod disabled (Base 40 days)"},
{description = "None", data = 0, hover = "Crop seeds last forever."},
},
default = 0,
},
{
name = "birchnut_spoilage",
label = "Birchnut spoilage",
hover = "Set the spoilage rate for uncooked birchnuts.",
options = {
{description = "Normal DST rate", data = -1, hover = "mod disabled (Base 20 days)"},
{description = "None", data = 0, hover = "Birchnuts last forever."},
},
default = 0,
},
{
name = "trailmix_spoilage",
label = "Trailmix spoilage",
hover = "Set the spoilage rate for trailmix",
options = {
{description = "Normal DST rate", data = -1, hover = "mod disabled (Base 15 days)"},
{description = "Year", data = 0, hover = "Trailmix takes 81 days to spoil"},
{description = "none", data = 1, hover = "Trailmix lasts forever."},
},
default = 0,
},
{
name = "jammypreserves_spoilage",
label = "Jam spoilage",
hover = "Set the spoilage rate for fist full of jam",
options = {
{description = "Normal DST rate", data = -1, hover = "mod disabled (Base 15 days)"},
{description = "Year", data = 0, hover = "Jam takes 81 days to spoil"},
{description = "none", data = 1, hover = "Jam lasts forever."},
},
default = 0,
},
{
name = "garlic_spoilage",
label = "Garlic spoilage",
hover = "Set the spoilage rate for garlic",
options = {
{description = "Normal DST rate", data = -1, hover = "mod disabled (Base 15 days)"},
{description = "Half-Year", data = 0, hover = "Garlic takes 40 days to spoil"},
{description = "none", data = 1, hover = "Garlic lasts forever."},
},
default = 0,
},
{
name = "onion_spoilage",
label = "Onion spoilage",
hover = "Set the spoilage rate for onions",
options = {
{description = "Normal DST rate", data = -1, hover = "mod disabled (Base 15 days)"},
{description = "Half-Year", data = 0, hover = "Onion takes 40 days to spoil"},
{description = "none", data = 1, hover = "Onion lasts forever."},
},
default = 0,
},
{
name = "taffy_spoilage",
label = "Taffy spoilage",
hover = "Set the spoilage rate for taffy",
options = {
{description = "Normal DST rate", data = -1, hover = "mod disabled (Base 15 days)"},
{description = "Year", data = 0, hover = "Taffy takes 81 days to spoil"},
{description = "none", data = 1, hover = "Taffy lasts forever."},
},
default = 0,
},
-- ice 3 days default
-- seeds_cooked 10 days default
-- acorn_cooked 6 days default
-- icecream 3 days default
-- watermelonicle 3 days default
-- pumpkincookie 10 days default
{
name = "min_bird_seeds",
label = "Min. fruit seeds",
options =
{
{description = "default (1)", data = 1},
{description = "modded (2)", data = 2},
},
default = 2,
},
{
name = "max_bird_seeds",
label = "Max. fruit seeds",
options =
{
{description = "default (2)", data = 1},
{description = "modded (3)", data = 2},
},
default = 2,
},
{
name = "pc_dmg_taken_mod",
label = "Player damage taken modifier",
hover = "Choose multiplier to damage. 1 is standard",
options = {
{description = 0.25, data = 0.25},
{description = 0.5, data = 0.5},
{description = 0.75, data = 0.75},
{description = 1.0, data = 1.0},
},
default = 0.5
}
}

165
Dominik/modmain.lua Normal file
View file

@ -0,0 +1,165 @@
-- seg_time = 30
-- total_day_time = seg_time*16
-- PERISH_FRESH = 0.5,
-- PERISH_STALE = 0.2,
-- local perish_warp = 1--/200
-- PERISH_ONE_DAY = 1*total_day_time*perish_warp,
-- PERISH_TWO_DAY = 2*total_day_time*perish_warp,
-- PERISH_SUPERFAST = 3*total_day_time*perish_warp,
-- PERISH_FAST = 6*total_day_time*perish_warp,
-- PERISH_FASTISH = 8*total_day_time*perish_warp,
-- PERISH_MED = 10*total_day_time*perish_warp,
-- PERISH_SLOW = 15*total_day_time*perish_warp,
-- PERISH_PRESERVED = 20*total_day_time*perish_warp,
-- PERISH_SUPERSLOW = 40*total_day_time*perish_warp,
-- long spring (31), short summer (+10 = 41), long autumn (+30 = 71), short winter (+10 = 81)
local PERISH_YEAR = 81*GLOBAL.TUNING.TOTAL_DAY_TIME --*perish_warp
local honey_spoilage = GetModConfigData("honey_spoilage")
local meat_dried_spoilage = GetModConfigData("meat_dried_spoilage")
local smallmeat_dried_spoilage = GetModConfigData("smallmeat_dried_spoilage")
local monstermeat_dried_spoilage = GetModConfigData("monstermeat_dried_spoilage")
local kelp_dried_spoilage = GetModConfigData("kelp_dried_spoilage")
local seed_spoilage = GetModConfigData("seed_spoilage")
local crop_seed_adjustment = GetModConfigData("crop_seed_spoilage")
local birchnut_spoilage = GetModConfigData("birchnut_spoilage")
local cropseeds = {"carrot_seeds", "corn_seeds", "dragonfruit_seeds", "durian_seeds", "eggplant_seeds", "pomegranate_seeds", "pumpkin_seeds", "watermelon_seeds", "sweet_potato_seeds", "aloe_seeds", "asparagus_seeds", "radish_seeds", "tomato_seeds", "potato_seeds", "onion_seeds", "pepper_seeds", "garlic_seeds", "pineananas_seeds", }
local trailmix_spoilage = GetModConfigData("trailmix_spoilage")
local jammypreserves_spoilage = GetModConfigData("jammypreserves_spoilage")
local garlic_spoilage = GetModConfigData("garlic_spoilage")
local onion_spoilage = GetModConfigData("onion_spoilage")
local taffy_spoilage = GetModConfigData("taffy_spoilage")
function noSpoil(inst)
if inst.components.perishable then
inst:RemoveComponent("perishable")
end
end
function yearSpoil(inst)
if inst.components.perishable then
inst.components.perishable.perishtime = PERISH_YEAR*2 -- 1 year fresh, 1 year stale/spoiled
inst.components.perishable:SetPercent(1)
end
end
function halfYearSpoil(inst)
if inst.components.perishable then
inst.components.perishable.perishtime = PERISH_YEAR -- half a year fresh, half a year stale/spoiled
inst.components.perishable:SetPercent(1)
end
end
if honey_spoilage == 0 then AddPrefabPostInit("honey",noSpoil)
end
if meat_dried_spoilage == 0 then AddPrefabPostInit("meat_dried",yearSpoil)
elseif meat_dried_spoilage == 1 then AddPrefabPostInit("meat_dried",noSpoil)
end
if smallmeat_dried_spoilage == 0 then AddPrefabPostInit("smallmeat_dried",yearSpoil)
elseif smallmeat_dried_spoilage == 1 then AddPrefabPostInit("smallmeat_dried",noSpoil)
end
if monstermeat_dried_spoilage == 0 then AddPrefabPostInit("monstermeat_dried",yearSpoil)
elseif monstermeat_dried_spoilage == 1 then AddPrefabPostInit("monstermeat_dried",noSpoil)
end
if kelp_dried_spoilage == 0 then AddPrefabPostInit("kelp_dried",yearSpoil)
elseif kelp_dried_spoilage == 1 then AddPrefabPostInit("kelp_dried",noSpoil)
end
if seed_spoilage == 0 then AddPrefabPostInit("seeds",noSpoil)
end
for key, value in pairs(cropseeds) do
if crop_seed_spoilage == 0 then AddPrefabPostInit(value,noSpoil)
end
end
if birchnut_spoilage == 0 then AddPrefabPostInit("acorn",noSpoil)
end
if trailmix_spoilage == 0 then AddPrefabPostInit("trailmix",yearSpoil)
elseif trailmix_spoilage == 1 then AddPrefabPostInit("trailmix",noSpoil)
end
if jammypreserves_spoilage == 0 then AddPrefabPostInit("jammypreserves",yearSpoil)
elseif jammypreserves_spoilage == 1 then AddPrefabPostInit("jammypreserves",noSpoil)
end
if garlic_spoilage == 0 then AddPrefabPostInit("garlic",halfYearSpoil)
elseif garlic_spoilage == 1 then AddPrefabPostInit("garlic",noSpoil)
end
if onion_spoilage == 0 then AddPrefabPostInit("onion",halfYearSpoil)
elseif onion_spoilage == 1 then AddPrefabPostInit("onion",noSpoil)
end
if taffy_spoilage == 0 then AddPrefabPostInit("taffy",yearSpoil)
elseif taffy_spoilage == 1 then AddPrefabPostInit("taffy",noSpoil)
end
--------- BIRD SEED CHANGES ---------
local SpawnPrefab = GLOBAL.SpawnPrefab
local Prefab = GLOBAL.Prefab
local Prefabs = GLOBAL.Prefabs
local FRAMES = GLOBAL.FRAMES
local FOODTYPE = GLOBAL.FOODTYPE
local minseeds = GetModConfigData("min_bird_seeds")
local maxseeds = GetModConfigData("max_bird_seeds")
local function OnDigestMOD(inst, item)
if item.components.edible.foodtype == FOODTYPE.MEAT then
inst.components.lootdropper:SpawnLootPrefab("bird_egg")
else
local seed_name = string.lower(item.prefab .. "_seeds")
if Prefabs[seed_name] ~= nil then
local num_seeds = math.random(minseeds, maxseeds)
for k = 1, num_seeds do
inst.components.lootdropper:SpawnLootPrefab(seed_name)
end
else
inst.components.lootdropper:SpawnLootPrefab("seeds")
end
end
end
local function OnGetItemFromPlayer(inst, giver, item)
if inst.components.sleeper and inst.components.sleeper:IsAsleep() then
inst.components.sleeper:WakeUp()
end
if item.components.edible ~= nil and
( item.components.edible.foodtype == FOODTYPE.MEAT or
item.prefab == "seeds" or
Prefabs[string.lower(item.prefab.."_seeds")] ~= nil
) then
inst.AnimState:PlayAnimation("peck")
inst.AnimState:PushAnimation("peck")
inst.AnimState:PushAnimation("peck")
inst.AnimState:PushAnimation("hop")
inst.AnimState:PushAnimation("idle_bird", true)
inst:DoTaskInTime(60 * FRAMES, OnDigestMOD, item)
end
end
local function modded_birdcage(inst)
if inst and inst.components.trader then
inst.components.trader.onaccept = OnGetItemFromPlayer
end
end
AddPrefabPostInit("birdcage", modded_birdcage)
---------------- Damage Modifier --------------
local pc_dmg_taken_mod = GetModConfigData("pc_dmg_taken_mod");
if (pc_dmg_taken_mod > 1.0) then
pc_dmg_taken_mod = 1.0-pc_dmg_taken_mod
end
GLOBAL.TUNING.PLAYER_DAMAGE_TAKEN_MOD = pc_dmg_taken_mod