lact_lib.qsrc 53 KB

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