1
0

lact_lib.qsrc 55 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069
  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['lactmess'] = old lactatemess variable
  12. !! lactation['engorgement'] = old lact_engorgement variable. 1 = engorged breasts, 0 = not engorged.
  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. !! lactation['max_sucktion_demand'] = old max_sucktion_demand variable. Used in milking function
  24. !! breastcounter = times the breasts have been milked/sucked/pumped
  25. !! lactation['max_nip_flow_rate'] = old max_nip_flow_rate variable. used in milking function
  26. !! lactation['suck_flow_rate'] = old suck_flow_rate variable. Used in milking function
  27. !! lactation['soreness_mod'] = old soreness_mod variable. Used in milking functions
  28. !! lactation['nip_flow_mod'] = old nip_flow_mod variable. Used in milking functions
  29. !! lactation['used_lactaterate'] = old lactaterate_use variable.
  30. !! lactation['nipple_cream_applied'] = old nipple_cream variable. Used in soreness_mod function
  31. !! lactation['lactaterate_per_min'] = old temp_lactaterate variable in get breast milking time function
  32. !! lactation['produced_milk'] = dummy used in milking function.
  33. !! ---- old variables ---------------------------------------------------------
  34. !! - These Variables still need to be replaced/removed or substituted. -
  35. !! energytomilkpump
  36. !! pump_stop_brake
  37. !! pumptime
  38. !! pumptime_left
  39. !! suck_until_pain = needs update
  40. !! temp_var = need to find ways to get rid of temp_var dump
  41. !! temp_var2 = need to find ways to get rid of temp_var dump
  42. !! 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
  43. if $ARGS[0] = 'init_breasttissue' and lactation['breasttissueinitiated'] <= 0:
  44. !! use func('lact_lib','init_breasttissue')
  45. lactation['breasttissueinitiated'] = 1
  46. !! breast density type. Density of glands.
  47. !! 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.
  48. !! 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.
  49. !! 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.
  50. !! 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
  51. !! 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.
  52. !! 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,
  53. !! 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.
  54. lactation['breastcount'] = 2
  55. if lactation['breastdensitytype'] <= 0:
  56. if pregtimes > 0:
  57. lactation['breastdensitytype'] = 5
  58. elseif salo <= 20:
  59. lactation['breastdensitytype'] = 5
  60. elseif salo <= 40:
  61. lactation['breastdensitytype'] = 4
  62. elseif salo <= 60:
  63. lactation['breastdensitytype'] = 3
  64. elseif salo <= 80:
  65. lactation['breastdensitytype'] = 2
  66. elseif salo <= 100:
  67. lactation['breastdensitytype'] = 1
  68. end
  69. end
  70. !! breast tissue that can have mammary glands is nbsize + magicf2b
  71. !! Silicone is obviously not a good material to grow milkglands in
  72. !! full breastccm would be nbsize + magicf2b + silicone.
  73. !! Getting percentage tissue from breastccm.
  74. lactation['breastccm'] = func('lact_lib','bsizetoccm',(nbsize + magicf2b + silicone))
  75. if lactation['breastccm'] <= 0: lactation['breastccm'] = 1
  76. lactation['nbsizepercent'] = (nbsize*100/(nbsize + magicf2b + silicone)*100)/100
  77. lactation['magicf2bpercent'] = (magicf2b*100/(nbsize + magicf2b + silicone)*100)/100
  78. lactation['siliconepercent'] = (silicone*100/(nbsize + magicf2b + silicone)*100)/100
  79. lactation['nbsizepercent_wos'] = (nbsize*100/(nbsize + magicf2b)*100)/100
  80. lactation['magicf2bpercent_wos'] = (magicf2b*100/(nbsize + magicf2b)*100)/100
  81. lactation['nbsizechange'] = nbsize
  82. lactation['magicf2bchange'] = magicf2b
  83. lactation['siliconechange'] = silicone
  84. !! Getting the usuable amount of breast tissue which can actually have mammary glands (in ccm)
  85. lactation['breastuseabletissue'] = ((lactation['nbsizepercent'] + lactation['magicf2bpercent'])*lactation['breastccm'])/100
  86. lactation['breastsiliconeccm'] = (lactation['siliconepercent']*lactation['breastccm'])/100
  87. !! Getting mammary gland tissue per breast, based on the breastdensitytype. Explaination on the percentages is in the head of the function.
  88. if lactation['breastdensitytype'] = 1:
  89. lactation['breastglandtissue'] = (lactation['breastuseabletissue']*17)/100
  90. lactation['breastdensitypercent'] = 17
  91. elseif lactation['breastdensitytype'] = 2:
  92. lactation['breastglandtissue'] = (lactation['breastuseabletissue']*36)/100
  93. lactation['breastdensitypercent'] = 36
  94. elseif lactation['breastdensitytype'] = 3:
  95. lactation['breastglandtissue'] = (lactation['breastuseabletissue']*55)/100
  96. lactation['breastdensitypercent'] = 55
  97. elseif lactation['breastdensitytype'] = 4:
  98. lactation['breastglandtissue'] = (lactation['breastuseabletissue']*74)/100
  99. lactation['breastdensitypercent'] = 74
  100. elseif lactation['breastdensitytype'] = 5:
  101. lactation['breastglandtissue'] = (lactation['breastuseabletissue']*93)/100
  102. lactation['breastdensitypercent'] = 93
  103. end
  104. !! calculating breast fat per breast
  105. lactation['breastfat'] = lactation['breastuseabletissue'] - lactation['breastglandtissue']
  106. !! 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³
  107. if lactation['active'] <= 0:
  108. lactation['alveolicount'] = ((lactation['breastglandtissue']*100000)/218)
  109. lactation['alveoliexpandlvl'] = 0
  110. lactation['nipgrowth'] = 0
  111. else
  112. lactation['alveolicount'] = ((lactation['breastglandtissue']*1000)/4)
  113. lactation['alveoliexpandlvl'] = 10
  114. lactation['nipgrowth'] = 2
  115. end
  116. !! storing start volumes for later use
  117. lactation['breastccm_start'] = lactation['breastccm']
  118. lactation['breastfat_start'] = lactation['breastfat']
  119. lactation['breastglandtissue_start'] = lactation['breastglandtissue']
  120. lactation['alveolicount_start'] = lactation['alveolicount']
  121. lactation['nipgrowth_start'] = lactation['nipgrowth']
  122. lactation['breastdensitytype_start'] = lactation['breastdensitytype']
  123. lactation['usablebtissue_start'] = lactation['usablebtissue']
  124. lactation['usablebtissue_change'] = lactation['usablebtissue']
  125. end
  126. if $ARGS[0] = 'bsizetoccm':
  127. !! function to calculate volume per one breast from npc bust size.
  128. !! Getting breast ccm per breast function based on the bra size chart in here https://en.wikipedia.org/wiki/Bra_size
  129. !! 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.
  130. !! This is the most accurate function I was able to make, and is doing the job really good. So please do not touch it.
  131. !! usage func('lact_lib','bsizetoccm', (nbsize + magicf2b + silicone))
  132. if ARGS[1] < 0:
  133. result = 100
  134. elseif ARGS[1] <= 15:
  135. result = ((ARGS[1]*14)+100)
  136. elseif ARGS[1] <= 20:
  137. result = (((ARGS[1]-15)*16)+310)
  138. elseif ARGS[1] <= 25:
  139. result = (((ARGS[1]-20)*18)+390)
  140. elseif ARGS[1] <= 30:
  141. result = (((ARGS[1]-25)*22)+480)
  142. elseif ARGS[1] <= 35:
  143. result = (((ARGS[1]-30)*24)+590)
  144. elseif ARGS[1] <= 40:
  145. result = (((ARGS[1]-35)*28)+710)
  146. elseif ARGS[1] <= 45:
  147. result = (((ARGS[1]-40)*30)+850)
  148. elseif ARGS[1] <= 50:
  149. result = (((ARGS[1]-45)*36)+1000)
  150. elseif ARGS[1] <= 55:
  151. result = (((ARGS[1]-50)*38)+1180)
  152. elseif ARGS[1] <= 60:
  153. result = (((ARGS[1]-55)*42)+1370)
  154. elseif ARGS[1] <= 65:
  155. result = (((ARGS[1]-60)*46)+1580)
  156. elseif ARGS[1] <= 70:
  157. result = (((ARGS[1]-65)*50)+1810)
  158. elseif ARGS[1] <= 75:
  159. result = (((ARGS[1]-70)*56)+2060)
  160. elseif ARGS[1] <= 80:
  161. result = (((ARGS[1]-75)*60)+2340)
  162. elseif ARGS[1] <= 85:
  163. result = (((ARGS[1]-80)*72)+2640)
  164. elseif ARGS[1] > 85:
  165. result = (((ARGS[1]-85)*84)+3000)
  166. else
  167. result = 100
  168. end
  169. end
  170. if $ARGS[0] = 'bccmtosize':
  171. !! backwardsfunction of bsizetoccm. It just reverts breast ccm to "nbsize + magicf2b + silicone"
  172. !! func('lact_lib','bccmtosize',lactation['breastccm'])
  173. if ARGS[1] < 0:
  174. result = 0
  175. elseif ARGS[1] <= 310:
  176. result = ((ARGS[1] - 100)/14)
  177. elseif ARGS[1] <= 390:
  178. result = (((ARGS[1] - 310)/16)+15)
  179. elseif ARGS[1] <= 480:
  180. result = (((ARGS[1] - 390)/18)+20)
  181. elseif ARGS[1] <= 590:
  182. result = (((ARGS[1] - 480)/22)+25)
  183. elseif ARGS[1] <= 710:
  184. result = (((ARGS[1] - 590)/24)+30)
  185. elseif ARGS[1] <= 850:
  186. result = (((ARGS[1] - 710)/28)+35)
  187. elseif ARGS[1] <= 1000:
  188. result = (((ARGS[1] - 850)/30)+40)
  189. elseif ARGS[1] <= 1180:
  190. result = (((ARGS[1] - 1000)/36)+45)
  191. elseif ARGS[1] <= 1370:
  192. result = (((ARGS[1] - 1180)/38)+50)
  193. elseif ARGS[1] <= 1580:
  194. result = (((ARGS[1] - 1370)/42)+55)
  195. elseif ARGS[1] <= 1810:
  196. result = (((ARGS[1] - 1580)/46)+60)
  197. elseif ARGS[1] <= 2060:
  198. result = (((ARGS[1] - 1810)/50)+65)
  199. elseif ARGS[1] <= 2340:
  200. result = (((ARGS[1] - 2060)/56)+70)
  201. elseif ARGS[1] <= 2640:
  202. result = (((ARGS[1] - 2340)/60)+75)
  203. elseif ARGS[1] <= 3000:
  204. result = (((ARGS[1] - 2640)/72)+80)
  205. elseif ARGS[1] > 3000:
  206. result = (((ARGS[1] - 3000)/84)+85)
  207. else
  208. result = 0
  209. end
  210. end
  211. !! 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.
  212. if $ARGS[0] = 'breastrecalc':
  213. !! use func('lact_lib','breastrecalc')
  214. lactation['breastccm'] = func('lact_lib','bsizetoccm',(nbsize + magicf2b + silicone))
  215. if lactation['breastccm'] <= 0: lactation['breastccm'] = 1
  216. lactation['nbsizepercent'] = (nbsize*100/(nbsize + magicf2b + silicone)*100)/100
  217. lactation['magicf2bpercent'] = (magicf2b*100/(nbsize + magicf2b + silicone)*100)/100
  218. lactation['siliconepercent'] = (silicone*100/(nbsize + magicf2b + silicone)*100)/100
  219. lactation['magicf2bpercent_wos'] = (magicf2b*100/(nbsize + magicf2b)*100)/100
  220. lactation['breastuseabletissue'] = ((lactation['nbsizepercent'] + lactation['magicf2bpercent'])*lactation['breastccm'])/100
  221. lactation['breastsiliconeccm'] = (lactation['siliconepercent']*lactation['breastccm'])/100
  222. if lactation['alveolicount'] > 0:
  223. lactation['breastglandtissue']= (lactation['alveolicount'] * (218 + (lactation['alveoliexpandlvl'] * 20)))/100000
  224. else
  225. if lactation['breastdensitytype'] = 1:
  226. lactation['breastglandtissue'] = (lactation['breastuseabletissue']*17)/100
  227. lactation['breastdensitypercent'] = 17
  228. elseif lactation['breastdensitytype'] = 2:
  229. lactation['breastglandtissue'] = (lactation['breastuseabletissue']*36)/100
  230. lactation['breastdensitypercent'] = 36
  231. elseif lactation['breastdensitytype'] = 3:
  232. lactation['breastglandtissue'] = (lactation['breastuseabletissue']*55)/100
  233. lactation['breastdensitypercent'] = 55
  234. elseif lactation['breastdensitytype'] = 4:
  235. lactation['breastglandtissue'] = (lactation['breastuseabletissue']*74)/100
  236. lactation['breastdensitypercent'] = 74
  237. elseif lactation['breastdensitytype'] = 5:
  238. lactation['breastglandtissue'] = (lactation['breastuseabletissue']*93)/100
  239. lactation['breastdensitypercent'] = 93
  240. end
  241. if lactation['active'] <= 0:
  242. lactation['alveolicount'] = ((lactation['breastglandtissue']*100000)/218)
  243. lactation['alveoliexpandlvl'] = 0
  244. lactation['breastmm'] = 0
  245. lactation['breastmv'] = 0
  246. lactation['lactaterate'] = 0
  247. if pcs_nips > lactation['nipgrowth']: pcs_nips -= lactation['nipgrowth']
  248. lactation['nipgrowth'] = 0
  249. else
  250. lactation['alveolicount'] = ((lactation['breastglandtissue']*100000)/418)
  251. lactation['alveoliexpandlvl'] = 10
  252. lactation['nipgrowth'] = 2
  253. func('lact_lib','set_breastmm')
  254. if lactation['prolactinlvl'] < 200: lactation['prolactinlvl'] = 200
  255. lactation['lactaterate'] = 1000*(lactation['prolactinlvl']/200)
  256. lactation['breastmv'] = 0
  257. lactation['nipgrowth'] = 2
  258. pcs_nips += lactation['nipgrowth']
  259. end
  260. end
  261. lactation['breastfat'] = lactation['breastuseabletissue'] - lactation['breastglandtissue']
  262. end
  263. if $ARGS[0] = 'breastgrowthcalc':
  264. !! 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.
  265. lactation['breastglandtissue']= (lactation['alveolicount'] * (218 + (lactation['alveoliexpandlvl'] * 20)))/100000
  266. !! Crazy Math going on here. When I was coding this, only god and I knew what I was doing. Now only god knows.
  267. !! Well actually, this one recalculates all the CCM stuff to normal nbsize, magicf2b and silicone. It works, no idea why, but it works.
  268. lactation['breastccm'] = (lactation['breastglandtissue'] + lactation['breastfat'] + lactation['breastsiliconeccm'])
  269. lactation['siliconepercent'] = ((lactation['breastsiliconeccm']*100)/lactation['breastccm'])
  270. lactation['magicf2bccm'] = ((lactation['breastccm'] - ((lactation['breastccm']*lactation['siliconepercent'])/100))*lactation['magicf2bpercent_wos'])/100
  271. lactation['nbsizebccm'] = lactation['breastccm'] - lactation['breastsiliconeccm'] - lactation['magicf2bccm']
  272. lactation['nbsizepercent'] = ((lactation['nbsizebccm']*100)/lactation['breastccm'])
  273. lactation['magicf2bpercent'] = ((lactation['magicf2bccm']*100)/lactation['nbsizebccm'])
  274. nbsize = (func('lact_lib','bccmtosize',lactation['breastccm'])*lactation['nbsizepercent'])/100
  275. magicf2b = (func('lact_lib','bccmtosize',lactation['breastccm'])*lactation['magicf2bpercent'])/100
  276. lactation['nbsizechange'] = nbsize
  277. lactation['magicf2bchange'] = magicf2b
  278. lactation['siliconechange'] = silicone
  279. end
  280. !! 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
  281. if $ARGS[0] = 'BreastGrowth':
  282. !! usage func('lact_lib','BreastGrowth')
  283. !! Checking for variable errors, and re-initializing breastccm or alveolicount
  284. if lactation['breastccm'] <= 0 or lactation['alveolicount'] <= 0:
  285. lactation['breasttissueinitiated'] = 0
  286. func('lact_lib','init_breasttissue')
  287. end
  288. !! things will start if breastccm is different from bust/cup size (mostly due to other events or cheating) or if the mammaryglands change due to breastpumping or pregnancy.
  289. if lactation['breastccm'] <> func('lact_lib','bsizetoccm',(nbsize + magicf2b + silicone)) or lactation['alveolicount_change'] <> lactation['alveolicount'] or lactation['alveoliexpandlvl_change'] <> lactation['alveoliexpandlvl']:
  290. !! 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.
  291. !! 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.
  292. !! first - check for alveoligrowth: yes, do the crazy stuff
  293. !! second - check for nbsize, magicf2b and silicone change
  294. !! there is no else on purpose, because nothing should happen to svetas breasts if nothing else changes
  295. if lactation['alveolicount_change'] <> lactation['alveolicount'] or lactation['alveoliexpandlvl_change'] <> lactation['alveoliexpandlvl']:
  296. func('lact_lib','breastgrowthcalc')
  297. elseif (lactation['nbsizechange'] + lactation['siliconechange'] + lactation['magicf2bchange']) <> (nbsize + magicf2b + silicone):
  298. func('lact_lib','breastrecalc')
  299. else
  300. end
  301. end
  302. end
  303. !! 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.
  304. !! Breastcount can be changed later on if someone comes up with multibreasts or breast amputation.
  305. if $ARGS[0] = 'set_breastmm':
  306. lactation['breastmm'] = (lactation['alveolicount']*2)*lactation['breastcount']
  307. end
  308. !! Just a function used for debugging. Can be deleted if not needed anymore.
  309. if $ARGS[0] = 'show_breast_stat':
  310. !! func('lact_lib','show_breast_stat')
  311. 'lactation[''breastcount''] = <<lactation[''breastcount'']>>'
  312. 'lactation[''breasttissueinitiated''] = <<lactation[''breasttissueinitiated'']>>'
  313. 'lactation[''breastccm''] = <<lactation[''breastccm'']>>'
  314. 'lactation[''maturebreast''] = <<lactation[''maturebreast'']>>'
  315. 'lactation[''alveolicount''] = <<lactation[''alveolicount'']>>'
  316. 'lactation[''prolactinlvl''] = <<lactation[''prolactinlvl'']>>'
  317. 'lactation[''dailyoverdemand''] = <<lactation[''dailyoverdemand'']>>'
  318. 'lactation[''alveoliexpandlvl''] = <<lactation[''alveoliexpandlvl'']>>'
  319. 'lactation[''active''] = <<lactation[''active'']>>'
  320. 'lactation[''lactaterate''] = <<lactation[''lactaterate'']>>'
  321. 'lactation[''breastmm''] = <<lactation[''breastmm'']>>'
  322. 'lactation[''breastmv''] = <<lactation[''breastmv'']>>'
  323. end
  324. !! milk production function
  325. if $ARGS[0] = 'prod_milk':
  326. !! function for Svetas milk production. Milk production will cost stamina, hydration, and hunger. this function is used in breastcycle
  327. !! I know, pretty complex for just making breast milk, but hey - life is complex :D
  328. !! func('lact_lib','prod_milk',milkamount)
  329. !! result = produced breast milk amount in ml*1000
  330. !! ARGS[1] = Requested milk production amount produced in ml*1000. Usually should be the lactaterate.
  331. !! If there was milk pumped or produced during the hour, this has to be substracted.
  332. if lactation['used_lactaterate'] > 0:
  333. lactation['prod_milk_req'] = (ARGS[1] - lactation['used_lactaterate'])
  334. lactation['used_lactaterate'] += ARGS[1]
  335. if lactation['used_lactaterate'] > lactation['lactaterate']: lactation['used_lactaterate'] = lactation['lactaterate']
  336. else
  337. lactation['prod_milk_req'] = ARGS[1]
  338. lactation['used_lactaterate'] += ARGS[1]
  339. if lactation['used_lactaterate'] > lactation['lactaterate']: lactation['used_lactaterate'] = lactation['lactaterate']
  340. end
  341. !! 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.
  342. if lactation['active'] > 0 and salo > 15:
  343. !! checking how much hydration, stamina and hunger is needed to produce x amount of breast milk
  344. !! checking if enough stamina and hydra is available
  345. if (lactation['prod_milk_req']/10000) < pcs_stam and (lactation['prod_milk_req']/10000) < pcs_hydra:
  346. !! full requested milk amount can be produced. substracting from stamina, hydration energy.
  347. if (lactation['prod_milk_req']/10000) < 1:
  348. pcs_stam -= 1
  349. pcs_hydra -= 1
  350. else
  351. pcs_stam -= (lactation['prod_milk_req']/10000)
  352. pcs_hydra -= (lactation['prod_milk_req']/10000)
  353. end
  354. if pcs_stam < 1: pcs_stam = 1
  355. if pcs_hydra < 1: pcs_hydra = 1
  356. if (lactation['prod_milk_req']/9000) < pcs_energy:
  357. if (lactation['prod_milk_req']/9000) < 1:
  358. pcs_energy -= 1
  359. else
  360. pcs_energy -= (lactation['prod_milk_req']/9000)
  361. if pcs_energy < 1: pcs_energy = 1
  362. end
  363. result = lactation['prod_milk_req']
  364. else
  365. !! If energy is too low, milk will be produced but there is a chance that salo will shrink.
  366. pcs_energy = 1
  367. if rand(0,100) > 95: salo -= 1
  368. if pain['breasts'] < 20: pain['breasts'] += 1
  369. result = lactation['prod_milk_req']
  370. end
  371. elseif pcs_stam <= 0 or pcs_hydra <= 0:
  372. !! if sveta has not enough hydration or stamina, no milk is produced.
  373. result = 0
  374. else
  375. if (pcs_stam*10000) < (pcs_hydra*10000):
  376. lactation['prod_milk_temp_var'] = (pcs_stam*10000)
  377. pcs_stam = 1
  378. if (lactation['prod_milk_req']/10000) < pcs_hydra:
  379. pcs_hydra -= (lactation['prod_milk_req']/10000)
  380. else
  381. pcs_hydra = 1
  382. end
  383. else
  384. lactation['prod_milk_temp_var'] = (pcs_hydra*10000)
  385. pcs_hydra = 1
  386. if (lactation['prod_milk_req']/10000) < pcs_stam:
  387. pcs_stam -= (lactation['prod_milk_req']/10000)
  388. else
  389. pcs_stam = 1
  390. end
  391. end
  392. if (lactation['prod_milk_temp_var']/9000) < pcs_energy:
  393. if (lactation['prod_milk_temp_var']/9000) < 1:
  394. pcs_energy -= 1
  395. else
  396. pcs_energy -= (lactation['prod_milk_temp_var']/9000)
  397. if pcs_energy < 1: pcs_energy = 1
  398. end
  399. else
  400. !! If energy is too low, milk will be produced but there is a chance that salo will shrink.
  401. pcs_energy = 1
  402. if rand(0,100) > 95: salo -= 1
  403. if pain['breasts'] < 20: pain['breasts'] += 1
  404. end
  405. if pcs_energy < 1: pcs_energy = 1
  406. if pcs_hydra < 1: pcs_hydra = 1
  407. if pcs_stam < 1: pcs_stam = 1
  408. result = lactation['prod_milk_temp_var']
  409. end
  410. else
  411. result = 0
  412. end
  413. end
  414. !! breast status messages - for use in stat_display. Explains itself basically.
  415. if $ARGS[0] = 'breast_stat_disp':
  416. !! breast status
  417. if lactation['active'] <= 0:
  418. if lactation['growthsoreness_on'] > 0: $stat_msg += '<BR>'+iif(night_mode > 0,'<font color = white>','<font color = black>')+'Your breasts feel sore and swollen.</font><BR>'
  419. elseif lactation['active'] > 0 and lactation['pc_aware'] > 0:
  420. if lactation['engorgement'] > 0 and lactation['lactmess'] < 1:
  421. $stat_msg += '<BR><font color = orange>Your breasts are so full they hurt.</font><BR>'
  422. elseif lactation['engorgement'] > 0 and lactation['lactmess'] < 3 and $clothingworntype = 'nude':
  423. $stat_msg += '<BR><font color = red>Your breasts are so full they hurt and you can feel milk seeping out, causing you to have a little milk residue around your nipples.</font><BR>'
  424. elseif lactation['engorgement'] > 0 and lactation['lactmess'] < 6 and $clothingworntype = 'nude':
  425. $stat_msg += '<BR><font color = red>Your breasts are so full they hurt and you can feel your milk comming out causing you to have a lot of milk around your nipples.</font><BR>'
  426. elseif lactation['engorgement'] > 0 and lactation['lactmess'] >= 6 and $clothingworntype = 'nude':
  427. $stat_msg += '<BR><font color = red>Your breasts are so full they hurt and you can feel your milk spraying out. Your breasts covered with your breast milk.</font><BR>'
  428. elseif lactation['engorgement'] > 0 and lactation['lactmess'] < 3:
  429. $stat_msg += '<BR><font color = red>Your breasts are so full they hurt and you can feel milk seeping out, causing small wet spots on your top.</font><BR>'
  430. elseif lactation['engorgement'] > 0 and lactation['lactmess'] < 6:
  431. $stat_msg += '<BR><font color = red>Your breasts are so full they hurt and you can feel your milk comming out making visible wet circles on your top.</font><BR>'
  432. elseif lactation['engorgement'] > 0 and lactation['lactmess'] >= 6:
  433. $stat_msg += '<BR><font color = red>Your breasts are so full they hurt and you can feel your milk spraying out. Your top is drenched with your breast milk.</font><BR>'
  434. elseif lactation['engorgement'] < 1 and lactation['breastmv'] > lactation['breastmm']*9/10:
  435. $stat_msg += '<BR>'+iif(night_mode > 0,'<font color = white>','<font color = black>')+'Your breasts are firm and full from your milk.</font><BR>'
  436. elseif lactation['engorgement'] < 1 and lactation['breastmv'] > lactation['breastmm']/2:
  437. $stat_msg += '<BR>'+iif(night_mode > 0,'<font color = white>','<font color = black>')+'Your breasts are heavy with your milk.</font><BR>'
  438. elseif lactation['engorgement'] < 1 and lactation['breastmv'] > lactation['breastmm']/4:
  439. $stat_msg += '<BR>'+iif(night_mode > 0,'<font color = white>','<font color = black>')+'Your breasts feel slightly heavy from the milk inside.</font><BR>'
  440. elseif lactation['engorgement'] < 1 and lactation['breastmv'] > 0:
  441. $stat_msg += '<BR>'+iif(night_mode > 0,'<font color = white>','<font color = black>')+'Your feel an easy pressure in your breasts from your milk.</font><BR>'
  442. end
  443. elseif lactation['active'] > 0 and lactation['pc_aware'] < 1:
  444. if lactation['engorgement'] > 0 and lactation['lactmess'] < 1:
  445. $stat_msg += '<BR><font color = orange>Your breasts hurt with pressure in them.</font><BR>'
  446. elseif lactation['engorgement'] > 0 and lactation['lactmess'] < 3 and $clothingworntype = 'nude':
  447. $stat_msg += '<BR><font color = red>Your breasts hurt and your nipples are wet.</font><BR>'
  448. elseif lactation['engorgement'] > 0 and lactation['lactmess'] < 6 and $clothingworntype = 'nude':
  449. $stat_msg += '<BR><font color = red>Your breasts hurt and they feel wet, some white liquid around your nipples.</font><BR>'
  450. elseif lactation['engorgement'] > 0 and lactation['lactmess'] >= 6 and $clothingworntype = 'nude':
  451. $stat_msg += '<BR><font color = red>Your breasts hurt and a white liquid is spraying out, covering your breasts.</font><BR>'
  452. elseif lactation['engorgement'] > 0 and lactation['lactmess'] < 3:
  453. $stat_msg += '<BR><font color = red>Your breasts hurt and your nipples tingle a little. There are small wet spots on your top.</font><BR>'
  454. elseif lactation['engorgement'] > 0 and lactation['lactmess'] < 6:
  455. $stat_msg += '<BR><font color = red>Your breasts hurt and your nipples tingle. There are visible wet circles on your top.</font><BR>'
  456. elseif lactation['engorgement'] > 0 and lactation['lactmess'] >= 6:
  457. $stat_msg += '<BR><font color = red>Your breasts hurt and your nipples tingle a lot. Your top is drenched with a warm liquid.</font><BR>'
  458. elseif lactation['engorgement'] < 1 and lactation['breastmv'] > lactation['breastmm']*9/10:
  459. $stat_msg += '<BR>'+iif(night_mode > 0,'<font color = white>','<font color = black>')+'Your breasts feel firm and under pressure.</font><BR>'
  460. elseif lactation['engorgement'] < 1 and lactation['breastmv'] > lactation['breastmm']/2:
  461. $stat_msg += '<BR>'+iif(night_mode > 0,'<font color = white>','<font color = black>')+'Your breasts feel heavy.</font><BR>'
  462. elseif lactation['engorgement'] < 1 and lactation['breastmv'] > lactation['breastmm']/4:
  463. $stat_msg += '<BR>'+iif(night_mode > 0,'<font color = white>','<font color = black>')+'Your breasts feel slightly heavy.</font><BR>'
  464. elseif lactation['engorgement'] < 1 and lactation['breastmv'] > 0:
  465. $stat_msg += '<BR>'+iif(night_mode > 0,'<font color = white>','<font color = black>')+'Your feel an easy pressure in your breasts.</font><BR>'
  466. end
  467. end
  468. end
  469. !! function for breast engorment, used in breastcycle
  470. if $ARGS[0] = 'breast_engorment':
  471. !! relatively easy. if the breasts get full, engorgement will happen.
  472. if lactation['breastmv'] >= lactation['breastmm']:
  473. temp_var = lactation['breastmv'] - lactation['breastmm']
  474. lactation['breastmv'] = lactation['breastmm']
  475. if temp_var < 1000 and temp_var > 0:
  476. lactation['engorgement'] = 0
  477. elseif temp_var < 3000 and temp_var >= 1000:
  478. lactation['engorgement'] = 1
  479. lactation['lactmess'] += 1
  480. elseif temp_var < 10000 and temp_var >= 3000:
  481. lactation['engorgement'] = 1
  482. lactation['lactmess'] += 2
  483. elseif temp_var >= 10000:
  484. lactation['engorgement'] = 1
  485. lactation['lactmess'] += 3
  486. end
  487. else
  488. lactation['engorgement'] = 0
  489. if lactation['lactmess'] > 1:
  490. lactation['lactmess'] -= 2
  491. if lactation['lactmess'] < 0: lactation['lactmess'] = 0
  492. end
  493. end
  494. end
  495. !! Lactation On/Off switch function
  496. if $ARGS[0] = 'lact_switch':
  497. !! Usage func('lact_lib','lact_switch')
  498. if lactation['active'] <= 0:
  499. !! 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.
  500. lactation['pc_aware'] = 0
  501. !! setting lactation to active
  502. lactation['active'] = 1
  503. !! setting breast maximum milk volume via function
  504. func('lact_lib','set_breastmm')
  505. !! resetting prolactinlvl so that the initial production rate is not too high
  506. if lactation['prolactinlvl'] < 200: lactation['prolactinlvl'] = 200
  507. !! setting the lactation rate. Warning! lactation rate is in ml*1000 now for higher accuracy.
  508. lactation['lactaterate'] = 1000*(lactation['prolactinlvl']/200)
  509. !! setting milk volume in breasts to 0. Will fill up with lactaterate in another part of the breastcycle
  510. lactation['breastmv'] = 0
  511. !! nipples will grow a bit with extended milk channels. If lactation stops, this will be substracted from the nipples again and nipples will shrink.
  512. lactation['nipgrowth'] = 2
  513. pcs_nips += lactation['nipgrowth']
  514. if lactation['alveoliexpandlvl'] < 10: lactation['alveoliexpandlvl'] = 10
  515. if lactation['alveoliexpandlvl_change'] < 9: lactation['alveoliexpandlvl_change'] = 9
  516. lactation['milkprod_type'] = 1
  517. else
  518. !! If lactation is on, the stuff below will switch it off again.
  519. lactation['active'] = 0
  520. lactation['lactaterate'] = 0
  521. lactation['breastmv'] = 0
  522. lactation['breastmm'] = 0
  523. lactation['alveoliexpandlvl'] = 0
  524. lactation['alveoliexpandlvl_change'] = 1
  525. lactation['prolactinlvl'] = 0
  526. if pcs_nips > lactation['nipgrowth']: pcs_nips -= lactation['nipgrowth']
  527. lactation['nipgrowth'] = 0
  528. end
  529. !! Always trigger the breastcycle after breast change, or the changes to svetas breasts will not happen.
  530. func('lact_lib','breastcycle')
  531. end
  532. !! new breast cycle function, replaced the monster lactation function in femcyc
  533. if $ARGS[0] = 'breastcycle':
  534. if lactation['breasttissueinitiated'] <= 0: func('lact_lib','init_breasttissue')
  535. !! usage func('lact_lib','breastcycle')
  536. !! if lactating or not, breasts will grow during pregnancy. This will only happen during first full pregnancy
  537. if pregchem => 2191 and lactation['maturebreast'] <= 0:
  538. !! Alveoligrowth/breastgrowth + 78876 new aveoli per breast average during pregnancy
  539. !! Checking pregchem last. It should not be small than 0.
  540. if lactation['pregchemlast'] <= 0:
  541. lactation['pregchemlast'] = 2191
  542. lactation['preggrowth'] = 0
  543. end
  544. if lactation['preggrowth'] <= 78876 and (pregchem - lactation['pregchemlast']) >= 0:
  545. lactation['preggrowth'] = (pregchem - 2191) * 36
  546. lactation['alveolicount'] = lactation['alveolicount_start'] + lactation['preggrowth']
  547. lactation['growthsoreness_on'] = 1
  548. if pain['breasts'] <= 20: pain['breasts'] = 20
  549. else
  550. lactation['growthsoreness_on'] = 0
  551. lactation['maturebreast'] = 1
  552. end
  553. lactation['pregchemlast'] = pregchem
  554. elseif PregChem > 4383 and lactation['maturebreast'] > 0:
  555. !! pregnancy prolactinlvl rise
  556. if lactation['prolactinlvl'] < 200 and lactation['active'] <= 0:
  557. if rand(0,100) > 25:
  558. lactation['prolactinlvl'] +=1
  559. end
  560. end
  561. end
  562. !! checking for prolactin and if svetas breasts were worked (e.g. breast stimulation via massage, pumps, by mouth, or whatever)
  563. if lactation['active'] <= 0:
  564. !! prolactinlvl calculation. If sveta never was pregnant, prolactinlvl will grow slower
  565. if lactation['milkgrowday'] < daystart:
  566. if (lactation['dailyoverdemand']/200) <= 0 and lactation['dailyoverdemand'] > 0:
  567. lactation['prolactinlvl'] += 1
  568. elseif (lactation['dailyoverdemand']/200) >= 10 and lactation['maturebreast'] <= 0:
  569. lactation['prolactinlvl'] += 10
  570. elseif (lactation['dailyoverdemand']/200) >= 50 and lactation['maturebreast'] > 0:
  571. lactation['prolactinlvl'] += 50
  572. else
  573. if lactation['prolactinlvl'] > 0 and pregchem < 2191:
  574. if ((lactation['prolactinlvl']/2) + (lactation['prolactinlvl']/5) - (lactation['prolactinlvl']/8)) < 1:
  575. lactation['prolactinlvl'] -= 1
  576. else
  577. lactation['prolactinlvl'] -= ((lactation['prolactinlvl']/2) + (lactation['prolactinlvl']/5) - (lactation['prolactinlvl']/8))
  578. end
  579. end
  580. end
  581. end
  582. if lactation['prolactinlvl'] > 200: lactation['prolactinlvl'] = 200
  583. !! expand level cannot be over 5
  584. if lactation['alveoliexpandlvl'] > 10: lactation['alveoliexpandlvl'] = 10
  585. !! Breast growth due to mammarygland expansion. Happens if prolactin level is high enough and will cause breastsoreness.
  586. !! If prolactinlvl lowers, milkglands will shrink again.
  587. if lactation['milkgrowday'] < daystart and lactation['prolactinlvl'] >= 100 and lactation['alveoliexpandlvl'] < 10:
  588. lactation['alveoliexpandlvl_change'] = lactation['alveoliexpandlvl']
  589. lactation['alveoliexpandlvl'] += 1
  590. lactation['growthsoreness_on'] = 1
  591. if pain['breasts'] <= 20: pain['breasts'] = 20
  592. elseif lactation['milkgrowday'] < daystart and lactation['prolactinlvl'] < 100 and lactation['alveoliexpandlvl'] > 0:
  593. lactation['alveoliexpandlvl_change'] = lactation['alveoliexpandlvl']
  594. lactation['alveoliexpandlvl'] -= 1
  595. lactation['growthsoreness_on'] = 1
  596. if pain['breasts'] <= 20: pain['breasts'] = 20
  597. end
  598. !! 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
  599. if rand(1,50) + lactation['prolactinlvl'] >= rand(200,250) and lactation['alveoliexpandlvl'] >= 10:
  600. func('lact_lib','lact_switch')
  601. end
  602. else
  603. !! things that happen when Sveta is lactating lactation['active'] > 1
  604. if lactation['milkgrowday'] < daystart:
  605. !! 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.
  606. !! funny parabelfunction for the lactrategrowth > 65 - ((1/1466)*((lactrate-304)*(lactrate-304)))
  607. lactation['prolactinlvl'] += (lactation['dailyoverdemand']/10000)
  608. if lactation['dailyoverdemand'] > 0 and lactation['breastpumped'] >= 0:
  609. lactation['max_lactrate_growth'] = (65 - ((((lactation['lactaterate']/1000) - 304)*((lactation['lactaterate']/1000) - 304))/1466))*1000
  610. if lactation['max_lactrate_growth'] < ((10*lactation['prolactinlvl'])/2) and lactation['max_lactrate_growth'] >= 1000:
  611. lactation['lactaterate'] += lactation['max_lactrate_growth']
  612. elseif lactation['max_lactrate_growth'] < ((10*lactation['prolactinlvl'])/2) and lactation['max_lactrate_growth'] < 1000:
  613. lactation['lactaterate'] += 1000
  614. else
  615. lactation['lactaterate'] += (10*lactation['prolactinlvl'])/2
  616. end
  617. lactation['prolactinlvl'] = 100
  618. elseif lactation['dailyoverdemand'] <= 0 and lactation['breastpumped'] > 0:
  619. !! If there was no milk overdemand, sveta will keep her lactationrate level.
  620. lactation['prolactinlvl'] = 100
  621. lactation['dailyoverdemand'] = 0
  622. lactation['breastpumped'] = 0
  623. else
  624. !! 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)
  625. lactation['dailyoverdemand'] = 0
  626. lactation['breastpumped'] = 0
  627. if lactation['lactaterate'] > 0:
  628. !! lactation rate is dropping with below function.
  629. lactation['prolactinlvl'] = 100
  630. if ((lactation['lactaterate']/2) + (lactation['lactaterate']/5) - (lactation['lactaterate']/8)) < 1:
  631. lactation['lactaterate'] -= 1
  632. else
  633. lactation['lactaterate'] = (lactation['lactaterate'] - (lactation['lactaterate']/2) + (lactation['lactaterate']/5) - (lactation['lactaterate']/8))
  634. end
  635. elseif lactation['lactaterate'] <= 0 and lactation['maturebreast'] > 0 and pregchem >= 4383:
  636. !! during pregnancy lactation is not switched off. Svetas breasts will always produce a bit off milk
  637. lactation['lactaterate'] = 10
  638. elseif lactation['lactaterate'] <= 0:
  639. !! switching off lactation production and making sure prolactin is dropping. Nipples shrink too. There are some changes that are permanent, especially during pregnancy.
  640. func('lact_lib','lact_switch')
  641. end
  642. end
  643. end
  644. !! Filling milk into svetas breast every hour and checking for breastengorgement
  645. if lactation['breastmv'] < lactation['breastmm'] and lactation['lactaterate'] > 50 and lactation['milkprod_type'] = 1:
  646. lactation['breastmv'] += func('lact_lib','prod_milk',lactation['lactaterate'])
  647. elseif lactation['breastmv'] < lactation['breastmm'] and lactation['lactaterate'] > 50 and lactation['milkprod_type'] = 0:
  648. lactation['breastmv'] += lactation['lactaterate']
  649. if lactation['breastmv'] > lactation['breastmm']: lactation['breastmv'] = lactation['breastmm']
  650. end
  651. !! Reset used_lactaterate, so milk can be produced again.
  652. lactation['used_lactaterate'] = 0
  653. func('lact_lib','breast_engorment')
  654. end
  655. if lactation['milkgrowday'] < daystart:
  656. func('lact_lib','BreastGrowth')
  657. lactation['dailyoverdemand'] = 0
  658. lactation['alveolicount_change'] = lactation['alveolicount']
  659. lactation['milkgrowday'] = daystart
  660. end
  661. end
  662. !! Used for switching off all lactation related content
  663. if $ARGS[0] = 'lactate_optout':
  664. !! usage 1: func('lact_lib','lactate_optout')
  665. !! usage 2: gs 'lact_lib','lactate_optout'
  666. if lactation['active'] > 0:
  667. func('lact_lib','lact_switch')
  668. end
  669. lactation['active'] = 0
  670. lactation['prolactinlvl'] = 0
  671. lactation['lactmess'] = 0
  672. lactation['engorgement'] = 0
  673. lactation['breastmv'] = 0
  674. lactation['breastmm'] = 0
  675. lactation['lactaterate'] = 0
  676. lactation['dailyoverdemand'] = 0
  677. end
  678. !! get suckflow rate function
  679. if $ARGS[0] = 'get_suckflowrate':
  680. !! lactation['suck_flow_rate'] = func('lact_lib','get_suckflowrate', sucktion_type)
  681. !! 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.
  682. !! 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]
  683. !! what type of sucktion is happening? different sucktion can cause a different demand of breastmilk.
  684. !! Result is base rate of sucktion 10ml/minute x 1000. So if the sucktion rate is 10ml/min then suck_flow_rate = 10000.
  685. if ARGS[1] = 0:
  686. !! 'adult sucking'
  687. result = 12000
  688. elseif ARGS[1] = 1:
  689. !! 'child sucking'
  690. result = 11000
  691. elseif ARGS[1] = 2:
  692. !! 'baby sucking'
  693. result = 8000
  694. elseif ARGS[1] = 3:
  695. !! 'manual_breastpump sucking'
  696. result = 18000
  697. elseif ARGS[1] = 4:
  698. !! 'electric_breastpump sucking'
  699. result = 40000
  700. elseif ARGS[1] = 5:
  701. !! 'hand expression'
  702. result = 10500
  703. elseif ARGS[1] = 6:
  704. !! 'cow milker sucking'
  705. result = 100000
  706. elseif ARGS[1] = 7:
  707. !! 'weak baby sucking'
  708. result = 5000
  709. elseif ARGS[1] = 8:
  710. !! 'manual stimulation during sex/sex play'
  711. result = 6000
  712. else
  713. !! 'suck flow else branch'
  714. result = 10000
  715. end
  716. end
  717. !! get max nipple flow rate function
  718. if $ARGS[0] = 'get_maxnipflowrate':
  719. !! lactation['max_nip_flow_rate'] = func('lact_lib','get_maxnipflowrate')
  720. !! How much milk can be sucked out through svetas nipples per minute.
  721. !! Result is base rate is 10ml/minute x 1000.
  722. !! Calculating the nip flow mod. The more svetas breasts were worked/sucked, the more milk can go through her nipples. Max cap is at 9000 (9ml/min).
  723. lactation['nip_flow_mod'] = breastcounter * 100
  724. !! IT IS OVER 9000!
  725. if lactation['nip_flow_mod'] > 9000: lactation['nip_flow_mod'] = 9000
  726. !! y = 100x + 6000 linear growth for the nip flowrate
  727. if pcs_nips > 0:
  728. result = ((100*pcs_nips) + 6000 + lactation['nip_flow_mod'])
  729. else
  730. result = (6000 + lactation['nip_flow_mod'])
  731. end
  732. end
  733. !! get mood modification
  734. if $ARGS[0] = 'get_moodmod':
  735. !! during breastfeeding or pumping or whatever, svetas mood can be pushed up.
  736. !! pcs_mood += func('lact_lib','get_maxnipflowrate', sucktion type, sucktion time)
  737. !! 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]
  738. !! Result = additional mood
  739. if ARGS[1] = 0:
  740. !! 'adult sucking'
  741. lactation['moodmod'] = ARGS[2]/8
  742. elseif ARGS[1] = 1:
  743. !! 'child sucking'
  744. lactation['moodmod'] = ARGS[2]/2
  745. elseif ARGS[1] = 2:
  746. !! 'baby sucking'
  747. lactation['moodmod'] = ARGS[2]
  748. elseif ARGS[1] = 7:
  749. !! 'weak baby sucking'
  750. lactation['moodmod'] = ARGS[2]
  751. else
  752. lactation['moodmod'] = 0
  753. end
  754. if lactation['active'] <= 0: lactation['moodmod'] = (lactation['moodmod']/2)
  755. if (lactation['moodmod'] + pcs_mood) > 100:
  756. result = (100 - pcs_mood)
  757. else
  758. result = lactation['moodmod']
  759. end
  760. end
  761. !! get soreness_mod
  762. if $ARGS[0] = 'get_sorenessmod':
  763. !! lactation['soreness_mod'] = func('lact_lib','get_sorenessmod')
  764. if lactation['nipple_cream_applied'] > 0:
  765. lactation['nipple_cream_applied'] = 0
  766. if (breastcounter/10) > 20:
  767. result = 40
  768. elseif (breastcounter/10) <= 0:
  769. result = 20
  770. else
  771. result = ((breastcounter/10) + 20)
  772. end
  773. else
  774. if (breastcounter/10) > 20:
  775. result = 20
  776. elseif (breastcounter/10) <= 0:
  777. result = 1
  778. else
  779. result = (breastcounter/10)
  780. end
  781. end
  782. end
  783. !! get breastmilktime function
  784. if $ARGS[0] = '$get_breastmilk_time':
  785. !! func('lact_lib','$get_breastmilk_time', sucktion_type, milk_demand)
  786. !! 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]
  787. !! ARGS[2] = milk_demand: how much milk is demanded. Warning: Should be ml and not in ml*10 for ease of use. :D
  788. !! result = Time in Minutes
  789. !! Usage: breastmilktimetoget = func('lact_lib','$get_breastmilk_time', 2, 150)
  790. !! 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.
  791. !! If you want to milk sveta, use get_breastmilk.
  792. if lactation['active'] > 0:
  793. !! suck_flow_rate initialized Base Rate of sucking is 10ml/minute x 1000.
  794. lactation['suck_flow_rate'] = func('lact_lib','get_suckflowrate', ARGS[1])
  795. !! max nip flow rate initialized
  796. lactation['max_nip_flow_rate'] = func('lact_lib','get_maxnipflowrate')
  797. !! getting temp lactaterate
  798. if (lactation['lactaterate']/60) < 1 and lactation['lactaterate'] > 0:
  799. lactation['lactaterate_per_min'] = 1
  800. else
  801. lactation['lactaterate_per_min'] = lactation['lactaterate']/60
  802. end
  803. !! resetting lactation['milk_time_output'] to 0
  804. lactation['milk_time_output'] = 0
  805. !! getting breast milking time
  806. if lactation['breastmv'] >= (ARGS[2]*1000):
  807. if lactation['max_nip_flow_rate'] <= lactation['suck_flow_rate']:
  808. lactation['milk_time_output'] = (ARGS[2]*1000)/lactation['max_nip_flow_rate']
  809. else
  810. lactation['milk_time_output'] = (ARGS[2]*1000)/lactation['suck_flow_rate']
  811. end
  812. result = lactation['milk_time_output']
  813. elseif lactation['breastmv'] > 0 and lactation['breastmv'] < (ARGS[2]*1000):
  814. if lactation['max_nip_flow_rate'] <= lactation['suck_flow_rate']:
  815. lactation['milk_time_output'] = lactation['breastmv']/lactation['max_nip_flow_rate']
  816. temp_var2 = (ARGS[2]*1000) - lactation['breastmv']
  817. if lactation['max_nip_flow_rate'] <= lactation['lactaterate_per_min']:
  818. lactation['milk_time_output'] += temp_var2/lactation['max_nip_flow_rate']
  819. else
  820. lactation['milk_time_output'] += temp_var2/lactation['lactaterate_per_min']
  821. end
  822. else
  823. lactation['milk_time_output'] = lactation['breastmv']/lactation['suck_flow_rate']
  824. temp_var2 = (ARGS[2]*1000) - lactation['breastmv']
  825. if lactation['suck_flow_rate'] <= lactation['lactaterate_per_min']:
  826. lactation['milk_time_output'] += temp_var2/lactation['suck_flow_rate']
  827. else
  828. lactation['milk_time_output'] += temp_var2/lactation['lactaterate_per_min']
  829. end
  830. end
  831. result = lactation['milk_time_output']
  832. elseif lactation['breastmv'] <=0:
  833. if lactation['max_nip_flow_rate'] <= lactation['suck_flow_rate']:
  834. if lactation['max_nip_flow_rate'] <= lactation['lactaterate_per_min']:
  835. lactation['milk_time_output'] = (ARGS[2]*1000)/lactation['max_nip_flow_rate']
  836. else
  837. lactation['milk_time_output'] = (ARGS[2]*1000)/lactation['lactaterate_per_min']
  838. end
  839. else
  840. if lactation['suck_flow_rate'] <= lactation['lactaterate_per_min']:
  841. lactation['milk_time_output'] = (ARGS[2]*1000)/lactation['suck_flow_rate']
  842. else
  843. lactation['milk_time_output'] = (ARGS[2]*1000)/lactation['lactaterate_per_min']
  844. end
  845. end
  846. result = lactation['milk_time_output']
  847. else
  848. result = 0
  849. end
  850. else
  851. result = 0
  852. end
  853. end
  854. if $ARGS[0] = '$get_breastmilk':
  855. !! func('lact_lib','$get_breastmilk', sucktion_type, sucktion_time)
  856. !! 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]
  857. !! ARGS[2] = sucktion_time: how many minutes the sucking/pumping takes place
  858. !! Usage: breastmilkvolume = func('lact_lib','$get_breastmilk', 4, 20)
  859. !! result = Milk in ml*10
  860. !! 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.
  861. lactation['breastpumped'] = 1
  862. !! suck_flow_rate initialized Base Rate of sucking is 10ml/minute.
  863. lactation['suck_flow_rate'] = func('lact_lib','get_suckflowrate', ARGS[1])
  864. !! max nip flow rate initialized
  865. lactation['max_nip_flow_rate'] = func('lact_lib','get_maxnipflowrate')
  866. !! will there be a mood change?
  867. pcs_mood += func('lact_lib','get_maxnipflowrate',ARGS[1],ARGS[2])
  868. !! get soreness that will result from pumping/sucking/massaging
  869. lactation['soreness_mod'] = func('lact_lib','get_sorenessmod')
  870. !! 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.
  871. if lactation['active']<= 0:
  872. if lactation['dailyoverdemand'] <= 0: lactation['dailyoverdemand'] = 0
  873. pump_stop_brake = 0
  874. !! 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.
  875. lactation['max_sucktion_demand'] = lactation['suck_flow_rate']*ARGS[2]
  876. if pain['nipples'] <= 60:
  877. suck_until_pain = (((60 - pain['nipples'])*lactation['soreness_mod'])*1000)/(lactation['suck_flow_rate']/18)
  878. end
  879. temp_var = pain['nipples'] + lactation['max_sucktion_demand']/(lactation['soreness_mod']*10000)
  880. if temp_var > 60:
  881. pain['nipples'] = 65
  882. pump_stop_brake = 1
  883. pumptime = suck_until_pain
  884. lactation['max_sucktion_demand'] = lactation['suck_flow_rate']*pumptime
  885. else
  886. pain['nipples'] += lactation['max_sucktion_demand']/(lactation['soreness_mod']*100000)
  887. end
  888. temp_var = pain['breasts'] + lactation['max_sucktion_demand']/10000
  889. if temp_var > 20:
  890. pain['breasts'] = 25
  891. else
  892. pain['breasts'] += lactation['max_sucktion_demand']/10000
  893. end
  894. !! Pumping breasts is exhausting even if no milk comes. Pumping will impact the stamina of Sveta if she is not lactating.
  895. temp_var = pcs_stam - (lactation['max_sucktion_demand']/30000)
  896. if temp_var < 0:
  897. pcs_stam = 0
  898. !! energy usage flag on.
  899. energytomilkpump = 1
  900. pcs_sweat += pumptime/30
  901. else
  902. pcs_stam -= lactation['max_sucktion_demand']/30000
  903. pcs_sweat += pumptime/30
  904. !! energy usage flag on.
  905. energytomilkpump = 1
  906. end
  907. if pumptime < 10:
  908. breastcounter += 1
  909. else
  910. breastcounter += pumptime/10
  911. end
  912. lactation['dailyoverdemand'] += lactation['max_sucktion_demand']
  913. func('lact_lib','breast_engorment')
  914. result = 0
  915. elseif lactation['active'] > 0:
  916. !! How much milk demand is applied to the breasts.
  917. lactation['max_sucktion_demand'] = lactation['suck_flow_rate']*ARGS[2]
  918. !! 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.
  919. !! If we only need 20ml from a 100ml storage, we would only substract 20ml, leaving 80ml inside the breasts.
  920. !! Also lets make sure we start at zero from the stuff we get from Sveta.
  921. lactation['get_bm_milkedvolume'] = 0
  922. !! Case: Enough milk in Svetas breasts, covering the demand
  923. if lactation['breastmv'] >= lactation['max_sucktion_demand']:
  924. !! 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.
  925. if lactation['max_nip_flow_rate'] >= lactation['suck_flow_rate']:
  926. lactation['get_bm_milkedvolume'] = lactation['max_sucktion_demand']
  927. lactation['breastmv'] -= lactation['max_sucktion_demand']
  928. else
  929. lactation['get_bm_milkedvolume'] = lactation['max_nip_flow_rate']*ARGS[2]
  930. lactation['breastmv'] -= lactation['get_bm_milkedvolume']
  931. end
  932. !! Case: Not enough milk in Svetas breasts.
  933. elseif lactation['breastmv'] < lactation['max_sucktion_demand']:
  934. !! 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.
  935. !! 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.
  936. if lactation['breastmv'] <= 0:
  937. temp_var = lactation['max_sucktion_demand']
  938. pumptime_left = ARGS[2]
  939. else
  940. temp_var = lactation['max_sucktion_demand'] - lactation['breastmv']
  941. if lactation['max_nip_flow_rate'] >= lactation['suck_flow_rate']:
  942. pumptime_left = ARGS[2] - (lactation['breastmv']/lactation['suck_flow_rate'])
  943. else
  944. pumptime_left = ARGS[2] - (lactation['breastmv']/lactation['max_nip_flow_rate'])
  945. end
  946. if pumptime_left < 0: pumptime_left = 0
  947. end
  948. !! Now we know how much time we have and how much demand we have. Time to check if Sveta can do it.
  949. !! For the case, that svetas milk flow is not big enough pumptime left will be 0, therefore this is handled here.
  950. if pumptime_left > 0:
  951. if lactation['max_nip_flow_rate'] >= lactation['suck_flow_rate']:
  952. !! 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.
  953. if (lactation['suck_flow_rate']*100) <= ((lactation['lactaterate']*100)/60):
  954. lactation['get_bm_milkedvolume'] += lactation['suck_flow_rate']*pumptime_left
  955. else
  956. lactation['get_bm_milkedvolume'] += ((((lactation['lactaterate']*100)/60)*pumptime_left)/100)
  957. breastcounter += 2
  958. end
  959. else
  960. !! Same here as above.
  961. if (lactation['max_nip_flow_rate']*100) <= ((lactation['lactaterate']*100)/60):
  962. lactation['get_bm_milkedvolume'] += lactation['max_nip_flow_rate']*pumptime_left
  963. breastcounter += 2
  964. else
  965. lactation['get_bm_milkedvolume'] += ((((lactation['lactaterate']*100)/60)*pumptime_left)/100)
  966. breastcounter += 2
  967. end
  968. end
  969. !! 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 - lactaterate_use
  970. if pumptime_left > 60:
  971. if ((pumptime_left*100)/60) > 100:
  972. lactation['used_lactaterate'] -= ((((lactation['lactaterate']*100)/60)*(pumptime_left mod 60))/100)
  973. else
  974. lactation['used_lactaterate'] = lactation['lactaterate']
  975. end
  976. else
  977. if lactation['lactaterate'] >= lactation['used_lactaterate']:
  978. lactation['used_lactaterate'] -= lactation['get_bm_milkedvolume']
  979. else
  980. lactation['used_lactaterate'] = lactation['lactaterate']
  981. end
  982. end
  983. if lactation['used_lactaterate'] <= 0: lactation['used_lactaterate'] = 0
  984. !! Sveta had to make milk, so she needs to use some of her body resources to make the milk.
  985. if lactation['get_bm_milkedvolume'] > 0:
  986. !! energy usage flag on. Can be used in events to show that sveta is getting hungry or thirsty
  987. energytomilkpump = 1
  988. lactation['produced_milk'] = func('lact_lib','prod_milk',lactation['get_bm_milkedvolume'])
  989. end
  990. end
  991. !! 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.
  992. if temp_var > lactation['get_bm_milkedvolume']: lactation['dailyoverdemand'] += (temp_var - lactation['get_bm_milkedvolume'])
  993. !! time to add the pumped lactation['breastmv'] to the milkedvolume and empty lactation['breastmv'].
  994. lactation['get_bm_milkedvolume'] += lactation['breastmv']
  995. lactation['breastmv'] = 0
  996. !! 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.
  997. !! Else - there will only be nipple pain.
  998. if lactation['max_nip_flow_rate'] < lactation['suck_flow_rate']:
  999. temp_var = pain['nipples'] + ((lactation['suck_flow_rate'] - lactation['max_nip_flow_rate'])*ARGS[2])/2000 - (lactation['soreness_mod']*ARGS[2])*15
  1000. if temp_var >= 60:
  1001. pain['nipples'] = 65
  1002. elseif temp_var <= 0:
  1003. pain['nipples'] += 1
  1004. else
  1005. pain['nipples'] += (((lactation['suck_flow_rate'] - lactation['max_nip_flow_rate'])*ARGS[2])/2000 - (lactation['soreness_mod']*ARGS[2])*15)
  1006. end
  1007. else
  1008. if ARGS[2] < 10:
  1009. pain['nipples'] += 1
  1010. elseif ARGS[2] >= 10 and lactation['soreness_mod'] > ARGS[2]:
  1011. pain['nipples'] += 1
  1012. else
  1013. pain['nipples'] += (ARGS[2]/10 - lactation['soreness_mod']/10)
  1014. end
  1015. end
  1016. if lactation['max_nip_flow_rate'] >= lactation['suck_flow_rate']:
  1017. if (lactation['suck_flow_rate']*100) > ((lactation['lactaterate']*100)/60):
  1018. temp_var = pain['breasts'] + (((lactation['suck_flow_rate']*100)-((lactation['lactaterate']*100)/60))*pumptime_left)/1000
  1019. if temp_var > 20:
  1020. pain['breasts'] = 20
  1021. else
  1022. pain['breasts'] += (((lactation['suck_flow_rate']*100)-((lactation['lactaterate']*100)/60))*pumptime_left)/1000
  1023. end
  1024. end
  1025. else
  1026. if (lactation['max_nip_flow_rate']*100) > ((lactation['lactaterate']*100)/60):
  1027. temp_var = pain['breasts'] + (((lactation['max_nip_flow_rate']*100)-((lactation['lactaterate']*100)/60))*pumptime_left)/1000
  1028. if temp_var > 20:
  1029. pain['breasts'] = 20
  1030. else
  1031. pain['breasts'] += (((lactation['max_nip_flow_rate']*100)-((lactation['lactaterate']*100)/60))*pumptime_left)/1000
  1032. end
  1033. end
  1034. end
  1035. end
  1036. if pumptime < 10:
  1037. breastcounter += 1
  1038. else
  1039. breastcounter += pumptime/10
  1040. end
  1041. !! checking for engorgement
  1042. func('lact_lib','breast_engorment')
  1043. !! Done - Result is the milked volume.
  1044. result = lactation['get_bm_milkedvolume']
  1045. end
  1046. end
  1047. --- lact_lib ---------------------------------