lact_lib.qsrc 55 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071
  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['nbsizechange'] + lactation['siliconechange'] + lactation['magicf2bchange']) <> (nbsize + magicf2b + silicone):
  296. func('lact_lib','breastrecalc')
  297. if lactation['alveolicount_change'] <> lactation['alveolicount'] or lactation['alveoliexpandlvl_change'] <> lactation['alveoliexpandlvl']
  298. func('lact_lib','breastgrowthcalc')
  299. end
  300. elseif lactation['alveolicount_change'] <> lactation['alveolicount'] or lactation['alveoliexpandlvl_change'] <> lactation['alveoliexpandlvl']:
  301. func('lact_lib','breastgrowthcalc')
  302. end
  303. end
  304. end
  305. !! 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.
  306. !! Breastcount can be changed later on if someone comes up with multibreasts or breast amputation.
  307. if $ARGS[0] = 'set_breastmm':
  308. lactation['breastmm'] = (lactation['alveolicount']*2)*lactation['breastcount']
  309. end
  310. !! Just a function used for debugging. Can be deleted if not needed anymore.
  311. if $ARGS[0] = 'show_breast_stat':
  312. !! func('lact_lib','show_breast_stat')
  313. 'lactation[''breastcount''] = <<lactation[''breastcount'']>>'
  314. 'lactation[''breasttissueinitiated''] = <<lactation[''breasttissueinitiated'']>>'
  315. 'lactation[''breastccm''] = <<lactation[''breastccm'']>>'
  316. 'lactation[''maturebreast''] = <<lactation[''maturebreast'']>>'
  317. 'lactation[''alveolicount''] = <<lactation[''alveolicount'']>>'
  318. 'lactation[''prolactinlvl''] = <<lactation[''prolactinlvl'']>>'
  319. 'lactation[''dailyoverdemand''] = <<lactation[''dailyoverdemand'']>>'
  320. 'lactation[''alveoliexpandlvl''] = <<lactation[''alveoliexpandlvl'']>>'
  321. 'lactation[''active''] = <<lactation[''active'']>>'
  322. 'lactation[''lactaterate''] = <<lactation[''lactaterate'']>>'
  323. 'lactation[''breastmm''] = <<lactation[''breastmm'']>>'
  324. 'lactation[''breastmv''] = <<lactation[''breastmv'']>>'
  325. end
  326. !! milk production function
  327. if $ARGS[0] = 'prod_milk':
  328. !! function for Svetas milk production. Milk production will cost stamina, hydration, and hunger. this function is used in breastcycle
  329. !! I know, pretty complex for just making breast milk, but hey - life is complex :D
  330. !! func('lact_lib','prod_milk',milkamount)
  331. !! result = produced breast milk amount in ml*1000
  332. !! ARGS[1] = Requested milk production amount produced in ml*1000. Usually should be the lactaterate.
  333. !! If there was milk pumped or produced during the hour, this has to be substracted.
  334. if lactation['used_lactaterate'] > 0:
  335. lactation['prod_milk_req'] = (ARGS[1] - lactation['used_lactaterate'])
  336. lactation['used_lactaterate'] += ARGS[1]
  337. if lactation['used_lactaterate'] > lactation['lactaterate']: lactation['used_lactaterate'] = lactation['lactaterate']
  338. else
  339. lactation['prod_milk_req'] = ARGS[1]
  340. lactation['used_lactaterate'] += ARGS[1]
  341. if lactation['used_lactaterate'] > lactation['lactaterate']: lactation['used_lactaterate'] = lactation['lactaterate']
  342. end
  343. !! 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.
  344. if lactation['active'] > 0 and salo > 15:
  345. !! checking how much hydration, stamina and hunger is needed to produce x amount of breast milk
  346. !! checking if enough stamina and hydra is available
  347. if (lactation['prod_milk_req']/10000) < pcs_stam and (lactation['prod_milk_req']/10000) < pcs_hydra:
  348. !! full requested milk amount can be produced. substracting from stamina, hydration energy.
  349. if (lactation['prod_milk_req']/10000) < 1:
  350. pcs_stam -= 1
  351. pcs_hydra -= 1
  352. else
  353. pcs_stam -= (lactation['prod_milk_req']/10000)
  354. pcs_hydra -= (lactation['prod_milk_req']/10000)
  355. end
  356. if pcs_stam < 1: pcs_stam = 1
  357. if pcs_hydra < 1: pcs_hydra = 1
  358. if (lactation['prod_milk_req']/9000) < pcs_energy:
  359. if (lactation['prod_milk_req']/9000) < 1:
  360. pcs_energy -= 1
  361. else
  362. pcs_energy -= (lactation['prod_milk_req']/9000)
  363. if pcs_energy < 1: pcs_energy = 1
  364. end
  365. result = lactation['prod_milk_req']
  366. else
  367. !! If energy is too low, milk will be produced but there is a chance that salo will shrink.
  368. pcs_energy = 1
  369. if rand(0,100) > 95: salo -= 1
  370. if pain['breasts'] < 20: pain['breasts'] += 1
  371. result = lactation['prod_milk_req']
  372. end
  373. elseif pcs_stam <= 0 or pcs_hydra <= 0:
  374. !! if sveta has not enough hydration or stamina, no milk is produced.
  375. result = 0
  376. else
  377. if (pcs_stam*10000) < (pcs_hydra*10000):
  378. lactation['prod_milk_temp_var'] = (pcs_stam*10000)
  379. pcs_stam = 1
  380. if (lactation['prod_milk_req']/10000) < pcs_hydra:
  381. pcs_hydra -= (lactation['prod_milk_req']/10000)
  382. else
  383. pcs_hydra = 1
  384. end
  385. else
  386. lactation['prod_milk_temp_var'] = (pcs_hydra*10000)
  387. pcs_hydra = 1
  388. if (lactation['prod_milk_req']/10000) < pcs_stam:
  389. pcs_stam -= (lactation['prod_milk_req']/10000)
  390. else
  391. pcs_stam = 1
  392. end
  393. end
  394. if (lactation['prod_milk_temp_var']/9000) < pcs_energy:
  395. if (lactation['prod_milk_temp_var']/9000) < 1:
  396. pcs_energy -= 1
  397. else
  398. pcs_energy -= (lactation['prod_milk_temp_var']/9000)
  399. if pcs_energy < 1: pcs_energy = 1
  400. end
  401. else
  402. !! If energy is too low, milk will be produced but there is a chance that salo will shrink.
  403. pcs_energy = 1
  404. if rand(0,100) > 95: salo -= 1
  405. if pain['breasts'] < 20: pain['breasts'] += 1
  406. end
  407. if pcs_energy < 1: pcs_energy = 1
  408. if pcs_hydra < 1: pcs_hydra = 1
  409. if pcs_stam < 1: pcs_stam = 1
  410. result = lactation['prod_milk_temp_var']
  411. end
  412. else
  413. result = 0
  414. end
  415. end
  416. !! breast status messages - for use in stat_display. Explains itself basically.
  417. if $ARGS[0] = 'breast_stat_disp':
  418. !! breast status
  419. if lactation['active'] <= 0:
  420. 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>'
  421. elseif lactation['active'] > 0 and lactation['pc_aware'] > 0:
  422. if lactation['engorgement'] > 0 and lactation['lactmess'] < 1:
  423. $stat_msg += '<BR><font color = orange>Your breasts are so full they hurt.</font><BR>'
  424. elseif lactation['engorgement'] > 0 and lactation['lactmess'] < 3 and $clothingworntype = 'nude':
  425. $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>'
  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 comming out causing you to have a lot of milk around your nipples.</font><BR>'
  428. elseif lactation['engorgement'] > 0 and lactation['lactmess'] >= 6 and $clothingworntype = 'nude':
  429. $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>'
  430. elseif lactation['engorgement'] > 0 and lactation['lactmess'] < 3:
  431. $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>'
  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 comming out making visible wet circles on your top.</font><BR>'
  434. elseif lactation['engorgement'] > 0 and lactation['lactmess'] >= 6:
  435. $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>'
  436. elseif lactation['engorgement'] < 1 and lactation['breastmv'] > lactation['breastmm']*9/10:
  437. $stat_msg += '<BR>'+iif(night_mode > 0,'<font color = white>','<font color = black>')+'Your breasts are firm and full from your milk.</font><BR>'
  438. elseif lactation['engorgement'] < 1 and lactation['breastmv'] > lactation['breastmm']/2:
  439. $stat_msg += '<BR>'+iif(night_mode > 0,'<font color = white>','<font color = black>')+'Your breasts are heavy with your milk.</font><BR>'
  440. elseif lactation['engorgement'] < 1 and lactation['breastmv'] > lactation['breastmm']/4:
  441. $stat_msg += '<BR>'+iif(night_mode > 0,'<font color = white>','<font color = black>')+'Your breasts feel slightly heavy from the milk inside.</font><BR>'
  442. elseif lactation['engorgement'] < 1 and lactation['breastmv'] > 0:
  443. $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>'
  444. end
  445. elseif lactation['active'] > 0 and lactation['pc_aware'] < 1:
  446. if lactation['engorgement'] > 0 and lactation['lactmess'] < 1:
  447. $stat_msg += '<BR><font color = orange>Your breasts hurt with pressure in them.</font><BR>'
  448. elseif lactation['engorgement'] > 0 and lactation['lactmess'] < 3 and $clothingworntype = 'nude':
  449. $stat_msg += '<BR><font color = red>Your breasts hurt and your nipples are wet.</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 they feel wet, some white liquid around your nipples.</font><BR>'
  452. elseif lactation['engorgement'] > 0 and lactation['lactmess'] >= 6 and $clothingworntype = 'nude':
  453. $stat_msg += '<BR><font color = red>Your breasts hurt and a white liquid is spraying out, covering your breasts.</font><BR>'
  454. elseif lactation['engorgement'] > 0 and lactation['lactmess'] < 3:
  455. $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>'
  456. elseif lactation['engorgement'] > 0 and lactation['lactmess'] < 6:
  457. $stat_msg += '<BR><font color = red>Your breasts hurt and your nipples tingle. There are visible wet circles on your top.</font><BR>'
  458. elseif lactation['engorgement'] > 0 and lactation['lactmess'] >= 6:
  459. $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>'
  460. elseif lactation['engorgement'] < 1 and lactation['breastmv'] > lactation['breastmm']*9/10:
  461. $stat_msg += '<BR>'+iif(night_mode > 0,'<font color = white>','<font color = black>')+'Your breasts feel firm and under pressure.</font><BR>'
  462. elseif lactation['engorgement'] < 1 and lactation['breastmv'] > lactation['breastmm']/2:
  463. $stat_msg += '<BR>'+iif(night_mode > 0,'<font color = white>','<font color = black>')+'Your breasts feel heavy.</font><BR>'
  464. elseif lactation['engorgement'] < 1 and lactation['breastmv'] > lactation['breastmm']/4:
  465. $stat_msg += '<BR>'+iif(night_mode > 0,'<font color = white>','<font color = black>')+'Your breasts feel slightly heavy.</font><BR>'
  466. elseif lactation['engorgement'] < 1 and lactation['breastmv'] > 0:
  467. $stat_msg += '<BR>'+iif(night_mode > 0,'<font color = white>','<font color = black>')+'Your feel an easy pressure in your breasts.</font><BR>'
  468. end
  469. end
  470. end
  471. !! function for breast engorment, used in breastcycle
  472. if $ARGS[0] = 'breast_engorment':
  473. !! relatively easy. if the breasts get full, engorgement will happen.
  474. if lactation['breastmv'] >= lactation['breastmm']:
  475. temp_var = lactation['breastmv'] - lactation['breastmm']
  476. lactation['breastmv'] = lactation['breastmm']
  477. if temp_var < 1000 and temp_var > 0:
  478. lactation['engorgement'] = 0
  479. elseif temp_var < 3000 and temp_var >= 1000:
  480. lactation['engorgement'] = 1
  481. lactation['lactmess'] += 1
  482. elseif temp_var < 10000 and temp_var >= 3000:
  483. lactation['engorgement'] = 1
  484. lactation['lactmess'] += 2
  485. elseif temp_var >= 10000:
  486. lactation['engorgement'] = 1
  487. lactation['lactmess'] += 3
  488. end
  489. else
  490. lactation['engorgement'] = 0
  491. if lactation['lactmess'] > 1:
  492. lactation['lactmess'] -= 2
  493. if lactation['lactmess'] < 0: lactation['lactmess'] = 0
  494. end
  495. end
  496. end
  497. !! Lactation On/Off switch function
  498. if $ARGS[0] = 'lact_switch':
  499. !! Usage func('lact_lib','lact_switch')
  500. if lactation['active'] <= 0:
  501. !! 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.
  502. lactation['pc_aware'] = 0
  503. !! setting lactation to active
  504. lactation['active'] = 1
  505. !! setting breast maximum milk volume via function
  506. func('lact_lib','set_breastmm')
  507. !! resetting prolactinlvl so that the initial production rate is not too high
  508. if lactation['prolactinlvl'] < 200: lactation['prolactinlvl'] = 200
  509. !! setting the lactation rate. Warning! lactation rate is in ml*1000 now for higher accuracy.
  510. lactation['lactaterate'] = 1000*(lactation['prolactinlvl']/200)
  511. !! setting milk volume in breasts to 0. Will fill up with lactaterate in another part of the breastcycle
  512. lactation['breastmv'] = 0
  513. !! nipples will grow a bit with extended milk channels. If lactation stops, this will be substracted from the nipples again and nipples will shrink.
  514. lactation['nipgrowth'] = 2
  515. pcs_nips += lactation['nipgrowth']
  516. if lactation['alveoliexpandlvl'] < 10: lactation['alveoliexpandlvl'] = 10
  517. if lactation['alveoliexpandlvl_change'] < 9: lactation['alveoliexpandlvl_change'] = 9
  518. lactation['milkprod_type'] = 1
  519. else
  520. !! If lactation is on, the stuff below will switch it off again.
  521. lactation['active'] = 0
  522. lactation['lactaterate'] = 0
  523. lactation['breastmv'] = 0
  524. lactation['breastmm'] = 0
  525. lactation['alveoliexpandlvl'] = 0
  526. lactation['alveoliexpandlvl_change'] = 1
  527. lactation['prolactinlvl'] = 0
  528. if pcs_nips > lactation['nipgrowth']: pcs_nips -= lactation['nipgrowth']
  529. lactation['nipgrowth'] = 0
  530. end
  531. !! Always trigger the breastcycle after breast change, or the changes to svetas breasts will not happen.
  532. func('lact_lib','breastcycle')
  533. end
  534. !! new breast cycle function, replaced the monster lactation function in femcyc
  535. if $ARGS[0] = 'breastcycle':
  536. if lactation['breasttissueinitiated'] <= 0: func('lact_lib','init_breasttissue')
  537. !! usage func('lact_lib','breastcycle')
  538. !! if lactating or not, breasts will grow during pregnancy. This will only happen during first full pregnancy
  539. if pregchem => 2191 and lactation['maturebreast'] <= 0:
  540. !! Alveoligrowth/breastgrowth + 78876 new aveoli per breast average during pregnancy
  541. !! Checking pregchem last. It should not be small than 0.
  542. if lactation['pregchemlast'] <= 0:
  543. lactation['pregchemlast'] = 2191
  544. lactation['preggrowth'] = 0
  545. end
  546. if lactation['preggrowth'] <= 78876 and (pregchem - lactation['pregchemlast']) >= 0:
  547. lactation['preggrowth'] = (pregchem - 2191) * 36
  548. lactation['alveolicount'] = lactation['alveolicount_start'] + lactation['preggrowth']
  549. lactation['growthsoreness_on'] = 1
  550. if pain['breasts'] <= 20: pain['breasts'] = 20
  551. else
  552. lactation['growthsoreness_on'] = 0
  553. lactation['maturebreast'] = 1
  554. end
  555. lactation['pregchemlast'] = pregchem
  556. elseif PregChem > 4383 and lactation['maturebreast'] > 0:
  557. !! pregnancy prolactinlvl rise
  558. if lactation['prolactinlvl'] < 200 and lactation['active'] <= 0:
  559. if rand(0,100) > 25:
  560. lactation['prolactinlvl'] +=1
  561. end
  562. end
  563. end
  564. !! checking for prolactin and if svetas breasts were worked (e.g. breast stimulation via massage, pumps, by mouth, or whatever)
  565. if lactation['active'] <= 0:
  566. !! prolactinlvl calculation. If sveta never was pregnant, prolactinlvl will grow slower
  567. if lactation['milkgrowday'] < daystart:
  568. if (lactation['dailyoverdemand']/200) <= 0 and lactation['dailyoverdemand'] > 0:
  569. lactation['prolactinlvl'] += 1
  570. elseif (lactation['dailyoverdemand']/200) >= 10 and lactation['maturebreast'] <= 0:
  571. lactation['prolactinlvl'] += 10
  572. elseif (lactation['dailyoverdemand']/200) >= 50 and lactation['maturebreast'] > 0:
  573. lactation['prolactinlvl'] += 50
  574. else
  575. if lactation['prolactinlvl'] > 0 and pregchem < 2191:
  576. if ((lactation['prolactinlvl']/2) + (lactation['prolactinlvl']/5) - (lactation['prolactinlvl']/8)) < 1:
  577. lactation['prolactinlvl'] -= 1
  578. else
  579. lactation['prolactinlvl'] -= ((lactation['prolactinlvl']/2) + (lactation['prolactinlvl']/5) - (lactation['prolactinlvl']/8))
  580. end
  581. end
  582. end
  583. end
  584. if lactation['prolactinlvl'] > 200: lactation['prolactinlvl'] = 200
  585. !! expand level cannot be over 5
  586. if lactation['alveoliexpandlvl'] > 10: lactation['alveoliexpandlvl'] = 10
  587. !! Breast growth due to mammarygland expansion. Happens if prolactin level is high enough and will cause breastsoreness.
  588. !! If prolactinlvl lowers, milkglands will shrink again.
  589. if lactation['milkgrowday'] < daystart and lactation['prolactinlvl'] >= 100 and lactation['alveoliexpandlvl'] < 10:
  590. lactation['alveoliexpandlvl_change'] = lactation['alveoliexpandlvl']
  591. lactation['alveoliexpandlvl'] += 1
  592. lactation['growthsoreness_on'] = 1
  593. if pain['breasts'] <= 20: pain['breasts'] = 20
  594. elseif lactation['milkgrowday'] < daystart and lactation['prolactinlvl'] < 100 and lactation['alveoliexpandlvl'] > 0:
  595. lactation['alveoliexpandlvl_change'] = lactation['alveoliexpandlvl']
  596. lactation['alveoliexpandlvl'] -= 1
  597. lactation['growthsoreness_on'] = 1
  598. if pain['breasts'] <= 20: pain['breasts'] = 20
  599. end
  600. !! 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
  601. if rand(1,50) + lactation['prolactinlvl'] >= rand(200,250) and lactation['alveoliexpandlvl'] >= 10:
  602. func('lact_lib','lact_switch')
  603. end
  604. else
  605. !! things that happen when Sveta is lactating lactation['active'] > 1
  606. if lactation['milkgrowday'] < daystart:
  607. !! 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.
  608. !! funny parabelfunction for the lactrategrowth > 65 - ((1/1466)*((lactrate-304)*(lactrate-304)))
  609. lactation['prolactinlvl'] += (lactation['dailyoverdemand']/10000)
  610. if lactation['dailyoverdemand'] > 0 and lactation['breastpumped'] >= 0:
  611. lactation['max_lactrate_growth'] = (65 - ((((lactation['lactaterate']/1000) - 304)*((lactation['lactaterate']/1000) - 304))/1466))*1000
  612. if lactation['max_lactrate_growth'] < ((10*lactation['prolactinlvl'])/2) and lactation['max_lactrate_growth'] >= 1000:
  613. lactation['lactaterate'] += lactation['max_lactrate_growth']
  614. elseif lactation['max_lactrate_growth'] < ((10*lactation['prolactinlvl'])/2) and lactation['max_lactrate_growth'] < 1000:
  615. lactation['lactaterate'] += 1000
  616. else
  617. lactation['lactaterate'] += (10*lactation['prolactinlvl'])/2
  618. end
  619. lactation['prolactinlvl'] = 100
  620. elseif lactation['dailyoverdemand'] <= 0 and lactation['breastpumped'] > 0:
  621. !! If there was no milk overdemand, sveta will keep her lactationrate level.
  622. lactation['prolactinlvl'] = 100
  623. lactation['dailyoverdemand'] = 0
  624. lactation['breastpumped'] = 0
  625. else
  626. !! 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)
  627. lactation['dailyoverdemand'] = 0
  628. lactation['breastpumped'] = 0
  629. if lactation['lactaterate'] > 0:
  630. !! lactation rate is dropping with below function.
  631. lactation['prolactinlvl'] = 100
  632. if ((lactation['lactaterate']/2) + (lactation['lactaterate']/5) - (lactation['lactaterate']/8)) < 1:
  633. lactation['lactaterate'] -= 1
  634. else
  635. lactation['lactaterate'] = (lactation['lactaterate'] - (lactation['lactaterate']/2) + (lactation['lactaterate']/5) - (lactation['lactaterate']/8))
  636. end
  637. elseif lactation['lactaterate'] <= 0 and lactation['maturebreast'] > 0 and pregchem >= 4383:
  638. !! during pregnancy lactation is not switched off. Svetas breasts will always produce a bit off milk
  639. lactation['lactaterate'] = 10
  640. elseif lactation['lactaterate'] <= 0:
  641. !! switching off lactation production and making sure prolactin is dropping. Nipples shrink too. There are some changes that are permanent, especially during pregnancy.
  642. func('lact_lib','lact_switch')
  643. end
  644. end
  645. end
  646. !! Filling milk into svetas breast every hour and checking for breastengorgement
  647. if lactation['breastmv'] < lactation['breastmm'] and lactation['lactaterate'] > 50 and lactation['milkprod_type'] = 1:
  648. lactation['breastmv'] += func('lact_lib','prod_milk',lactation['lactaterate'])
  649. elseif lactation['breastmv'] < lactation['breastmm'] and lactation['lactaterate'] > 50 and lactation['milkprod_type'] = 0:
  650. lactation['breastmv'] += lactation['lactaterate']
  651. if lactation['breastmv'] > lactation['breastmm']: lactation['breastmv'] = lactation['breastmm']
  652. end
  653. !! Reset used_lactaterate, so milk can be produced again.
  654. lactation['used_lactaterate'] = 0
  655. func('lact_lib','breast_engorment')
  656. end
  657. if lactation['milkgrowday'] < daystart:
  658. func('lact_lib','BreastGrowth')
  659. lactation['dailyoverdemand'] = 0
  660. lactation['alveolicount_change'] = lactation['alveolicount']
  661. lactation['milkgrowday'] = daystart
  662. end
  663. end
  664. !! Used for switching off all lactation related content
  665. if $ARGS[0] = 'lactate_optout':
  666. !! usage 1: func('lact_lib','lactate_optout')
  667. !! usage 2: gs 'lact_lib','lactate_optout'
  668. if lactation['active'] > 0:
  669. func('lact_lib','lact_switch')
  670. end
  671. lactation['active'] = 0
  672. lactation['prolactinlvl'] = 0
  673. lactation['lactmess'] = 0
  674. lactation['engorgement'] = 0
  675. lactation['breastmv'] = 0
  676. lactation['breastmm'] = 0
  677. lactation['lactaterate'] = 0
  678. lactation['dailyoverdemand'] = 0
  679. end
  680. !! get suckflow rate function
  681. if $ARGS[0] = 'get_suckflowrate':
  682. !! lactation['suck_flow_rate'] = func('lact_lib','get_suckflowrate', sucktion_type)
  683. !! 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.
  684. !! 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]
  685. !! what type of sucktion is happening? different sucktion can cause a different demand of breastmilk.
  686. !! Result is base rate of sucktion 10ml/minute x 1000. So if the sucktion rate is 10ml/min then suck_flow_rate = 10000.
  687. if ARGS[1] = 0:
  688. !! 'adult sucking'
  689. result = 12000
  690. elseif ARGS[1] = 1:
  691. !! 'child sucking'
  692. result = 11000
  693. elseif ARGS[1] = 2:
  694. !! 'baby sucking'
  695. result = 8000
  696. elseif ARGS[1] = 3:
  697. !! 'manual_breastpump sucking'
  698. result = 18000
  699. elseif ARGS[1] = 4:
  700. !! 'electric_breastpump sucking'
  701. result = 40000
  702. elseif ARGS[1] = 5:
  703. !! 'hand expression'
  704. result = 10500
  705. elseif ARGS[1] = 6:
  706. !! 'cow milker sucking'
  707. result = 100000
  708. elseif ARGS[1] = 7:
  709. !! 'weak baby sucking'
  710. result = 5000
  711. elseif ARGS[1] = 8:
  712. !! 'manual stimulation during sex/sex play'
  713. result = 6000
  714. else
  715. !! 'suck flow else branch'
  716. result = 10000
  717. end
  718. end
  719. !! get max nipple flow rate function
  720. if $ARGS[0] = 'get_maxnipflowrate':
  721. !! lactation['max_nip_flow_rate'] = func('lact_lib','get_maxnipflowrate')
  722. !! How much milk can be sucked out through svetas nipples per minute.
  723. !! Result is base rate is 10ml/minute x 1000.
  724. !! 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).
  725. lactation['nip_flow_mod'] = breastcounter * 100
  726. !! IT IS OVER 9000!
  727. if lactation['nip_flow_mod'] > 9000: lactation['nip_flow_mod'] = 9000
  728. !! y = 100x + 6000 linear growth for the nip flowrate
  729. if pcs_nips > 0:
  730. result = ((100*pcs_nips) + 6000 + lactation['nip_flow_mod'])
  731. else
  732. result = (6000 + lactation['nip_flow_mod'])
  733. end
  734. end
  735. !! get mood modification
  736. if $ARGS[0] = 'get_moodmod':
  737. !! during breastfeeding or pumping or whatever, svetas mood can be pushed up.
  738. !! pcs_mood += func('lact_lib','get_maxnipflowrate', sucktion type, sucktion time)
  739. !! 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]
  740. !! Result = additional mood
  741. if ARGS[1] = 0:
  742. !! 'adult sucking'
  743. lactation['moodmod'] = ARGS[2]/8
  744. elseif ARGS[1] = 1:
  745. !! 'child sucking'
  746. lactation['moodmod'] = ARGS[2]/2
  747. elseif ARGS[1] = 2:
  748. !! 'baby sucking'
  749. lactation['moodmod'] = ARGS[2]
  750. elseif ARGS[1] = 7:
  751. !! 'weak baby sucking'
  752. lactation['moodmod'] = ARGS[2]
  753. else
  754. lactation['moodmod'] = 0
  755. end
  756. if lactation['active'] <= 0: lactation['moodmod'] = (lactation['moodmod']/2)
  757. if (lactation['moodmod'] + pcs_mood) > 100:
  758. result = (100 - pcs_mood)
  759. else
  760. result = lactation['moodmod']
  761. end
  762. end
  763. !! get soreness_mod
  764. if $ARGS[0] = 'get_sorenessmod':
  765. !! lactation['soreness_mod'] = func('lact_lib','get_sorenessmod')
  766. if lactation['nipple_cream_applied'] > 0:
  767. lactation['nipple_cream_applied'] = 0
  768. if (breastcounter/10) > 20:
  769. result = 40
  770. elseif (breastcounter/10) <= 0:
  771. result = 20
  772. else
  773. result = ((breastcounter/10) + 20)
  774. end
  775. else
  776. if (breastcounter/10) > 20:
  777. result = 20
  778. elseif (breastcounter/10) <= 0:
  779. result = 1
  780. else
  781. result = (breastcounter/10)
  782. end
  783. end
  784. end
  785. !! get breastmilktime function
  786. if $ARGS[0] = '$get_breastmilk_time':
  787. !! func('lact_lib','$get_breastmilk_time', sucktion_type, milk_demand)
  788. !! 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]
  789. !! ARGS[2] = milk_demand: how much milk is demanded. Warning: Should be ml and not in ml*10 for ease of use. :D
  790. !! result = Time in Minutes
  791. !! Usage: breastmilktimetoget = func('lact_lib','$get_breastmilk_time', 2, 150)
  792. !! 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.
  793. !! If you want to milk sveta, use get_breastmilk.
  794. if lactation['active'] > 0:
  795. !! suck_flow_rate initialized Base Rate of sucking is 10ml/minute x 1000.
  796. lactation['suck_flow_rate'] = func('lact_lib','get_suckflowrate', ARGS[1])
  797. !! max nip flow rate initialized
  798. lactation['max_nip_flow_rate'] = func('lact_lib','get_maxnipflowrate')
  799. !! getting temp lactaterate
  800. if (lactation['lactaterate']/60) < 1 and lactation['lactaterate'] > 0:
  801. lactation['lactaterate_per_min'] = 1
  802. else
  803. lactation['lactaterate_per_min'] = lactation['lactaterate']/60
  804. end
  805. !! resetting lactation['milk_time_output'] to 0
  806. lactation['milk_time_output'] = 0
  807. !! getting breast milking time
  808. if lactation['breastmv'] >= (ARGS[2]*1000):
  809. if lactation['max_nip_flow_rate'] <= lactation['suck_flow_rate']:
  810. lactation['milk_time_output'] = (ARGS[2]*1000)/lactation['max_nip_flow_rate']
  811. else
  812. lactation['milk_time_output'] = (ARGS[2]*1000)/lactation['suck_flow_rate']
  813. end
  814. result = lactation['milk_time_output']
  815. elseif lactation['breastmv'] > 0 and lactation['breastmv'] < (ARGS[2]*1000):
  816. if lactation['max_nip_flow_rate'] <= lactation['suck_flow_rate']:
  817. lactation['milk_time_output'] = lactation['breastmv']/lactation['max_nip_flow_rate']
  818. temp_var2 = (ARGS[2]*1000) - lactation['breastmv']
  819. if lactation['max_nip_flow_rate'] <= lactation['lactaterate_per_min']:
  820. lactation['milk_time_output'] += temp_var2/lactation['max_nip_flow_rate']
  821. else
  822. lactation['milk_time_output'] += temp_var2/lactation['lactaterate_per_min']
  823. end
  824. else
  825. lactation['milk_time_output'] = lactation['breastmv']/lactation['suck_flow_rate']
  826. temp_var2 = (ARGS[2]*1000) - lactation['breastmv']
  827. if lactation['suck_flow_rate'] <= lactation['lactaterate_per_min']:
  828. lactation['milk_time_output'] += temp_var2/lactation['suck_flow_rate']
  829. else
  830. lactation['milk_time_output'] += temp_var2/lactation['lactaterate_per_min']
  831. end
  832. end
  833. result = lactation['milk_time_output']
  834. elseif lactation['breastmv'] <=0:
  835. if lactation['max_nip_flow_rate'] <= lactation['suck_flow_rate']:
  836. if lactation['max_nip_flow_rate'] <= lactation['lactaterate_per_min']:
  837. lactation['milk_time_output'] = (ARGS[2]*1000)/lactation['max_nip_flow_rate']
  838. else
  839. lactation['milk_time_output'] = (ARGS[2]*1000)/lactation['lactaterate_per_min']
  840. end
  841. else
  842. if lactation['suck_flow_rate'] <= lactation['lactaterate_per_min']:
  843. lactation['milk_time_output'] = (ARGS[2]*1000)/lactation['suck_flow_rate']
  844. else
  845. lactation['milk_time_output'] = (ARGS[2]*1000)/lactation['lactaterate_per_min']
  846. end
  847. end
  848. result = lactation['milk_time_output']
  849. else
  850. result = 0
  851. end
  852. else
  853. result = 0
  854. end
  855. end
  856. if $ARGS[0] = '$get_breastmilk':
  857. !! func('lact_lib','$get_breastmilk', sucktion_type, sucktion_time)
  858. !! 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]
  859. !! ARGS[2] = sucktion_time: how many minutes the sucking/pumping takes place
  860. !! Usage: breastmilkvolume = func('lact_lib','$get_breastmilk', 4, 20)
  861. !! result = Milk in ml*10
  862. !! 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.
  863. lactation['breastpumped'] = 1
  864. !! suck_flow_rate initialized Base Rate of sucking is 10ml/minute.
  865. lactation['suck_flow_rate'] = func('lact_lib','get_suckflowrate', ARGS[1])
  866. !! max nip flow rate initialized
  867. lactation['max_nip_flow_rate'] = func('lact_lib','get_maxnipflowrate')
  868. !! will there be a mood change?
  869. pcs_mood += func('lact_lib','get_maxnipflowrate',ARGS[1],ARGS[2])
  870. !! get soreness that will result from pumping/sucking/massaging
  871. lactation['soreness_mod'] = func('lact_lib','get_sorenessmod')
  872. !! 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.
  873. if lactation['active']<= 0:
  874. if lactation['dailyoverdemand'] <= 0: lactation['dailyoverdemand'] = 0
  875. pump_stop_brake = 0
  876. !! 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.
  877. lactation['max_sucktion_demand'] = lactation['suck_flow_rate']*ARGS[2]
  878. if pain['nipples'] <= 60:
  879. suck_until_pain = (((60 - pain['nipples'])*lactation['soreness_mod'])*1000)/(lactation['suck_flow_rate']/18)
  880. end
  881. temp_var = pain['nipples'] + lactation['max_sucktion_demand']/(lactation['soreness_mod']*10000)
  882. if temp_var > 60:
  883. pain['nipples'] = 65
  884. pump_stop_brake = 1
  885. pumptime = suck_until_pain
  886. lactation['max_sucktion_demand'] = lactation['suck_flow_rate']*pumptime
  887. else
  888. pain['nipples'] += lactation['max_sucktion_demand']/(lactation['soreness_mod']*100000)
  889. end
  890. temp_var = pain['breasts'] + lactation['max_sucktion_demand']/10000
  891. if temp_var > 20:
  892. pain['breasts'] = 25
  893. else
  894. pain['breasts'] += lactation['max_sucktion_demand']/10000
  895. end
  896. !! Pumping breasts is exhausting even if no milk comes. Pumping will impact the stamina of Sveta if she is not lactating.
  897. temp_var = pcs_stam - (lactation['max_sucktion_demand']/30000)
  898. if temp_var < 0:
  899. pcs_stam = 0
  900. !! energy usage flag on.
  901. energytomilkpump = 1
  902. pcs_sweat += pumptime/30
  903. else
  904. pcs_stam -= lactation['max_sucktion_demand']/30000
  905. pcs_sweat += pumptime/30
  906. !! energy usage flag on.
  907. energytomilkpump = 1
  908. end
  909. if pumptime < 10:
  910. breastcounter += 1
  911. else
  912. breastcounter += pumptime/10
  913. end
  914. lactation['dailyoverdemand'] += lactation['max_sucktion_demand']
  915. func('lact_lib','breast_engorment')
  916. result = 0
  917. elseif lactation['active'] > 0:
  918. !! How much milk demand is applied to the breasts.
  919. lactation['max_sucktion_demand'] = lactation['suck_flow_rate']*ARGS[2]
  920. !! 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.
  921. !! If we only need 20ml from a 100ml storage, we would only substract 20ml, leaving 80ml inside the breasts.
  922. !! Also lets make sure we start at zero from the stuff we get from Sveta.
  923. lactation['get_bm_milkedvolume'] = 0
  924. !! Case: Enough milk in Svetas breasts, covering the demand
  925. if lactation['breastmv'] >= lactation['max_sucktion_demand']:
  926. !! 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.
  927. if lactation['max_nip_flow_rate'] >= lactation['suck_flow_rate']:
  928. lactation['get_bm_milkedvolume'] = lactation['max_sucktion_demand']
  929. lactation['breastmv'] -= lactation['max_sucktion_demand']
  930. else
  931. lactation['get_bm_milkedvolume'] = lactation['max_nip_flow_rate']*ARGS[2]
  932. lactation['breastmv'] -= lactation['get_bm_milkedvolume']
  933. end
  934. !! Case: Not enough milk in Svetas breasts.
  935. elseif lactation['breastmv'] < lactation['max_sucktion_demand']:
  936. !! 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.
  937. !! 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.
  938. if lactation['breastmv'] <= 0:
  939. temp_var = lactation['max_sucktion_demand']
  940. pumptime_left = ARGS[2]
  941. else
  942. temp_var = lactation['max_sucktion_demand'] - lactation['breastmv']
  943. if lactation['max_nip_flow_rate'] >= lactation['suck_flow_rate']:
  944. pumptime_left = ARGS[2] - (lactation['breastmv']/lactation['suck_flow_rate'])
  945. else
  946. pumptime_left = ARGS[2] - (lactation['breastmv']/lactation['max_nip_flow_rate'])
  947. end
  948. if pumptime_left < 0: pumptime_left = 0
  949. end
  950. !! Now we know how much time we have and how much demand we have. Time to check if Sveta can do it.
  951. !! For the case, that svetas milk flow is not big enough pumptime left will be 0, therefore this is handled here.
  952. if pumptime_left > 0:
  953. if lactation['max_nip_flow_rate'] >= lactation['suck_flow_rate']:
  954. !! 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.
  955. if (lactation['suck_flow_rate']*100) <= ((lactation['lactaterate']*100)/60):
  956. lactation['get_bm_milkedvolume'] += lactation['suck_flow_rate']*pumptime_left
  957. else
  958. lactation['get_bm_milkedvolume'] += ((((lactation['lactaterate']*100)/60)*pumptime_left)/100)
  959. breastcounter += 2
  960. end
  961. else
  962. !! Same here as above.
  963. if (lactation['max_nip_flow_rate']*100) <= ((lactation['lactaterate']*100)/60):
  964. lactation['get_bm_milkedvolume'] += lactation['max_nip_flow_rate']*pumptime_left
  965. breastcounter += 2
  966. else
  967. lactation['get_bm_milkedvolume'] += ((((lactation['lactaterate']*100)/60)*pumptime_left)/100)
  968. breastcounter += 2
  969. end
  970. end
  971. !! 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
  972. if pumptime_left > 60:
  973. if ((pumptime_left*100)/60) > 100:
  974. lactation['used_lactaterate'] -= ((((lactation['lactaterate']*100)/60)*(pumptime_left mod 60))/100)
  975. else
  976. lactation['used_lactaterate'] = lactation['lactaterate']
  977. end
  978. else
  979. if lactation['lactaterate'] >= lactation['used_lactaterate']:
  980. lactation['used_lactaterate'] -= lactation['get_bm_milkedvolume']
  981. else
  982. lactation['used_lactaterate'] = lactation['lactaterate']
  983. end
  984. end
  985. if lactation['used_lactaterate'] <= 0: lactation['used_lactaterate'] = 0
  986. !! Sveta had to make milk, so she needs to use some of her body resources to make the milk.
  987. if lactation['get_bm_milkedvolume'] > 0:
  988. !! energy usage flag on. Can be used in events to show that sveta is getting hungry or thirsty
  989. energytomilkpump = 1
  990. lactation['produced_milk'] = func('lact_lib','prod_milk',lactation['get_bm_milkedvolume'])
  991. end
  992. end
  993. !! 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.
  994. if temp_var > lactation['get_bm_milkedvolume']: lactation['dailyoverdemand'] += (temp_var - lactation['get_bm_milkedvolume'])
  995. !! time to add the pumped lactation['breastmv'] to the milkedvolume and empty lactation['breastmv'].
  996. lactation['get_bm_milkedvolume'] += lactation['breastmv']
  997. lactation['breastmv'] = 0
  998. !! 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.
  999. !! Else - there will only be nipple pain.
  1000. if lactation['max_nip_flow_rate'] < lactation['suck_flow_rate']:
  1001. temp_var = pain['nipples'] + ((lactation['suck_flow_rate'] - lactation['max_nip_flow_rate'])*ARGS[2])/2000 - (lactation['soreness_mod']*ARGS[2])*15
  1002. if temp_var >= 60:
  1003. pain['nipples'] = 65
  1004. elseif temp_var <= 0:
  1005. pain['nipples'] += 1
  1006. else
  1007. pain['nipples'] += (((lactation['suck_flow_rate'] - lactation['max_nip_flow_rate'])*ARGS[2])/2000 - (lactation['soreness_mod']*ARGS[2])*15)
  1008. end
  1009. else
  1010. if ARGS[2] < 10:
  1011. pain['nipples'] += 1
  1012. elseif ARGS[2] >= 10 and lactation['soreness_mod'] > ARGS[2]:
  1013. pain['nipples'] += 1
  1014. else
  1015. pain['nipples'] += (ARGS[2]/10 - lactation['soreness_mod']/10)
  1016. end
  1017. end
  1018. if lactation['max_nip_flow_rate'] >= lactation['suck_flow_rate']:
  1019. if (lactation['suck_flow_rate']*100) > ((lactation['lactaterate']*100)/60):
  1020. temp_var = pain['breasts'] + (((lactation['suck_flow_rate']*100)-((lactation['lactaterate']*100)/60))*pumptime_left)/1000
  1021. if temp_var > 20:
  1022. pain['breasts'] = 20
  1023. else
  1024. pain['breasts'] += (((lactation['suck_flow_rate']*100)-((lactation['lactaterate']*100)/60))*pumptime_left)/1000
  1025. end
  1026. end
  1027. else
  1028. if (lactation['max_nip_flow_rate']*100) > ((lactation['lactaterate']*100)/60):
  1029. temp_var = pain['breasts'] + (((lactation['max_nip_flow_rate']*100)-((lactation['lactaterate']*100)/60))*pumptime_left)/1000
  1030. if temp_var > 20:
  1031. pain['breasts'] = 20
  1032. else
  1033. pain['breasts'] += (((lactation['max_nip_flow_rate']*100)-((lactation['lactaterate']*100)/60))*pumptime_left)/1000
  1034. end
  1035. end
  1036. end
  1037. end
  1038. if pumptime < 10:
  1039. breastcounter += 1
  1040. else
  1041. breastcounter += pumptime/10
  1042. end
  1043. !! checking for engorgement
  1044. func('lact_lib','breast_engorment')
  1045. !! Done - Result is the milked volume.
  1046. result = lactation['get_bm_milkedvolume']
  1047. end
  1048. end
  1049. --- lact_lib ---------------------------------