1
0

lact_lib.qsrc 55 KB

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