1
0

lact_lib.qsrc 62 KB

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