Skip to content

Commit

Permalink
Pregnancy kid stage config setting
Browse files Browse the repository at this point in the history
Added config settings to control the length of a newborn NPC's kid stage, or turn it off altogether.
Only affects new NPCs.
  • Loading branch information
ErinaSugino committed Sep 10, 2024
1 parent 1ce765c commit bbd919c
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 3 deletions.
6 changes: 4 additions & 2 deletions scripts/sexbound/plugins/pregnant/baby.lua
Original file line number Diff line number Diff line change
Expand Up @@ -367,9 +367,11 @@ function Baby:_convertBabyConfigToSpawnableNPC(babyConfig, babyName)
fatherUuid = babyConfig.fatherUuid,
fatherName = babyConfig.fatherName,
generationFertility = babyConfig.generationFertility,
fertilityPenalty = babyConfig.generationFertility,
kid = world.time() + 840*5 --5 days of being a kid
fertilityPenalty = babyConfig.generationFertility
}
if self._parent._parent._config.enableKidStage then
params.statusControllerSettings.statusProperties.kid = world.time() + 840*(self._parent._parent._config.kidDayCount or 5) --Config based days of being a kid
end
params.identity = {}
params.identity.gender = babyConfig.birthGender
if babyName and babyName ~= "" then params.identity.name = babyName end
Expand Down
23 changes: 23 additions & 0 deletions scripts/sexbound/plugins/pregnant/pregnant.lua
Original file line number Diff line number Diff line change
Expand Up @@ -821,6 +821,8 @@ function Sexbound.Actor.Pregnant:validateConfig()
self:validateImmersionLevel(self._config.immersionLevel)
self:validateSubGenderList(self._config.subGenderList)
self:validateSubGenderChance(self._config.subGenderChance)
self:validateEnableKidStage(self._config.enableKidStage)
self:validateKidDayCount(self._config.kidDayCount)
end

--- Ensures immersionLevel is set to an allowed value
Expand Down Expand Up @@ -1083,3 +1085,24 @@ function Sexbound.Actor.Pregnant:validateIncestPenalty(value)
end
self._config.incestPenalty = value
end


--- Ensures enableKidStage is set to an allowed value
-- @param value
function Sexbound.Actor.Pregnant:validateEnableKidStage(value)
if type(value) ~= "boolean" then
self._config.enableKidStage = true
return
end
self._config.enableKidStage = value
end

--- Ensures kidDayCount is set to an allowed value
-- @param value
function Sexbound.Actor.Pregnant:validateKidDayCount(value)
if type(value) == "number" then
self._config.kidDayCount = util.clamp(value, 1, value)
return
end
self._config.kidDayCount = 5
end
13 changes: 12 additions & 1 deletion sxb_plugin.pregnant.config
Original file line number Diff line number Diff line change
Expand Up @@ -206,5 +206,16 @@
/**
* If incest babies suffer from a birth chance penalty or not
*/
"incestPenalty": true
"incestPenalty": true,

/**
* If you want newborn NPCs to go through a kid stage or not
*/
"enableKidStage": true,

/**
* Duration, in in-game days, that a newborn NPC stays a kid.
* ONLY affects new babies!
*/
"kidDayCount": 5
}

0 comments on commit bbd919c

Please sign in to comment.