1
0

lact_lib.qsrc 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983
  1. # lact_lib
  2. !! ---- new lactation string index array for all lactation functions ----------
  3. !! lactation['active'] = old "lactate" variable
  4. !! lactation['induced'] = old lactateinduced variable
  5. !! lactation['pc_aware'] = old pcs_knowsaboutlactation variable
  6. !! lactation['lactaterate'] = old lactaterate variable now in ml*1000
  7. !! lactation['breastmv'] = old lactatemv variable now in ml*1000
  8. !! lactation['breastmm'] = old lactatemm variable now in ml*1000
  9. !! lactation['prolactinlvl'] = old prolactinlvl variable
  10. !! lactation['milkedvolume'] = old milkedvolume variable
  11. !! lactation['lactatemess'] = old lactatemess variable
  12. !! lactation['engorgement'] = old lact_engorgement variable
  13. !! lactation['dailyoverdemand'] = old milkoverdemand variable
  14. !! lactation['inducegrowth'] = old milkinduceday variable
  15. !! lactation['nipgrowth'] = variable to count nipplegrowth with lactation start nipples will grow by 2 points.
  16. !! lactation['milkgrowday'] = old milkgrowday variable.
  17. !! lactation['breastdensitytype'] = variable to define breast type. 0 = not initialized, 1 = 17% gland tissue, 2 = 36% gland tissue, 3 = 55% gland tissue, 4 = 74% gland tissue, 5 = 93% gland tissue
  18. !! lactation['breastglandtissue'] = the amount of glandular tissue per breast
  19. !! lactation['alveoliexpandlvl'] = variable for alveoli expansion 0 = not expanded 5 fully expanded.
  20. !! lactation['breastcount'] = how many breasts does sveta have? Usually should be set to 2.
  21. !! lactation['maturebreast'] = Did Svetas breast fully change during pregnancy yet? 0 = no, 1 = yes
  22. !! lactation['breastpumped'] = old breastpumped variable.
  23. !! ---- old variables ---------------------------------------------------------
  24. !! - These Variables still need to be replaced/removed or substituted. -
  25. !! breastcounter
  26. !! di_i
  27. !! emb_i
  28. !! energytomilkpump
  29. !! lactaterate_use
  30. !! max_nip_flow_rate
  31. !! max_sucktion_demand
  32. !! mbarrcool
  33. !! mbarrfill
  34. !! mbarrloca
  35. !! mbarrmage
  36. !! mbarrtype
  37. !! milk_demand
  38. !! nip_flow
  39. !! nip_flow_mod
  40. !! nipple_cream
  41. !! pcs_ask_mward_help
  42. !! pcs_know_mward
  43. !! pcs_knows_electric_pump
  44. !! pcs_massagedherbreasts
  45. !! pcs_usedbreastpumponherself
  46. !! piits_i
  47. !! pump_bottletype
  48. !! pump_stop_brake
  49. !! pump_timestamp
  50. !! pumpinggrowth
  51. !! pumptime
  52. !! pumptime_left
  53. !! pumptype
  54. !! rbc_index
  55. !! reg_bottlem_count
  56. !! reg_bottles_count
  57. !! soreness_mod
  58. !! suck_flow_rate
  59. !! suck_until_pain
  60. !! temp_breastsize
  61. !! temp_lactaterate
  62. !! temp_timestamp
  63. !! temp_var
  64. !! temp_var2
  65. !! ts_i
  66. !! umbc_i
  67. !! usbc_i
  68. !! vmb_i
  69. !! This function is called only once in the begining of the game. It is calculating svetas mammary gland density and alveolicount and sets the breastcount which will be 2 naturally
  70. if $ARGS[0] = 'init_breasttissue' and lactation['breasttissueinitiated'] <= 0:
  71. !! use func('lact_lib','init_breasttissue')
  72. lactation['breasttissueinitiated'] = 1
  73. !! breast density type. Density of glands.
  74. !! 0 = not initialized, 1 = 17% gland tissue, 2 = 36% gland tissue, 3 = 55% gland tissue, 4 = 74% gland tissue, 5 = 93% gland tissue. This is based on studies I found on the internet.
  75. !! The logic behind the below is, when losing fat, breasts usually volunteer first. So the more bodyfat sveta has, the more she has in her breasts, and therefore the percentage of gland tissue goes down.
  76. !! Breasts cannot lose glandular tissue (if not cut out, yikes), therefore this will define the maximum they can shrink if fat is removed. At the moment this is done by Genbsize. The below will replace this in the future.
  77. !! Genbsize is the breastsize that is given to Sveta by her parents. During puberty the breasts swell up to this size with mostly being fat tissue. Due to genetic variability and hormones, breasts will develop more or
  78. !! less mammary gland tissue during puberty. As the game starts after Svetas puberty, this is impossible to simulate. That is why I came up with the below part. It will calculate the breastdensity using Svetas body fat.
  79. !! During pregnancy most of the breast fat is getting replaced by conjuctive tissue and mammary glands. But the genetical breastsize also affects the total mammary gland growth. So for example, if Sveta is a chubby,
  80. !! and has D cups with a breastdensitytype of 1, and she looses weight, her breast will shrink down to B cups. If her Genbsize is D, then she will grow D cups or bigger during pregnancy. But that is part of another function.
  81. lactation['breastcount'] = 2
  82. if lactation['breastdensitytype'] <= 0:
  83. if pregtimes > 0:
  84. lactation['breastdensitytype'] = 5
  85. elseif salo <= 20:
  86. lactation['breastdensitytype'] = 5
  87. elseif salo <= 40:
  88. lactation['breastdensitytype'] = 4
  89. elseif salo <= 60:
  90. lactation['breastdensitytype'] = 3
  91. elseif salo <= 80:
  92. lactation['breastdensitytype'] = 2
  93. elseif salo <= 100:
  94. lactation['breastdensitytype'] = 1
  95. end
  96. end
  97. !! breast tissue that can have mammary glands is nbsize + magicf2b
  98. !! Silicone is obviously not a good material to grow milkglands in
  99. !! full breastccm would be nbsize + magicf2b + silicone.
  100. !! Getting percentage tissue from breastccm.
  101. lactation['breastccm'] = func('lact_lib','bsizetoccm',(nbsize + magicf2b + silicone))
  102. lactation['nbsizepercent'] = (nbsize/(nbsize + magicf2b + silicone))*100
  103. lactation['magicf2bpercent'] = (magicf2b/(nbsize + magicf2b + silicone))*100
  104. lactation['siliconepercent'] = (silicone/(nbsize + magicf2b + silicone))*100
  105. lactation['nbsizepercent_wos'] = (nbsize/(nbsize + magicf2b))*100
  106. lactation['magicf2bpercent_wos'] = (magicf2b/(nbsize + magicf2b))*100
  107. lactation['nbsizechange'] = nbsize
  108. lactation['magicf2bchange'] = magicf2b
  109. lactation['siliconechange'] = silicone
  110. !! Getting the usuable amount of breast tissue which can actually have mammary glands (in ccm)
  111. lactation['breastuseabletissue'] = ((lactation['nbsizepercent'] + lactation['magicf2bpercent'])*lactation['breastccm'])/100
  112. lactation['breastsiliconeccm'] = (lactation['siliconepercent']*lactation['breastccm'])/100
  113. !! Getting mammary gland tissue per breast, based on the breastdensitytype. Explaination on the percentages is in the head of the function.
  114. if lactation['breastdensitytype'] = 1:
  115. lactation['breastglandtissue'] = (lactation['breastuseabletissue']*17)/100
  116. lactation['breastdensitypercent'] = 17
  117. elseif lactation['breastdensitytype'] = 2:
  118. lactation['breastglandtissue'] = (lactation['breastuseabletissue']*36)/100
  119. lactation['breastdensitypercent'] = 36
  120. elseif lactation['breastdensitytype'] = 3:
  121. lactation['breastglandtissue'] = (lactation['breastuseabletissue']*55)/100
  122. lactation['breastdensitypercent'] = 55
  123. elseif lactation['breastdensitytype'] = 4:
  124. lactation['breastglandtissue'] = (lactation['breastuseabletissue']*74)/100
  125. lactation['breastdensitypercent'] = 74
  126. elseif lactation['breastdensitytype'] = 5:
  127. lactation['breastglandtissue'] = (lactation['breastuseabletissue']*93)/100
  128. lactation['breastdensitypercent'] = 93
  129. end
  130. !! calculating breast fat per breast
  131. lactation['breastfat'] = lactation['breastuseabletissue'] - lactation['breastglandtissue']
  132. !! calculating alveolicount per breast Alveoli volume 2.18mm² (flat), milk volume 0.18mm³ (flat) and 4mm³ (inflated), milk volume 2mm³ (inflated) 1000 mm³ = 1 cm³
  133. if lactation['active'] <= 0:
  134. lactation['alveolicount'] = ((lactation['breastglandtissue']*100000)/218)
  135. lactation['alveoliexpandlvl'] = 0
  136. lactation['nipgrowth'] = 0
  137. else
  138. lactation['alveolicount'] = ((lactation['breastglandtissue']*1000)/4)
  139. lactation['alveoliexpandlvl'] = 10
  140. lactation['nipgrowth'] = 2
  141. end
  142. !! storing start volumes for later use
  143. lactation['breastccm_start'] = lactation['breastccm']
  144. lactation['breastfat_start'] = lactation['breastfat']
  145. lactation['breastglandtissue_start'] = lactation['breastglandtissue']
  146. lactation['alveolicount_start'] = lactation['alveolicount']
  147. lactation['nipgrowth_start'] = lactation['nipgrowth']
  148. lactation['breastdensitytype_start'] = lactation['breastdensitytype']
  149. lactation['usablebtissue_start'] = lactation['usablebtissue']
  150. lactation['usablebtissue_change'] = lactation['usablebtissue']
  151. end
  152. if $ARGS[0] = 'bsizetoccm':
  153. !! function to calculate volume per one breast from npc bust size.
  154. !! Getting breast ccm per breast function based on the bra size chart in here https://en.wikipedia.org/wiki/Bra_size
  155. !! I tried to create a math polynom for this, but ended up with x^16 monsters and inaccurate numbers, so I am going this approach.
  156. !! This is the most accurate function I was able to make, and is doing the job really good. So please do not touch it.
  157. !! usage func('lact_lib','bsizetoccm', (nbsize + magicf2b + silicone))
  158. if ARGS[1] < 0:
  159. result = 100
  160. elseif ARGS[1] <= 15:
  161. result = ((ARGS[1]*14)+100)
  162. elseif ARGS[1] <= 20:
  163. result = (((ARGS[1]-15)*16)+310)
  164. elseif ARGS[1] <= 25:
  165. result = (((ARGS[1]-20)*18)+390)
  166. elseif ARGS[1] <= 30:
  167. result = (((ARGS[1]-25)*22)+480)
  168. elseif ARGS[1] <= 35:
  169. result = (((ARGS[1]-30)*24)+590)
  170. elseif ARGS[1] <= 40:
  171. result = (((ARGS[1]-35)*28)+710)
  172. elseif ARGS[1] <= 45:
  173. result = (((ARGS[1]-40)*30)+850)
  174. elseif ARGS[1] <= 50:
  175. result = (((ARGS[1]-45)*36)+1000)
  176. elseif ARGS[1] <= 55:
  177. result = (((ARGS[1]-50)*38)+1180)
  178. elseif ARGS[1] <= 60:
  179. result = (((ARGS[1]-55)*42)+1370)
  180. elseif ARGS[1] <= 65:
  181. result = (((ARGS[1]-60)*46)+1580)
  182. elseif ARGS[1] <= 70:
  183. result = (((ARGS[1]-65)*50)+1810)
  184. elseif ARGS[1] <= 75:
  185. result = (((ARGS[1]-70)*56)+2060)
  186. elseif ARGS[1] <= 80:
  187. result = (((ARGS[1]-75)*60)+2340)
  188. elseif ARGS[1] <= 85:
  189. result = (((ARGS[1]-80)*72)+2640)
  190. elseif ARGS[1] > 85:
  191. result = (((ARGS[1]-85)*84)+3000)
  192. else
  193. result = 100
  194. end
  195. end
  196. if $ARGS[0] = 'bccmtosize':
  197. !! backwardsfunction of bsizetoccm. It just reverts breast ccm to "nbsize + magicf2b + silicone"
  198. !! func('lact_lib','bccmtosize',lactation['breastccm'])
  199. if ARGS[1] < 0:
  200. result = 0
  201. elseif ARGS[1] <= 310:
  202. result = ((ARGS[1] - 100)/14)
  203. elseif ARGS[1] <= 390:
  204. result = (((ARGS[1] - 310)/16)+15)
  205. elseif ARGS[1] <= 480:
  206. result = (((ARGS[1] - 390)/18)+20)
  207. elseif ARGS[1] <= 590:
  208. result = (((ARGS[1] - 480)/22)+25)
  209. elseif ARGS[1] <= 710:
  210. result = (((ARGS[1] - 590)/24)+30)
  211. elseif ARGS[1] <= 850:
  212. result = (((ARGS[1] - 710)/28)+35)
  213. elseif ARGS[1] <= 1000:
  214. result = (((ARGS[1] - 850)/30)+40)
  215. elseif ARGS[1] <= 1180:
  216. result = (((ARGS[1] - 1000)/36)+45)
  217. elseif ARGS[1] <= 1370:
  218. result = (((ARGS[1] - 1180)/38)+50)
  219. elseif ARGS[1] <= 1580:
  220. result = (((ARGS[1] - 1370)/42)+55)
  221. elseif ARGS[1] <= 1810:
  222. result = (((ARGS[1] - 1580)/46)+60)
  223. elseif ARGS[1] <= 2060:
  224. result = (((ARGS[1] - 1810)/50)+65)
  225. elseif ARGS[1] <= 2340:
  226. result = (((ARGS[1] - 2060)/56)+70)
  227. elseif ARGS[1] <= 2640:
  228. result = (((ARGS[1] - 2340)/60)+75)
  229. elseif ARGS[1] <= 3000:
  230. result = (((ARGS[1] - 2640)/72)+80)
  231. elseif ARGS[1] > 3000:
  232. result = (((ARGS[1] - 3000)/84)+85)
  233. else
  234. result = 0
  235. end
  236. end
  237. !! function to recalculate breastccm size. Basically an update function to the init_breasttissue, but without the initialization. Used in breastgrowth function and can be used for debugging or ... whatever comes up in the future.
  238. if $ARGS[0] = 'breastrecalc':
  239. !! use func('lact_lib','breastrecalc')
  240. lactation['breastccm'] = func('lact_lib','bsizetoccm',(nbsize + magicf2b + silicone))
  241. lactation['nbsizepercent'] = (nbsize/(nbsize + magicf2b + silicone))*100
  242. lactation['magicf2bpercent'] = (magicf2b/(nbsize + magicf2b + silicone))*100
  243. lactation['siliconepercent'] = (silicone/(nbsize + magicf2b + silicone))*100
  244. lactation['magicf2bpercent_wos'] = (magicf2b/(nbsize + magicf2b))*100
  245. lactation['breastuseabletissue'] = ((lactation['nbsizepercent'] + lactation['magicf2bpercent'])*lactation['breastccm'])/100
  246. lactation['breastsiliconeccm'] = (lactation['siliconepercent']*lactation['breastccm'])/100
  247. if lactation['alveolicount'] > 0:
  248. lactation['breastglandtissue']= (lactation['alveolicount'] * (218 + (lactation['alveoliexpandlvl'] * 20)))/100000
  249. else
  250. if lactation['breastdensitytype'] = 1:
  251. lactation['breastglandtissue'] = (lactation['breastuseabletissue']*17)/100
  252. lactation['breastdensitypercent'] = 17
  253. elseif lactation['breastdensitytype'] = 2:
  254. lactation['breastglandtissue'] = (lactation['breastuseabletissue']*36)/100
  255. lactation['breastdensitypercent'] = 36
  256. elseif lactation['breastdensitytype'] = 3:
  257. lactation['breastglandtissue'] = (lactation['breastuseabletissue']*55)/100
  258. lactation['breastdensitypercent'] = 55
  259. elseif lactation['breastdensitytype'] = 4:
  260. lactation['breastglandtissue'] = (lactation['breastuseabletissue']*74)/100
  261. lactation['breastdensitypercent'] = 74
  262. elseif lactation['breastdensitytype'] = 5:
  263. lactation['breastglandtissue'] = (lactation['breastuseabletissue']*93)/100
  264. lactation['breastdensitypercent'] = 93
  265. end
  266. if lactation['active'] <= 0:
  267. lactation['alveolicount'] = ((lactation['breastglandtissue']*100000)/218)
  268. lactation['alveoliexpandlvl'] = 0
  269. lactation['breastmm'] = 0
  270. lactation['breastmv'] = 0
  271. lactation['lactaterate'] = 0
  272. if pcs_nips > lactation['nipgrowth']: pcs_nips -= lactation['nipgrowth']
  273. lactation['nipgrowth'] = 0
  274. else
  275. lactation['alveolicount'] = ((lactation['breastglandtissue']*100000)/418)
  276. lactation['alveoliexpandlvl'] = 10
  277. lactation['nipgrowth'] = 2
  278. func('lact_lib','set_breastmm')
  279. if lactation['prolactinlvl'] < 200: lactation['prolactinlvl'] = 200
  280. lactation['lactaterate'] = 1000*(lactation['prolactinlvl']/200)
  281. lactation['breastmv'] = 0
  282. lactation['nipgrowth'] = 2
  283. pcs_nips += lactation['nipgrowth']
  284. end
  285. end
  286. lactation['breastfat'] = lactation['breastuseabletissue'] - lactation['breastglandtissue']
  287. end
  288. !! This function is used for breastgrowth. When nbsize, magicf2b, silicone, alveolicount or the alveoliexpandlvl are changed the breastccm changes. Everything will be written back to the specific variable
  289. if $ARGS[0] = 'BreastGrowth':
  290. !! usage func('lact_lib','BreastGrowth')
  291. if lactation['breastccm'] <> func('lact_lib','bsizetoccm',(nbsize + magicf2b + silicone)) or lactation['alveolicount_change'] <> lactation['alveolicount'] or lactation['alveoliexpandlvl_change'] <> lactation['alveoliexpandlvl']:
  292. !! There are general breast growth events that will increase nbsize, magicf2b or silicone. So the breast "contents" have to be recalculated. This is happening here with the breastrecalc function.
  293. !! Now the fun part. Warning, crazy math ahead. I got headaches while doing this, so better not mess with it or you will break everything.
  294. !! first - check for alveoligrowth: yes, do the crazy stuff
  295. if lactation['alveolicount_change'] <> lactation['alveolicount'] or lactation['alveoliexpandlvl_change'] <> lactation['alveoliexpandlvl']:
  296. !! calculating the ccm all mammarygland tissue will use up in the breast, based on alveolicount and alveoliexpandlvl. With every level, cmm will rise by 20 per alveoli.
  297. lactation['breastglandtissue']= (lactation['alveolicount'] * (218 + (lactation['alveoliexpandlvl'] * 20)))/100000
  298. !! Crazy Math going on here. When I was coding this, only god and I knew what I was doing. Now only god knows.
  299. !! Well, this one recalculates all the CCM stuff to normal nbsize, magicf2b and silicone. It works, no idea why, but it works.
  300. lactation['breastccm'] = (lactation['breastglandtissue'] + lactation['breastfat'] + lactation['breastsiliconeccm'])
  301. lactation['siliconepercent'] = (lactation['breastsiliconeccm']/lactation['breastccm'])*100
  302. lactation['magicf2bccm'] = ((lactation['breastccm'] - ((lactation['breastccm']*lactation['siliconepercent'])/100))*lactation['magicf2bpercent_wos'])/100
  303. lactation['nbsizebccm'] = lactation['breastccm'] - lactation['breastsiliconeccm'] - lactation['magicf2bccm']
  304. lactation['nbsizepercent'] = (lactation['nbsizebccm']/lactation['breastccm'])*100
  305. lactation['magicf2bpercent'] = (lactation['magicf2bccm']/lactation['nbsizebccm'])*100
  306. nbsize = (func('lact_lib','bccmtosize',lactation['breastccm'])*lactation['nbsizepercent'])/100
  307. magicf2b = (func('lact_lib','bccmtosize',lactation['breastccm'])*lactation['magicf2bpercent'])/100
  308. lactation['nbsizechange'] = nbsize
  309. lactation['magicf2bchange'] = magicf2b
  310. lactation['siliconechange'] = silicone
  311. elseif (lactation['nbsizechange'] + lactation['siliconechange'] + lactation['magicf2bchange']) <> (nbsize + magicf2b + silicone):
  312. !! and (lactation['alveolicount_change'] = lactation['alveolicount'] or lactation['alveoliexpandlvl_change'] = lactation['alveoliexpandlvl'])
  313. func('lact_lib','breastrecalc')
  314. end
  315. end
  316. end
  317. !! new lactation['breastmm'] function. Warning! lactation['breastmm'] is now in microliter (ml*1000) for more acuracy. Alveoli count per breast times 2mm³ (2mm³ = 0,002ml) times breastcount.
  318. !! Breastcount can be changed later on if someone comes up with multibreasts or breast amputation.
  319. if $ARGS[0] = 'set_breastmm':
  320. lactation['breastmm'] = (lactation['alveolicount']*2)*lactation['breastcount']
  321. end
  322. !! Just a function used for debugging. Can be deleted if not needed anymore.
  323. if $ARGS[0] = 'show_breast_stat':
  324. !! func('lact_lib','show_breast_stat')
  325. 'lactation[''breastcount''] = <<lactation[''breastcount'']>>'
  326. 'lactation[''breasttissueinitiated''] = <<lactation[''breasttissueinitiated'']>>'
  327. 'lactation[''breastccm''] = <<lactation[''breastccm'']>>'
  328. 'lactation[''maturebreast''] = <<lactation[''maturebreast'']>>'
  329. 'lactation[''alveolicount''] = <<lactation[''alveolicount'']>>'
  330. 'lactation[''prolactinlvl''] = <<lactation[''prolactinlvl'']>>'
  331. 'lactation[''dailyoverdemand''] = <<lactation[''dailyoverdemand'']>>'
  332. 'lactation[''alveoliexpandlvl''] = <<lactation[''alveoliexpandlvl'']>>'
  333. 'lactation[''active''] = <<lactation[''active'']>>'
  334. 'lactation[''lactaterate''] = <<lactation[''lactaterate'']>>'
  335. 'lactation[''breastmm''] = <<lactation[''breastmm'']>>'
  336. 'lactation[''breastmv''] = <<lactation[''breastmv'']>>'
  337. end
  338. !! milk production function
  339. if $ARGS[0] = 'prod_milk':
  340. !! function for Svetas milk production. Milk production will cost stamina, hydration, and hunger. this function is used in breastcycle
  341. !! func('lact_lib','prod_milk',milkamount)
  342. !! result = produced breast milk amount in ml*1000
  343. !! ARGS[1] = Requested milk production amount produced in ml*1000. Usually should be the lactaterate.
  344. !! If Sveta has salo <= 15, she will not produce breast milk as she is basically starving and her body will shut down everything that is causing too much energy consumption.
  345. if lactation['active'] > 0 and salo > 15:
  346. !! checking how much hydration, stamina and hunger is needed to produce x amount of breast milk
  347. !! checking if enough stamina and hydra is available
  348. if (ARGS[1]/10000) < pcs_stam and (ARGS[1]/10000) < pcs_hydra:
  349. !! full requested milk amount can be produced. substracting from stamina, hydration energy.
  350. if (ARGS[1]/10000) < 1:
  351. pcs_stam -= 1
  352. pcs_hydra -= 1
  353. else
  354. pcs_stam -= (ARGS[1]/10000)
  355. pcs_hydra -= (ARGS[1]/10000)
  356. end
  357. if pcs_stam < 1: pcs_stam = 1
  358. if pcs_hydra < 1: pcs_hydra = 1
  359. if (ARGS[1]/9000) < pcs_energy:
  360. if (ARGS[1]/9000) < 1:
  361. pcs_energy -= 1
  362. else
  363. pcs_energy -= (ARGS[1]/9000)
  364. if pcs_energy < 1: pcs_energy = 1
  365. end
  366. result = ARGS[1]
  367. else
  368. !! If energy is too low, milk will be produced but there is a chance that salo will shrink.
  369. pcs_energy = 1
  370. if rand(0,100) > 95: salo -= 1
  371. if pain['breasts'] < 20: pain['breasts'] += 1
  372. result = ARGS[1]
  373. end
  374. elseif pcs_stam <= 0 or pcs_hydra <= 0:
  375. !! if sveta has not enough hydration or stamina, no milk is produced.
  376. result = 0
  377. else
  378. if (pcs_stam*10000) < (pcs_hydra*10000):
  379. temp_var = (pcs_stam*10000)
  380. pcs_stam = 1
  381. if (ARGS[1]/10000) < pcs_hydra:
  382. pcs_hydra -= (ARGS[1]/10000)
  383. else
  384. pcs_hydra = 1
  385. end
  386. else
  387. temp_var = (pcs_hydra*10000)
  388. pcs_hydra = 1
  389. if (ARGS[1]/10000) < pcs_stam:
  390. pcs_stam -= (ARGS[1]/10000)
  391. else
  392. pcs_stam = 1
  393. end
  394. end
  395. if (temp_var/9000) < pcs_energy:
  396. if (temp_var/9000) < 1:
  397. pcs_energy -= 1
  398. else
  399. pcs_energy -= (temp_var/9000)
  400. if pcs_energy < 1: pcs_energy = 1
  401. end
  402. else
  403. !! If energy is too low, milk will be produced but there is a chance that salo will shrink.
  404. pcs_energy = 1
  405. if rand(0,100) > 95: salo -= 1
  406. if pain['breasts'] < 20: pain['breasts'] += 1
  407. end
  408. if pcs_energy < 1: pcs_energy = 1
  409. if pcs_hydra < 1: pcs_hydra = 1
  410. if pcs_stam < 1: pcs_stam = 1
  411. result = temp_var
  412. end
  413. else
  414. result = 0
  415. end
  416. end
  417. !! Lactation On/Off switch function
  418. if $ARGS[0] = 'lact_switch':
  419. !! Usage
  420. !! func('lact_lib','lact_switch')
  421. if lactation['active'] <= 0:
  422. !! Sveta is not aware of the lactation yet. She will notice when playing with her breasts or applying pressure to them. Or during pumping or when she starts to leak.
  423. lactation['pc_aware'] = 0
  424. !! setting lactation to active
  425. lactation['active'] = 1
  426. !! setting breast maximum milk volume via function
  427. func('lact_lib','set_breastmm')
  428. !! resetting prolactinlvl so that the initial production rate is not too high
  429. if lactation['prolactinlvl'] < 200: lactation['prolactinlvl'] = 200
  430. !! setting the lactation rate. Warning! lactation rate is in ml*1000 now for higher accuracy.
  431. lactation['lactaterate'] = 1000*(lactation['prolactinlvl']/200)
  432. !! setting milk volume in breasts to 0. Will fill up with lactaterate in another part of the breastcycle
  433. lactation['breastmv'] = 0
  434. !! nipples will grow a bit with extended milk channels. If lactation stops, this will be substracted from the nipples again and nipples will shrink.
  435. lactation['nipgrowth'] = 2
  436. pcs_nips += lactation['nipgrowth']
  437. if lactation['alveoliexpandlvl'] < 10: lactation['alveoliexpandlvl'] = 10
  438. else
  439. !! If lactation is on, the stuff below will switch it off again.
  440. lactation['active'] = 0
  441. lactation['lactaterate'] = 0
  442. lactation['breastmv'] = 0
  443. lactation['breastmm']
  444. if pcs_nips > lactation['nipgrowth']: pcs_nips -= lactation['nipgrowth']
  445. lactation['nipgrowth'] = 0
  446. end
  447. end
  448. !! new breast cycle function, will replace the monster lactation function in femcyc
  449. if $ARGS[0] = 'breastcycle':
  450. if lactation['breasttissueinitiated'] <= 0: func('lact_lib','init_breasttissue')
  451. !! usage func('lact_lib','breastcycle')
  452. !! if lactating or not, breasts will grow during pregnancy. This will only happen during first full pregnancy
  453. if pregchem => 2191 and lactation['maturebreast'] <= 0:
  454. !! Alveoligrowth/breastgrowth + 78876 new aveoli per breast average during pregnancy
  455. !! Checking pregchem last. It should not be small than 0.
  456. if lactation['pregchemlast'] <= 0:
  457. lactation['pregchemlast'] = 2191
  458. end
  459. if lactation['preggrowth'] <= 78876 and (pregchem - lactation['pregchemlast']) > 0:
  460. lactation['preggrowth'] = (pregchem - 2191) * 36
  461. lactation['alveolicount'] = lactation['alveolicount_start'] + lactation['preggrowth']
  462. lactation['growthsoreness_on'] = 1
  463. if pain['breasts'] <= 20: pain['breasts'] = 20
  464. else
  465. lactation['growthsoreness_on'] = 0
  466. lactation['maturebreast'] = 1
  467. end
  468. lactation['pregchemlast'] = pregchem
  469. elseif PregChem > 4383 and lactation['maturebreast'] > 0:
  470. !! pregnancy prolactinlvl rise
  471. if lactation['prolactinlvl'] < 200 and lactation['active'] <= 0:
  472. if rand(0,100) > 25:
  473. lactation['prolactinlvl'] +=1
  474. end
  475. end
  476. end
  477. !! checking for prolactin and if svetas breasts were worked (e.g. breast stimulation via massage, pumps, by mouth, or whatever)
  478. if lactation['active'] <= 0:
  479. !! prolactinlvl calculation. If sveta never was pregnant, prolactinlvl will grow slower
  480. if lactation['milkgrowday'] < daystart:
  481. if (lactation['dailyoverdemand']/200) <= 0 and lactation['dailyoverdemand'] > 0:
  482. lactation['prolactinlvl'] += 1
  483. elseif (lactation['dailyoverdemand']/200) >= 10 and pregtimes <= 0:
  484. lactation['prolactinlvl'] += 10
  485. elseif (lactation['dailyoverdemand']/200) >= 50 and pregtimes > 1:
  486. lactation['prolactinlvl'] += 50
  487. else
  488. if lactation['prolactinlvl'] > 0 and pregchem < 2191:
  489. if ((lactation['prolactinlvl']/2) + (lactation['prolactinlvl']/5) - (lactation['prolactinlvl']/8)) < 1:
  490. lactation['prolactinlvl'] -= 1
  491. else
  492. lactation['prolactinlvl'] -= ((lactation['prolactinlvl']/2) + (lactation['prolactinlvl']/5) - (lactation['prolactinlvl']/8))
  493. end
  494. end
  495. end
  496. end
  497. if lactation['prolactinlvl'] > 200: lactation['prolactinlvl'] = 200
  498. !! expand level cannot be over 5
  499. if lactation['alveoliexpandlvl'] > 10: lactation['alveoliexpandlvl'] = 10
  500. !! Breast growth due to mammarygland expansion. Happens if prolactin level is high enough and will cause breastsoreness.
  501. !! If prolactinlvl lowers, milkglands will shrink again.
  502. if lactation['milkgrowday'] < daystart and lactation['prolactinlvl'] >= 100 and lactation['alveoliexpandlvl'] < 10:
  503. lactation['alveoliexpandlvl_change'] = lactation['alveoliexpandlvl']
  504. lactation['alveoliexpandlvl'] += 1
  505. lactation['growthsoreness_on'] = 1
  506. if pain['breasts'] <= 20: pain['breasts'] = 20
  507. elseif lactation['milkgrowday'] < daystart and lactation['prolactinlvl'] < 100 and lactation['alveoliexpandlvl'] > 0:
  508. lactation['alveoliexpandlvl_change'] = lactation['alveoliexpandlvl']
  509. lactation['alveoliexpandlvl'] -= 1
  510. lactation['growthsoreness_on'] = 1
  511. if pain['breasts'] <= 20: pain['breasts'] = 20
  512. end
  513. !! If sveta meets alveoliexpandlvl 10 and her prolactinlvl is between random 200 and 250, her lactation will set in. This is happening during induction or during pregnancy
  514. if rand(1,50) + lactation['prolactinlvl'] >= rand(200,250) and lactation['alveoliexpandlvl'] >= 10:
  515. func('lact_lib','lact_switch')
  516. end
  517. else
  518. !! things that happen when Sveta is lactating lactation['active'] > 1
  519. if lactation['milkgrowday'] < daystart:
  520. !! Lactation rate growth. The higher the lactationrate is, the slower it will grow. I have not found a study on this, so this is pure asumption and common sense.
  521. if lactation['dailyoverdemand'] > 0 and lactation['breastpumped'] >= 0:
  522. if lactation['lactaterate'] > 350000:
  523. lactation['lactaterate'] += (5*lactation['prolactinlvl'])/2
  524. elseif lactation['lactaterate'] > 600000:
  525. lactation['lactaterate'] += lactation['prolactinlvl']/2
  526. else
  527. lactation['lactaterate'] += (10*lactation['prolactinlvl'])/2
  528. end
  529. prolactinlvl = 100
  530. elseif lactation['dailyoverdemand'] <= 0 and lactation['breastpumped'] > 0:
  531. !! If there was no milk overdemand, sveta will keep her lactationrate level.
  532. lactation['prolactinlvl'] = 100
  533. lactation['dailyoverdemand'] = 0
  534. lactation['breastpumped'] = 0
  535. else
  536. !! If there was no demand at all, svetas lactation rate will drop. Weaning off will take 7-10 days usually. If there is no engorgment happening, it will take longer (up to 30 days)
  537. lactation['dailyoverdemand'] = 0
  538. lactation['breastpumped'] = 0
  539. if lactation['lactaterate'] > 0:
  540. !! lactation rate is dropping with below function.
  541. lactation['prolactinlvl'] = 100
  542. if ((lactation['lactaterate']/2) + (lactation['lactaterate']/5) - (lactation['lactaterate']/8)) < 1:
  543. lactation['lactaterate'] -= 1
  544. else
  545. lactation['lactaterate'] = (lactation['lactaterate'] - (lactation['lactaterate']/2) + (lactation['lactaterate']/5) - (lactation['lactaterate']/8))
  546. end
  547. elseif lactation['lactaterate'] <= 0 and lactation['maturebreast'] > 0 and pregchem >= 4383:
  548. !! during pregnancy lactation is not switched off. Svetas breasts will always produce a bit off milk
  549. lactation['lactaterate'] = 10
  550. elseif lactation['lactaterate'] <= 0:
  551. !! switching off lactation production and making sure prolactin is dropping. Nipples shrink too. There are some changes that are permanent, especially during pregnancy.
  552. func('lact_lib','lact_switch')
  553. end
  554. end
  555. end
  556. !! Filling lactaterate into svetas breast every hour
  557. if lactation['breastmv'] < lactation['breastmm'] and lactation['lactaterate'] > 50:
  558. lactation['breastmv'] += func('lact_lib','prod_milk',lactation['lactaterate'])
  559. if lactation['breastmv'] > lactation['breastmm']: lactation['breastmv'] = lactation['breastmm']
  560. end
  561. end
  562. if lactation['milkgrowday'] < daystart:
  563. func('lact_lib','BreastGrowth')
  564. lactation['dailyoverdemand'] = 0
  565. lactation['alveolicount_change'] = lactation['alveolicount']
  566. lactation['milkgrowday'] = daystart
  567. end
  568. end
  569. !! this needs to be reworked
  570. if $ARGS[0] = 'lactate_optout':
  571. !! func('lact_lib','lactate_optout')
  572. !! use gs 'lact_lib','lactate_optout'
  573. !! Used for switching off all lactation related content
  574. lactation['active'] = 0
  575. prolactinlvl = 0
  576. lactatemess = 0
  577. lact_engorgement = 0
  578. lactation['breastmv'] = 0
  579. lactation['breastmm'] = 0
  580. lactaterate = 0
  581. milk_demand = 0
  582. end
  583. !! get suckflow rate function
  584. if $ARGS[0] = 'get_suckflowrate':
  585. !! lactation['suck_flow_rate'] = func('lact_lib','get_suckflowrate', sucktion_type)
  586. !! The suck flow rate is the demand that is applied to Svetas breasts per minute. Be it breast massaging, direct nipple sucking or the simple use of a breast pump.
  587. !! ARGS[1] = sucktion_type: the type of sucktion. adult_mouth [0], child_mouth [1], baby_mouth [2], manual_breastpump [3] , electric_breastpump [4], hand_expressing [5], cow milker [6], weak baby_mouth [7], stimulation during sex/sex play [8]
  588. !! what type of sucktion is happening? different sucktion can cause a different demand of breastmilk.
  589. !! Result is base rate of sucktion 10ml/minute x 1000. So if the sucktion rate is 10ml/min then suck_flow_rate = 100.
  590. if ARGS[1] = 0:
  591. !! 'adult sucking'
  592. result = 12000
  593. elseif ARGS[1] = 1:
  594. !! 'child sucking'
  595. result = 11000
  596. elseif ARGS[1] = 2:
  597. !! 'baby sucking'
  598. result = 8000
  599. elseif ARGS[1] = 3:
  600. !! 'manual_breastpump sucking'
  601. result = 18000
  602. elseif ARGS[1] = 4:
  603. !! 'electric_breastpump sucking'
  604. result = 40000
  605. elseif ARGS[1] = 5:
  606. !! 'hand expression'
  607. result = 10500
  608. elseif ARGS[1] = 6:
  609. !! 'cow milker sucking'
  610. result = 100000
  611. elseif ARGS[1] = 7:
  612. !! 'weak baby sucking'
  613. result = 5000
  614. elseif ARGS[1] = 8:
  615. !! 'manual stimulation during sex/sex play'
  616. result = 6000
  617. else
  618. !! 'suck flow else branch'
  619. result = 10000
  620. end
  621. end
  622. !! get max nipple flow rate function
  623. if $ARGS[0] = 'get_maxnipflowrate':
  624. !! lactation['max_nip_flow_rate'] = func('lact_lib','get_maxnipflowrate')
  625. !! How much milk can be sucked out through svetas nipples per minute.
  626. !! Result is base rate is 10ml/minute x 1000.
  627. !! Calculating the nip flow mod. The more svetas breasts were worked/sucked, the more milk can go through her nipples.
  628. lactation['nip_flow_mod'] = breastcounter * 100
  629. !! IT IS OVER 9000!
  630. if lactation['nip_flow_mod'] > 9000: lactation['nip_flow_mod'] = 9000
  631. if pcs_nips > 0:
  632. result = (6000 + lactation['nip_flow_mod'])
  633. elseif pcs_nips > 20:
  634. result = (8000 + lactation['nip_flow_mod'])
  635. elseif pcs_nips > 40:
  636. result = (10000 + lactation['nip_flow_mod'])
  637. elseif pcs_nips > 60:
  638. result = (12000 + lactation['nip_flow_mod'])
  639. elseif pcs_nips > 80:
  640. result = (14000 + lactation['nip_flow_mod'])
  641. elseif pcs_nips > 100:
  642. result = (16000 + lactation['nip_flow_mod'])
  643. else
  644. result = (10000 + lactation['nip_flow_mod'])
  645. end
  646. end
  647. !! get mood modification
  648. if $ARGS[0] = 'get_moodmod':
  649. !! during breastfeeding or pumping or whatever, svetas mood can be pushed up.
  650. !! pcs_mood += func('lact_lib','get_maxnipflowrate', sucktion type, sucktion time)
  651. !! ARGS[1] = sucktion_type: the type of sucktion. adult_mouth [0], child_mouth [1], baby_mouth [2], manual_breastpump [3] , electric_breastpump [4], hand_expressing [5], cow milker [6], weak baby_mouth [7], stimulation during sex/sex play [8]
  652. !! Result = additional mood
  653. if ARGS[1] = 0:
  654. !! 'adult sucking'
  655. lactation['moodmod'] = ARGS[2]/8
  656. elseif ARGS[1] = 1:
  657. !! 'child sucking'
  658. lactation['moodmod'] = ARGS[2]/2
  659. elseif ARGS[1] = 2:
  660. !! 'baby sucking'
  661. lactation['moodmod'] = ARGS[2]
  662. elseif ARGS[1] = 7:
  663. !! 'weak baby sucking'
  664. lactation['moodmod'] = ARGS[2]
  665. else
  666. lactation['moodmod'] = 0
  667. end
  668. if lactation['active'] <= 0: lactation['moodmod'] = (lactation['moodmod']/2)
  669. if (lactation['moodmod'] + pcs_mood) > 100:
  670. result = (100 - pcs_mood)
  671. else
  672. result = lactation['moodmod']
  673. end
  674. end
  675. !! get soreness_mod
  676. if $ARGS[0] = 'get_sorenessmod':
  677. !! lactation['soreness_mod'] = func('lact_lib','get_sorenessmod')
  678. if lactation['nipple_cream_applied'] > 0:
  679. lactation['nipple_cream_applied'] = 0
  680. if (breastcounter/10) > 20:
  681. result = 40
  682. elseif (breastcounter/10) <= 0:
  683. result = 20
  684. else
  685. result = ((breastcounter/10) + 20)
  686. end
  687. else
  688. if (breastcounter/10) > 20:
  689. result = 20
  690. elseif (breastcounter/10) <= 0:
  691. result = 1
  692. else
  693. result = (breastcounter/10)
  694. end
  695. end
  696. end
  697. !! get breastmilktime function
  698. if $ARGS[0] = '$get_breastmilk_time':
  699. !! func('lact_lib','$get_breastmilk_time', sucktion_type, milk_demand)
  700. !! ARGS[1] = sucktion_type: the type of sucktion. adult_mouth [0], child_mouth [1], baby_mouth [2], manual_breastpump [3] , electric_breastpump [4], hand_expressing [5], cow milker [6], weak baby_mouth [7], stimulation during sex/sex play [8]
  701. !! ARGS[2] = milk_demand: how much milk is demanded. Warning: Should be ml and not in ml*10 for ease of use. :D
  702. !! RESULT = Time in Minutes
  703. !! Usage: breastmilktimetoget = func('lact_lib','$get_breastmilk_time', 2, 150)
  704. !! This function is just calculating the amount of time needed to get a specific amount of milk from svetas breasts. It is not pumping milk from her or changes anything else.
  705. !! If you want to milk sveta, use get_breastmilk.
  706. if lactation['active'] > 0:
  707. !! suck_flow_rate initialized Base Rate of sucking is 10ml/minute.
  708. lactation['suck_flow_rate'] = func('lact_lib','get_suckflowrate', ARGS[1])
  709. !! max nip flow rate initialized
  710. lactation['max_nip_flow_rate'] = func('lact_lib','get_maxnipflowrate')
  711. !! getting temp lactaterate
  712. if (lactaterate/60) < 1 and lactaterate > 0:
  713. temp_lactaterate = 1
  714. else
  715. temp_lactaterate = lactaterate/60
  716. end
  717. if lactation['breastmv'] >= (ARGS[2]*10):
  718. if lactation['max_nip_flow_rate'] <= lactation['suck_flow_rate']:
  719. temp_var = (ARGS[2]*10)/lactation['max_nip_flow_rate']
  720. else
  721. temp_var = (ARGS[2]*10)/lactation['suck_flow_rate']
  722. end
  723. RESULT = temp_var
  724. elseif lactation['breastmv'] > 0 and lactation['breastmv'] < (ARGS[2]*10):
  725. if lactation['max_nip_flow_rate'] <= lactation['suck_flow_rate']:
  726. temp_var = lactation['breastmv']/lactation['max_nip_flow_rate']
  727. temp_var2 = (ARGS[2]*10) - lactation['breastmv']
  728. if lactation['max_nip_flow_rate'] <= temp_lactaterate:
  729. temp_var += temp_var2/lactation['max_nip_flow_rate']
  730. else
  731. temp_var += temp_var2/(temp_lactaterate*10)
  732. end
  733. else
  734. temp_var = lactation['breastmv']/lactation['suck_flow_rate']
  735. temp_var2 = (ARGS[2]*10) - lactation['breastmv']
  736. if lactation['suck_flow_rate'] <= temp_lactaterate:
  737. temp_var += temp_var2/lactation['suck_flow_rate']
  738. else
  739. temp_var += temp_var2/(temp_lactaterate*10)
  740. end
  741. end
  742. RESULT = temp_var
  743. elseif lactation['breastmv'] <=0:
  744. if lactation['max_nip_flow_rate'] <= lactation['suck_flow_rate']:
  745. if lactation['max_nip_flow_rate'] <= temp_lactaterate:
  746. temp_var = (ARGS[2]*10)/lactation['max_nip_flow_rate']
  747. else
  748. temp_var = (ARGS[2]*10)/(temp_lactaterate*10)
  749. end
  750. else
  751. if lactation['suck_flow_rate'] <= temp_lactaterate:
  752. temp_var = (ARGS[2]*10)/lactation['suck_flow_rate']
  753. else
  754. temp_var = (ARGS[2]*10)/(temp_lactaterate*10)
  755. end
  756. end
  757. RESULT = temp_var
  758. else
  759. RESULT = 0
  760. end
  761. else
  762. RESULT = 0
  763. end
  764. end
  765. if $ARGS[0] = '$get_breastmilk':
  766. !! func('lact_lib','$get_breastmilk', sucktion_type, sucktion_time)
  767. !! ARGS[1] = sucktion_type: the type of sucktion. adult_mouth [0], child_mouth [1], baby_mouth [2], manual_breastpump [3] , electric_breastpump [4], hand_expressing [5], cow milker [6], weak baby_mouth [7], stimulation during sex/sex play [8]
  768. !! ARGS[2] = sucktion_time: how many minutes the sucking/pumping takes place
  769. !! Usage: breastmilkvolume = func('lact_lib','$get_breastmilk', 4, 20)
  770. !! RESULT = Milk in ml*10
  771. !! Sveta, someone or something tries to milk Svetas breasts, so the daily variable breastpumped is switched on. This is used for the breastcycle/femcycle. If this is not switched on, possible changes like prolactinlvl etc go down.
  772. lactation['breastpumped'] = 1
  773. !! suck_flow_rate initialized Base Rate of sucking is 10ml/minute.
  774. lactation['suck_flow_rate'] = func('lact_lib','get_suckflowrate', ARGS[1])
  775. !! max nip flow rate initialized
  776. lactation['max_nip_flow_rate'] = func('lact_lib','get_maxnipflowrate')
  777. !! will there be a mood change?
  778. pcs_mood += func('lact_lib','get_maxnipflowrate',ARGS[1],ARGS[2])
  779. !! get soreness that will result from pumping/sucking/massaging
  780. lactation['soreness_mod'] = func('lact_lib','get_sorenessmod')
  781. !! If Sveta is not lactating we still need to do some actions. This is handled in here. Nipple pain + breast pain are applied as well as stamina is used.
  782. if lactation['active']<= 0:
  783. if lactation['dailyoverdemand'] <= 0: lactation['dailyoverdemand'] = 0
  784. pump_stop_brake = 0
  785. !! This is how much milk demand is applied to the breasts. In this function it is needed to calculate the nipple pain and breast pain.
  786. max_sucktion_demand = lactation['suck_flow_rate']*ARGS[2]
  787. if pain['nipples'] <= 60:
  788. suck_until_pain = (((60 - pain['nipples'])*lactation['soreness_mod'])*1000)/(lactation['suck_flow_rate']/18)
  789. end
  790. temp_var = pain['nipples'] + max_sucktion_demand/(lactation['soreness_mod']*10000)
  791. if temp_var > 60:
  792. pain['nipples'] = 65
  793. pump_stop_brake = 1
  794. pumptime = suck_until_pain
  795. max_sucktion_demand = lactation['suck_flow_rate']*pumptime
  796. else
  797. pain['nipples'] += max_sucktion_demand/(lactation['soreness_mod']*100000)
  798. end
  799. temp_var = pain['breasts'] + max_sucktion_demand/10000
  800. if temp_var > 20:
  801. pain['breasts'] = 25
  802. else
  803. pain['breasts'] += max_sucktion_demand/10000
  804. end
  805. !! Pumping breasts is exhausting even if no milk comes. Pumping will impact the stamina of Sveta if she is not lactating.
  806. temp_var = pcs_stam - (max_sucktion_demand/30000)
  807. if temp_var < 0:
  808. pcs_stam = 0
  809. !! energy usage flag on.
  810. energytomilkpump = 1
  811. pcs_sweat += pumptime/30
  812. else
  813. pcs_stam -= max_sucktion_demand/30000
  814. pcs_sweat += pumptime/30
  815. !! energy usage flag on.
  816. energytomilkpump = 1
  817. end
  818. if pumptime < 10:
  819. breastcounter += 1
  820. else
  821. breastcounter += pumptime/10
  822. end
  823. lactation['dailyoverdemand'] += max_sucktion_demand
  824. result = 0
  825. elseif lactation['active'] > 0:
  826. !! How much milk demand is applied to the breasts.
  827. max_sucktion_demand = lactation['suck_flow_rate']*ARGS[2]
  828. !! We want to know if we can just suck out what is already stored or if additional milk production is needed to go through the whole pumping/sucking.
  829. !! If we only need 20ml from a 100ml storage, we would only substract 20ml, leaving 80ml inside the breasts.
  830. !! Also lets make sure we start at zero from the stuff we get from Sveta.
  831. milkedvolume = 0
  832. !! Case: Enough milk in Svetas breasts, covering the demand
  833. if lactation['breastmv'] >= max_sucktion_demand:
  834. !! Checking if svetas nipple flow is enough to serve the demand. If yes - get the demand; If no - get what she is able to give us.
  835. if lactation['max_nip_flow_rate'] >= lactation['suck_flow_rate']:
  836. milkedvolume = max_sucktion_demand
  837. lactation['breastmv'] -= max_sucktion_demand
  838. else:
  839. milkedvolume = lactation['max_nip_flow_rate']*ARGS[2]
  840. lactation['breastmv'] -= milkedvolume
  841. end
  842. !! Case: Not enough milk in Svetas breasts.
  843. elseif lactation['breastmv'] < max_sucktion_demand:
  844. !! We have two sub cases in this one. Sveta has no lactation['breastmv'] and Sveta has not enough lactation['breastmv']. This means she has to produce more milk, but first we need to know how much is needed.
  845. !! temp_var will be the amount of milk Sveta has to produce to serve the demand. pump time left is the time left after lactation['breastmv'] is drained.
  846. if lactation['breastmv'] <= 0:
  847. temp_var = max_sucktion_demand
  848. pumptime_left = ARGS[2]
  849. else
  850. temp_var = max_sucktion_demand - lactation['breastmv']
  851. if lactation['max_nip_flow_rate'] >= lactation['suck_flow_rate']:
  852. pumptime_left = ARGS[2] - (lactation['breastmv']/lactation['suck_flow_rate'])
  853. else
  854. pumptime_left = ARGS[2] - (lactation['breastmv']/lactation['max_nip_flow_rate'])
  855. end
  856. if pumptime_left < 0: pumptime_left = 0
  857. end
  858. !! Now we know how much time we have and how much demand we have. Time to check if Sveta can do it.
  859. !! For the case, that svetas milk flow is not big enough pumptime left will be 0, therefore this is handled here.
  860. if pumptime_left >0:
  861. if lactation['max_nip_flow_rate'] >= lactation['suck_flow_rate']:
  862. !! the lactaterate is per hour, so it is possible that lactaterate will end up being zero when devided by 60. therefore everything here is multiplied by 100.
  863. if (lactation['suck_flow_rate']*100) <= ((lactaterate*100)/60):
  864. milkedvolume += lactation['suck_flow_rate']*pumptime_left
  865. else
  866. milkedvolume += ((((lactaterate*100)/60)*pumptime_left)/100)
  867. breastcounter += 2
  868. end
  869. else
  870. !! Same here as above.
  871. if (lactation['max_nip_flow_rate']*100) <= ((lactaterate*100)/60):
  872. milkedvolume += lactation['max_nip_flow_rate']*pumptime_left
  873. breastcounter += 2
  874. else
  875. milkedvolume += ((((lactaterate*100)/60)*pumptime_left)/100)
  876. breastcounter += 2
  877. end
  878. end
  879. !! Produced milk needs to be subtracted from the hourly lactate rate, so femcycle is only adding the milk that was not produced yet in the next hour
  880. if pumptime_left > 60:
  881. if ((pumptime_left*100)/60) > 100:
  882. lactaterate_use -= ((((lactaterate*100)/60)*(pumptime_left mod 60))/100)
  883. else
  884. lactaterate_use = lactaterate
  885. end
  886. else
  887. if lactaterate >= lactaterate_use:
  888. lactaterate_use -= milkedvolume
  889. else
  890. lactaterate_use = lactaterate
  891. end
  892. end
  893. if lactaterate_use <= 0: lactaterate_use = 0
  894. !! Sveta had to make milk, so she needs to use some of her body resources to make the milk.
  895. if milkedvolume > 0:
  896. !! energy usage flag on. Can be used in events to show that sveta is getting hungry or thirsty
  897. energytomilkpump = 1
  898. pcs_stam -= max_sucktion_demand/30000
  899. if pcs_stam <= 0: pcs_stam = 0
  900. pcs_sweat += pumptime/30
  901. pcs_hydra -= milkedvolume/120
  902. if pcs_hydra < 1: pcs_hydra = 1
  903. pcs_energy -= milkedvolume/1200
  904. end
  905. end
  906. !! Now we check if sveta was able to make it or not. If not we have milk overdemand which will be used in femcycle to make her produce more milk next day.
  907. if temp_var > milkedvolume:
  908. lactation['dailyoverdemand'] += (temp_var - milkedvolume)
  909. end
  910. !! time to add the pumped lactation['breastmv'] to the milkedvolume and empty lactation['breastmv'].
  911. milkedvolume += lactation['breastmv']
  912. lactation['breastmv'] = 0
  913. !! Here we have nipple and breastpain. The idea is - if there is more sucktion than the nipples can take more pain is applied. If the breasts make less milk then demanded pain to the breasts is applied.
  914. !! Else - there will only be nipple pain.
  915. if lactation['max_nip_flow_rate'] < lactation['suck_flow_rate']:
  916. temp_var = pain['nipples'] + ((lactation['suck_flow_rate'] - lactation['max_nip_flow_rate'])*ARGS[2])/2000 - (lactation['soreness_mod']*ARGS[2])*15
  917. if temp_var >= 60:
  918. pain['nipples'] = 65
  919. elseif temp_var <= 0:
  920. pain['nipples'] += 1
  921. else
  922. pain['nipples'] += (((lactation['suck_flow_rate'] - lactation['max_nip_flow_rate'])*ARGS[2])/2000 - (lactation['soreness_mod']*ARGS[2])*15)
  923. end
  924. else
  925. if ARGS[2] < 10:
  926. pain['nipples'] += 1
  927. elseif ARGS[2] >= 10 and lactation['soreness_mod'] > ARGS[2]:
  928. pain['nipples'] += 1
  929. else
  930. pain['nipples'] += (ARGS[2]/10 - lactation['soreness_mod']/10)
  931. end
  932. end
  933. if lactation['max_nip_flow_rate'] >= lactation['suck_flow_rate']:
  934. if (lactation['suck_flow_rate']*100) > ((lactaterate*100)/60):
  935. temp_var = pain['breasts'] + (((lactation['suck_flow_rate']*100)-((lactaterate*100)/60))*pumptime_left)/1000
  936. if temp_var > 20:
  937. pain['breasts'] = 20
  938. else
  939. pain['breasts'] += (((lactation['suck_flow_rate']*100)-((lactaterate*100)/60))*pumptime_left)/1000
  940. end
  941. end
  942. else
  943. if (lactation['max_nip_flow_rate']*100) > ((lactaterate*100)/60):
  944. temp_var = pain['breasts'] + (((lactation['max_nip_flow_rate']*100)-((lactaterate*100)/60))*pumptime_left)/1000
  945. if temp_var > 20:
  946. pain['breasts'] = 20
  947. else
  948. pain['breasts'] += (((lactation['max_nip_flow_rate']*100)-((lactaterate*100)/60))*pumptime_left)/1000
  949. end
  950. end
  951. end
  952. end
  953. if pumptime < 10:
  954. breastcounter += 1
  955. else
  956. breastcounter += pumptime/10
  957. end
  958. !! Done - Result is the milked volume.
  959. RESULT = milkedvolume
  960. end
  961. end
  962. --- lact_lib ---------------------------------