Skip to content

Commit

Permalink
Merge pull request #140 from gamrguy/food_rework
Browse files Browse the repository at this point in the history
Novakid fix'n
  • Loading branch information
sayterdarkwynd authored Feb 11, 2019
2 parents e94b9ba + acff93b commit ed156db
Show file tree
Hide file tree
Showing 6 changed files with 196 additions and 299 deletions.
39 changes: 20 additions & 19 deletions items/generic/meat/alienmeat.consumable.patch
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
[
{ "op":"replace",
"path":"/effects",
"value": [ ]
},

{ "op":"add",
"path":"/effects/-",
"value": [ { "effect" : "carnivorefood" } ]
},
{
"op": "replace",
"path": "/foodValue",
"value": 20
},
{
"op": "replace",
"path": "/description",
"value": "A raw slab of weird, stringy alien meat. Maybe I should cook it. ^red;Type: Raw Meat^reset;"
}
{
"op":"replace",
"path":"/effects",
"value": [ ]
},
{
"op":"add",
"path":"/effects/-",
"value": [ { "effect" : "carnivorefood" } ]
},
{
"op": "replace",
"path": "/foodValue",
"value": 20
},
{
"op": "replace",
"path": "/description",
"value": "A raw slab of weird, stringy alien meat. Maybe I should cook it. ^red;Type: Raw Meat^reset;"
}
]
63 changes: 63 additions & 0 deletions scripts/fr_scripts/novakidStuff.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
--[[
Provides a variety of effects designed for use by the Novakid race.
Arguments:
"args" : {
"daytimeConfig" : {
"stats" : [ -- Applied during the day
{ "stat" : "energyRegenPercentageRate", "baseMultiplier" : 1.20 },
...
],
"hungerRegen" : 0.008, -- Hunger% gained/s during the day
"hungerThreshold" : 0.40, -- Hunger% required for regen to start
"maxHunger" : 0.85, -- Maximum hunger level for regen (stops increasing here, keeps regenning above this)
"minHunger" : 0.50, -- Minimum hunger level for regen (starts here, no regen below this)
"maxRegen" : 0.015, -- Regen/s at maximum hunger level
"minRegen" : 0.010, -- Regen/s at minimum hunger level
},
"nightConfig" : {
"stats" : [ -- Applied at night
{ "stat" : "maxEnergy", "baseMultiplier" : 0.75 },
...
],
"hungerThreshold" : 0.5, -- Hunger% at which regeneration is allowed at night
"hungerLoss" : -0.0005, -- Hunger%/s lost at night
"regen" : 0.010 -- Health%/s gained at night
}
}
]]

function FRHelper:call(args, main, dt, ...)
local hungerEnabled = status.isResource("food")
local hungerPerc = 0
if hungerEnabled then
hungerPerc = status.resourcePercentage("food")
else
hungerPerc = 0.85
end

local daytime = world.timeOfDay() < 0.5

-- Night penalties
if not daytime then
local nightConfig = args.nightConfig
self:applyStats(nightConfig, "FR_novakidNight", main, dt, ...)
if hungerPerc > nightConfig.hungerThreshold then
if hungerEnabled then
status.modifyResourcePercentage("food", nightConfig.hungerLoss * dt)
end
status.modifyResourcePercentage("health", nightConfig.regen * dt)
end
else
-- Daytime Abilities
local dayConfig = args.daytimeConfig
self:applyStats(dayConfig, "FR_novakidDaytime", main, dt, ...)

local hungerCalc = math.min(1, (hungerPerc - dayConfig.minHunger) / (dayConfig.maxHunger - dayConfig.minHunger))
local regenCalc = (dayConfig.maxRegen - dayConfig.minRegen) * hungerCalc + dayConfig.minRegen

if hungerPerc >= dayConfig.minHunger then
status.modifyResourcePercentage("health", regenCalc * dt)
end
end
end
223 changes: 83 additions & 140 deletions species/novakid.raceeffect
Original file line number Diff line number Diff line change
@@ -1,169 +1,112 @@
{
"stats": [{
"stat": "isOmnivore",
"amount": 1
},
{
"stat": "maxHealth",
"baseMultiplier": 0.9
},
{
"stat": "maxEnergy",
"baseMultiplier": 1.2
},
{
"stat": "physicalResistance",
"amount": -0.15
},
{
"stat": "electricResistance",
"amount": -0.2
},
{
"stat": "fireResistance",
"amount": 0.25
},
{
"stat": "iceResistance",
"amount": 0.2
},
{
"stat": "shadowResistance",
"amount": -0.4
},
{
"stat": "radioactiveResistance",
"amount": 0.4
},
{
"stat": "grit",
"amount": 0.2
},
{
"stat": "fireStatusImmunity",
"amount": 1
},
{
"stat": "radiationburnImmunity",
"amount": 1
}
"stats": [
{ "stat": "isOmnivore", "amount": 1 },
{ "stat": "maxHealth", "baseMultiplier": 0.9 },
{ "stat": "maxEnergy", "baseMultiplier": 1.2 },
{ "stat": "physicalResistance", "amount": -0.15 },
{ "stat": "electricResistance", "amount": -0.2 },
{ "stat": "fireResistance", "amount": 0.25 },
{ "stat": "iceResistance", "amount": 0.2 },
{ "stat": "shadowResistance", "amount": -0.4 },
{ "stat": "radioactiveResistance", "amount": 0.4 },
{ "stat": "grit", "amount": 0.2 },
{ "stat": "fireStatusImmunity", "amount": 1 },
{ "stat": "radiationburnImmunity", "amount": 1 }
],
"controlModifiers": {
"speedModifier": 1.05
},
"envEffects": [{
"biomes": [
"alien",
"jungle",
"irradiated",
"chromatic"
],
"stats": [{
"stat": "maxHealth",
"baseMultiplier": 1.15
},
{
"stat": "maxEnergy",
"baseMultiplier": 1.15
}
]
}],
"weaponEffects": [{
"weapons": [
"pistol"
],
"stats": [{
"stat": "powerMultiplier",
"amount": 0.09
}]
"envEffects": [
{
"biomes": [ "alien", "jungle", "irradiated", "chromatic" ],
"stats": [
{ "stat": "maxHealth", "baseMultiplier": 1.15 },
{ "stat": "maxEnergy", "baseMultiplier": 1.15 }
]
}
],
"weaponEffects": [
{
"weapons": [ "pistol" ],
"stats": [
{ "stat": "powerMultiplier", "amount": 0.09 }
]
},
{
"weapons": [
"sniperrifle",
"rifle"
],
"stats": [{
"stat": "critChance",
"amount": 5
},
{
"stat": "critDamage",
"amount": 0.2
}
"weapons": [ "sniperrifle", "rifle" ],
"stats": [
{ "stat": "critChance", "amount": 5 },
{ "stat": "critDamage", "amount": 0.2 }
]
},
{
"weapons": [
"shotgun"
],
"stats": [{
"stat": "powerMultiplier",
"baseMultiplier": 1.2
},
{
"stat": "critDamage",
"amount": 0.2
}
"weapons": [ "shotgun" ],
"stats": [
{ "stat": "powerMultiplier", "baseMultiplier": 1.2 },
{ "stat": "critDamage", "amount": 0.2 }
]
},
{
"combos": [
[
"pistol",
"pistol"
]
],
"stats": [{
"stat": "grit",
"amount": 0.25
},
{
"stat": "maxEnergy",
"baseMultiplier": 1.15
},
{
"stat": "powerMultiplier",
"amount": 0.09
}
"combos": [ [ "pistol", "pistol" ] ],
"stats": [
{ "stat": "grit", "amount": 0.25 },
{ "stat": "maxEnergy", "baseMultiplier": 1.15 },
{ "stat": "powerMultiplier", "amount": 0.09 }
],
"controlModifiers": {
"speedModifier": 1.08,
"airJumpModifier": 1.05
}
},
{
"weapons": [
"whip"
"weapons": [ "whip" ],
"stats": [
{ "stat": "powerMultiplier", "baseMultiplier": 1.15 }
],
"stats": [{
"stat": "powerMultiplier",
"baseMultiplier": 1.15
}],
"controlModifiers": {
"speedModifier": 1.1
}
}
],
"weaponScripts": [{
"script": "/scripts/fr_weaponscripts/novakidspeed.lua",
"weapons": [
"pistol"
],
"contexts": [
"gunfire-update",
"gunfire-postauto",
"gunfire-postburst"
],
"args": {
"damageProportion": 0.5,
"damageFloor": 0.5,
"damageCeiling": 1,
"lightValue": 200,
"minSpeed": 1,
"maxSpeed": 0
"weaponScripts": [
{
"script": "/scripts/fr_weaponscripts/novakidspeed.lua",
"weapons": [ "pistol" ],
"contexts": [ "gunfire-update", "gunfire-postauto", "gunfire-postburst" ],
"args": {
"damageProportion": 0.5,
"damageFloor": 0.5,
"damageCeiling": 1,
"lightValue": 200,
"minSpeed": 1,
"maxSpeed": 0
}
}
],
"scripts" : [
{
"script" : "/scripts/fr_scripts/novakidStuff.lua",
"args" : {
"daytimeConfig" : {
"stats" : [ // Applied during the day
{ "stat" : "energyRegenPercentageRate", "baseMultiplier" : 1.20 }
],
"hungerRegen" : 0.008, // Hunger% gained/s during the day
"hungerThreshold" : 0.40, // Hunger% required for regen to start
"maxHunger" : 0.85, // Maximum hunger level for regen (stops increasing here, keeps regenning above this)
"minHunger" : 0.50, // Minimum hunger level for regen (starts here, no regen below this)
"maxRegen" : 0.015, // Regen/s at maximum hunger level
"minRegen" : 0.010 // Regen/s at minimum hunger level
},
"nightConfig" : {
"stats" : [ // Applied at night
{ "stat" : "maxEnergy", "baseMultiplier" : 0.75 }
],
"hungerThreshold" : 0.5, // Hunger% at which regeneration is allowed at night
"hungerLoss" : -0.005, // Hunger%/s lost at night
"regen" : 0.010 // Health%/s gained at night
}
}
}
}],
"special": [
"foodregennovakid"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
"defaultDuration" : 1,

"scripts" : [
"foodregennovakid.lua"
],

"animationConfig" : "foodregen.animation"
"deprecated.lua"
]
}
Loading

0 comments on commit ed156db

Please sign in to comment.