Browse Source

[fixed] Logic errors and variable errors
gpoli:
-Updated variables and logic errors during pumping
lact_lib:
-fixed logic errors with milk production
-updated variables to new system

sandra_schulz 5 years ago
parent
commit
ba7ed4ece3
2 changed files with 113 additions and 102 deletions
  1. 51 45
      locations/gpoli.qsrc
  2. 62 57
      locations/lact_lib.qsrc

+ 51 - 45
locations/gpoli.qsrc

@@ -1307,6 +1307,7 @@ if $ARGS[0] = 'maternity_ward':
 	*clr & cla
 	gs 'stat'
 	minut += 5
+	lact_ev['gpoli_temp_var'] = 0
 	if hour >= 6 and hour <= 20:
 		'<center><img <<$set_imgh>> src="images/locations/pavlovsk/clinic/mward/mward.jpg"></center>'
 		'<center>You are at the maternity ward. There are alot of babies and nurses taking care of them.</center>'
@@ -1320,7 +1321,7 @@ if $ARGS[0] = 'maternity_ward':
 				'Nurse: Hello <<$pcs_firstname>>, how can I help you?'
 				act 'Donate your breast milk (0:15)':
 					*clr & cla
-					milkedvolume = 0
+					lact_ev['gpoli_milkedvolume'] = 0
 					pcs_gpoli_donationsessioncount = 0
 					!!if rand(0,100) = 95 and orphanfeed = 0:
 					!!	orphanfeed = 1
@@ -1458,8 +1459,8 @@ if $ARGS[0] = 'maternity_ward':
 							*clr & cla
 							minut += 10
 							pcs_gpolimilkdonation = 2
-							milkedvolume = (func('lact_lib','$get_breastmilk', 5, 1))/100
-							milkedvolume = 0
+							lact_ev['gpoli_milkedvolume'] = (func('lact_lib','$get_breastmilk', 5, 1))/100
+							lact_ev['gpoli_milkedvolume'] = 0
 							lactation['pc_aware'] = 1
 							'<center><img <<$set_imgh>> src="images/locations/pavlovsk/clinic/mward/pump_room.jpg"></center>'
 							'The nurse leads you into a room. It is quiet in here. There is a chair a table and a breastpump.'
@@ -1532,13 +1533,13 @@ if $ARGS[0] = 'maternity_ward':
 									'Nurse: Okay, I am going to pump a bit milk off first, to check the quality and if you are able to donate enough. So this time you won''t get paid for your milk.'
 									'You nod and pull up your shirt. The nurse takes the pumps and puts them on your breasts. She flicks a switch and you can feel your nipples being sucked in with force. The pump slowly working your nipples.'
 									'<center><img <<$set_imgh>> src="images/locations/pavlovsk/clinic/mward/pumping.jpg"></center>'
-									milkedvolume = (func('lact_lib','$get_breastmilk', 4, 15))/100
-									breastpumped += 4
+									lact_ev['gpoli_milkedvolume'] = (func('lact_lib','$get_breastmilk', 4, 15))/100
+									lactation['breastpumped'] = 1
 									pcs_orphanfeed = 0
-									if milkedvolume >= 1000:
+									if lact_ev['gpoli_milkedvolume'] >= 1000:
 										'Your breasts are able to fill both small bottles easily. The nurse nods at you confidently.'
 										'Nurse: Yes, it seems you are able to make good amount of milk. You could breastfeed a baby with no issue.'
-									elseif milkedvolume >= 500 and milkedvolume < 1000:
+									elseif lact_ev['gpoli_milkedvolume'] >= 500 and lact_ev['gpoli_milkedvolume'] < 1000:
 										'Your breasts are not able to fill both small bottles. The nurse rises an eyebrow on you.'
 										'Nurse: Okay... it seems you are able to make enough milk for a 50ml donation, but you could have trouble to breastfeed a baby properly.'
 									else
@@ -1546,10 +1547,10 @@ if $ARGS[0] = 'maternity_ward':
 										'Nurse: Mhmm ... your breasts don''t seem to make enough milk. You can still come here and get yourself pumped, but we need at least 50ml for a valid donation.'
 									end
 									'The nurse detaches the pump and allows you to dress up again.'
-									if milkedvolume > 500:
+									if lact_ev['gpoli_milkedvolume'] > 500:
 										mward_donatesv = 500
 									else
-										mward_donatesv = milkedvolume
+										mward_donatesv = lact_ev['gpoli_milkedvolume']
 									end
 									if salo > 40:
 										mward_donatesf = 60
@@ -1616,13 +1617,13 @@ if $ARGS[0] = 'maternity_ward':
 									'Nurse: Okay, I am going to pump a bit milk off first, to check the quality and if you are able to donate enough. So this time you won''t get paid for your milk.'
 									'You nod and pull up your shirt. The nurse takes the pumps and puts them on your breasts. She flicks a switch and you can feel your nipples being sucked in with force. The pump slowly working your nipples.'
 									'<center><img <<$set_imgh>> src="images/locations/pavlovsk/clinic/mward/pumping.jpg"></center>'
-									milkedvolume = (func('lact_lib','$get_breastmilk', 4, 15))/100
-									breastpumped += 4
+									lact_ev['gpoli_milkedvolume'] = (func('lact_lib','$get_breastmilk', 4, 15))/100
+									lactation['breastpumped'] = 1
 									pcs_orphanfeed = 0
-									if milkedvolume >= 1000:
+									if lact_ev['gpoli_milkedvolume'] >= 1000:
 										'Your breasts are able to fill both small bottles easily. The nurse nods at you confidently.'
 										'Nurse: Yes, it seems you are able to make good amount of milk. You could breastfeed a baby with no issue.'
-									elseif milkedvolume >= 500 and milkedvolume < 1000:
+									elseif lact_ev['gpoli_milkedvolume'] >= 500 and lact_ev['gpoli_milkedvolume'] < 1000:
 										'Your breasts are not able to fill both small bottles. The nurse rises an eyebrow on you.'
 										'Nurse: Okay... it seems you are able to make enough milk for a 50ml donation, but you could have trouble to breastfeed a baby properly.'
 									else
@@ -1630,10 +1631,10 @@ if $ARGS[0] = 'maternity_ward':
 										'Nurse: Mhmm ... your breasts don''t seem to make enough milk. You can still come here and get yourself pumped, but we need at least 50ml for a valid donation.'
 									end
 									'The nurse detaches the pump and allows you to dress up again.'
-									if milkedvolume > 500:
+									if lact_ev['gpoli_milkedvolume'] > 500:
 										mward_donatesv = 500
 									else
-										mward_donatesv = milkedvolume
+										mward_donatesv = lact_ev['gpoli_milkedvolume']
 									end
 									if salo > 40:
 										mward_donatesf = 60
@@ -1703,13 +1704,13 @@ if $ARGS[0] = 'maternity_ward':
 						'Nurse: Okay, I am going to pump a bit milk off first, to check the quality and if you are able to donate enough.'
 						'You nod and pull up your shirt. The nurse takes the pumps and puts it on your breasts. She flicks a switch and you can feel your nipples being sucked in with force. The pump slowly working your nipples.'
 						'<center><img <<$set_imgh>> src="images/locations/pavlovsk/clinic/mward/pumping.jpg"></center>'
-						milkedvolume = (func('lact_lib','$get_breastmilk', 4, 15))/100
-						breastpumped += 4
+						lact_ev['gpoli_milkedvolume'] = (func('lact_lib','$get_breastmilk', 4, 15))/100
+						lactation['breastpumped'] = 1
 						pcs_orphanfeed = 0
-						if milkedvolume >= 1000:
+						if lact_ev['gpoli_milkedvolume'] >= 1000:
 							'Your breasts are able to fill both small bottles easily. The nurse nods at you confidently.'
 							'Nurse: Yes, it seems you are able to make good amount of milk. You could breastfeed a baby with no issue.'
-						elseif milkedvolume >= 50 and milkedvolume < 1000:
+						elseif lact_ev['gpoli_milkedvolume'] >= 50 and lact_ev['gpoli_milkedvolume'] < 1000:
 							'Your breasts are not able to fill both small bottles. The nurse rises an eyebrow on you.'
 							'Nurse: Okay... it seems you are able to make enough milk for a donation, but you could have trouble to breastfeed a baby properly.'
 						else
@@ -1717,10 +1718,10 @@ if $ARGS[0] = 'maternity_ward':
 							'Nurse: Mhmm ... your breasts don''t seem to make enough milk. You can still come and be pumped, but we need at least 50ml for a valid donation.'
 						end
 						'The nurse detaches the pump and allows you to dress up again.'
-						if milkedvolume > 500:
+						if lact_ev['gpoli_milkedvolume'] > 500:
 							mward_donatesv = 500
 						else
-							mward_donatesv = milkedvolume
+							mward_donatesv = lact_ev['gpoli_milkedvolume']
 						end
 						if salo > 40:
 							mward_donatesf = 60
@@ -1778,40 +1779,45 @@ if $ARGS[0] = 'maternity_ward_donation':
 		end
 		act 'Continue':
 			*clr & cla
-			milkedvolume = (func('lact_lib','$get_breastmilk', 4, 15))/100
-			breastpumped += 4
+			lact_ev['gpoli_milkedvolume'] = func('lact_lib','$get_breastmilk', 4, 15)
+			lactation['breastpumped'] = 1
 			'After 15 minutes, the nurse detaches the pumps from your breasts.'
-			if milkedvolume > 500:
-				temp_var = milkedvolume/500
-				pcs_gpoli_donationsessioncount += temp_var
+			if lact_ev['gpoli_milkedvolume'] => 50000:
+				lact_ev['gpoli_temp_var'] = (lact_ev['gpoli_milkedvolume']/50000)
+				pcs_gpoli_donationsessioncount += lact_ev['gpoli_temp_var'] 
 				pcs_gpoli_totalmilkdonation_count += 1
-				pcs_gpoli_totalmilkdonation += temp_var*50
-				if temp_var < 2:
-					'She looks satisfied at you as she puts away one bottle with 50ml of your breast milk.'
-				elseif temp_var >= 12:
-					'She looks astonished at the at the marvelous amounts of milk you made as she stores away the <<temp_var>> bottles that contain <<temp_var*50>>ml of your breast milk.'
+				pcs_gpoli_totalmilkdonation += (lact_ev['gpoli_temp_var']*50)
+				if lact_ev['gpoli_temp_var'] >= 12:
+					'She looks astonished at the at the marvelous amounts of milk you made as she stores away the <<lact_ev[''gpoli_temp_var'']>> bottles that contain <<lact_ev[''gpoli_temp_var'']*50>>ml of your breast milk.'
 					'Nurse: <<$pcs_firstname>>, this is so much milk, I think a cow would be jealous!'
 					'She laughts heartily and you blush a bit.'
-				elseif temp_var >= 10:
-					'She looks amazed at the at the copious amounts of milk you made as she stores away the <<temp_var>> bottles that contain <<temp_var*50>>ml of your breast milk.'
+				elseif lact_ev['gpoli_temp_var'] >= 10:
+					'She looks amazed at the at the copious amounts of milk you made as she stores away the <<lact_ev[''gpoli_temp_var'']>> bottles that contain <<lact_ev[''gpoli_temp_var'']*50>>ml of your breast milk.'
 					'Nurse: Oh dear, where do you store all this milk in your breast...?'
-				elseif temp_var >= 8:
-					'She looks surprised at the at the large amount of milk you made as she stores away the <<temp_var>> bottles that contain <<temp_var*50>>ml of your breast milk.'
+				elseif lact_ev['gpoli_temp_var'] >= 8:
+					'She looks surprised at the at the large amount of milk you made as she stores away the <<lact_ev[''gpoli_temp_var'']>> bottles that contain <<lact_ev[''gpoli_temp_var'']*50>>ml of your breast milk.'
 					'Nurse: Dear, this is really much milk...'
-				elseif temp_var >= 6:
-					'She looks pleasantly satisfied at you as she puts away the <<temp_var>> bottles containing <<temp_var*50>>ml of your breast milk.'
+				elseif lact_ev['gpoli_temp_var'] >= 6:
+					'She looks pleasantly satisfied at you as she puts away the <<lact_ev[''gpoli_temp_var'']>> bottles containing <<lact_ev[''gpoli_temp_var'']*50>>ml of your breast milk.'
 					'Nurse: Oh, this is pretty much milk.'
-				elseif temp_var >= 4:
-					'She looks satisfied at you as she puts away the <<temp_var>> bottles containing <<temp_var*50>>ml of your breast milk.'
+				elseif lact_ev['gpoli_temp_var'] >= 4:
+					'She looks satisfied at you as she puts away the <<lact_ev[''gpoli_temp_var'']>> bottles containing <<lact_ev[''gpoli_temp_var'']*50>>ml of your breast milk.'
 					'Nurse: This is a good amount of milk.'
+				elseif lact_ev['gpoli_temp_var'] >= 2:
+					'She looks satisfied at you as she puts away <<lact_ev[''gpoli_temp_var'']>> bottles with <<lact_ev[''gpoli_temp_var'']*50>>ml of your breast milk inside.'
+				elseif lact_ev['gpoli_temp_var'] = 1:
+					'She looks satisfied at you as she puts away one bottle with 50ml of your breast milk.'
 				else
-					'She looks satisfied at you as she puts away <<temp_var>> bottles with <<temp_var*50>>ml of your breast milk inside.'
+					'She looks satisfied at you as she puts away <<lact_ev[''gpoli_temp_var'']>> bottles with <<lact_ev[''gpoli_temp_var'']*50>>ml of your breast milk inside.'
 				end
-			else
+			elseif lact_ev['gpoli_milkedvolume'] < 50000 and lact_ev['gpoli_milkedvolume'] > 0:
 				'She looks at you a bit disappointed.'
-				'Nurse: Mhmm... I am sorry, but this isn''t enough milk for a valid donation. You only made <<milkedvolume/10>>ml of breast milk.'
+				'Nurse: Mhmm... I am sorry, but this isn''t enough milk for a valid donation. You only made <<lact_ev[''gpoli_milkedvolume'']/1000>>ml of breast milk.'
+			else
+				'She looks at you disappointed.'
+				'Nurse: Mhmm... I am sorry, but this isn''t enough milk for a valid donation. You made no breast milk at all.'
 			end
-			milkedvolume = 0
+			lact_ev['gpoli_milkedvolume'] = 0
 			if pcs_gpoli_donationsessioncount > 0:
 				mward_donatemoney = (((pcs_gpoli_donationsessioncount*500)/3)*75)/100
 			else
@@ -1833,7 +1839,7 @@ if $ARGS[0] = 'maternity_ward_donation':
 						'You put on your top'
 					end
 					act 'leave':
-						milkedvolume = 0
+						lact_ev['gpoli_milkedvolume'] = 0
 						gt 'gpoli', 'maternity_ward'
 					end
 				end
@@ -1849,7 +1855,7 @@ if $ARGS[0] = 'maternity_ward_donation':
 						'You put on your top'
 					end
 					act 'leave':
-						milkedvolume = 0
+						lact_ev['gpoli_milkedvolume'] = 0
 						gt 'gpoli', 'maternity_ward'
 					end
 				end

+ 62 - 57
locations/lact_lib.qsrc

@@ -350,62 +350,72 @@ if $ARGS[0] = 'prod_milk':
 	!!	func('lact_lib','prod_milk',milkamount)
 	!!	result = produced breast milk amount in ml*1000
 	!!	ARGS[1] = Requested milk production amount produced in ml*1000. Usually should be the lactaterate.
+	!!	If there was milk pumped or produced during the hour, this has to be substracted.
+	if lactation['used_lactaterate'] > 0:
+		lactation['prod_milk_req'] = (ARGS[1] - lactation['used_lactaterate'])
+		lactation['used_lactaterate'] += ARGS[1]
+		if lactation['used_lactaterate'] > lactation['lactaterate']: lactation['used_lactaterate'] = lactation['lactaterate']
+	else
+		lactation['prod_milk_req'] = ARGS[1]
+		lactation['used_lactaterate'] += ARGS[1]
+		if lactation['used_lactaterate'] > lactation['lactaterate']: lactation['used_lactaterate'] = lactation['lactaterate']
+	end
 	!!	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.
 	if lactation['active'] > 0 and salo > 15:
 		!!	checking how much hydration, stamina and hunger is needed to produce x amount of breast milk
 		!!	checking if enough stamina and hydra is available
-		if (ARGS[1]/10000) < pcs_stam and (ARGS[1]/10000) < pcs_hydra:
+		if (lactation['prod_milk_req']/10000) < pcs_stam and (lactation['prod_milk_req']/10000) < pcs_hydra:
 			!!	full requested milk amount can be produced. substracting from stamina, hydration energy.
-			if (ARGS[1]/10000) < 1:
+			if (lactation['prod_milk_req']/10000) < 1:
 				pcs_stam -= 1
 				pcs_hydra -= 1
 			else
-				pcs_stam -= (ARGS[1]/10000)
-				pcs_hydra -= (ARGS[1]/10000)
+				pcs_stam -= (lactation['prod_milk_req']/10000)
+				pcs_hydra -= (lactation['prod_milk_req']/10000)
 			end
 			if pcs_stam < 1: pcs_stam = 1
 			if pcs_hydra < 1: pcs_hydra = 1
-			if (ARGS[1]/9000) < pcs_energy:
-				if (ARGS[1]/9000) < 1:
+			if (lactation['prod_milk_req']/9000) < pcs_energy:
+				if (lactation['prod_milk_req']/9000) < 1:
 					pcs_energy -= 1
 				else
-					pcs_energy -= (ARGS[1]/9000)
+					pcs_energy -= (lactation['prod_milk_req']/9000)
 					if pcs_energy < 1: pcs_energy = 1
 				end
-				result = ARGS[1]
+				result = lactation['prod_milk_req']
 			else
 				!!	If energy is too low, milk will be produced but there is a chance that salo will shrink.
 				pcs_energy = 1
 				if rand(0,100) > 95: salo -= 1
 				if pain['breasts'] < 20: pain['breasts'] += 1
-				result = ARGS[1]
+				result = lactation['prod_milk_req']
 			end
 		elseif pcs_stam <= 0 or pcs_hydra <= 0:
 			!!	if sveta has not enough hydration or stamina, no milk is produced.
 			result = 0
 		else
 			if (pcs_stam*10000) < (pcs_hydra*10000):
-				temp_var = (pcs_stam*10000)
+				lactation['prod_milk_temp_var'] = (pcs_stam*10000)
 				pcs_stam = 1
-				if (ARGS[1]/10000) < pcs_hydra:
-					pcs_hydra -= (ARGS[1]/10000)
+				if (lactation['prod_milk_req']/10000) < pcs_hydra:
+					pcs_hydra -= (lactation['prod_milk_req']/10000)
 				else
 					pcs_hydra = 1
 				end
 			else
-				temp_var = (pcs_hydra*10000)
+				lactation['prod_milk_temp_var'] = (pcs_hydra*10000)
 				pcs_hydra = 1
-				if (ARGS[1]/10000) < pcs_stam:
-					pcs_stam -= (ARGS[1]/10000)
+				if (lactation['prod_milk_req']/10000) < pcs_stam:
+					pcs_stam -= (lactation['prod_milk_req']/10000)
 				else
 					pcs_stam = 1
 				end
 			end
-			if (temp_var/9000) < pcs_energy:
-				if (temp_var/9000) < 1:
+			if (lactation['prod_milk_temp_var']/9000) < pcs_energy:
+				if (lactation['prod_milk_temp_var']/9000) < 1:
 					pcs_energy -= 1
 				else
-					pcs_energy -= (temp_var/9000)
+					pcs_energy -= (lactation['prod_milk_temp_var']/9000)
 					if pcs_energy < 1: pcs_energy = 1
 				end
 			else
@@ -417,7 +427,7 @@ if $ARGS[0] = 'prod_milk':
 			if pcs_energy < 1: pcs_energy = 1
 			if pcs_hydra < 1: pcs_hydra = 1
 			if pcs_stam < 1: pcs_stam = 1
-			result = temp_var			
+			result = lactation['prod_milk_temp_var']			
 		end
 	else
 		result = 0
@@ -654,6 +664,8 @@ if $ARGS[0] = 'breastcycle':
 			lactation['breastmv'] += lactation['lactaterate']
 			if lactation['breastmv'] > lactation['breastmm']: lactation['breastmv'] = lactation['breastmm']
 		end
+		!!	Reset used_lactaterate, so milk can be produced again.
+		lactation['used_lactaterate'] = 0
 		func('lact_lib','breast_engorment')
 	end
 	if lactation['milkgrowday'] < daystart:
@@ -812,10 +824,10 @@ if $ARGS[0] = '$get_breastmilk_time':
 		!!	max nip flow rate initialized
 		lactation['max_nip_flow_rate'] = func('lact_lib','get_maxnipflowrate')
 		!!	getting temp lactaterate
-		if (lactaterate/60) < 1 and lactaterate > 0:
+		if (lactation['lactaterate']/60) < 1 and lactation['lactaterate'] > 0:
 			temp_lactaterate = 1
 		else
-			temp_lactaterate = lactaterate/60
+			temp_lactaterate = lactation['lactaterate']/60
 		end
 
 		if lactation['breastmv'] >= (ARGS[2]*10):
@@ -933,16 +945,16 @@ if $ARGS[0] = '$get_breastmilk':
 		!!	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.
 		!!	If we only need 20ml from a 100ml storage, we would only substract 20ml, leaving 80ml inside the breasts.
 		!!	Also lets make sure we start at zero from the stuff we get from Sveta.
-		milkedvolume = 0
+		lactation['get_bm_milkedvolume'] = 0
 		!!	Case: Enough milk in Svetas breasts, covering the demand
 		if lactation['breastmv'] >= max_sucktion_demand:
 			!!	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.
 			if lactation['max_nip_flow_rate'] >= lactation['suck_flow_rate']:
-				milkedvolume = max_sucktion_demand
+				lactation['get_bm_milkedvolume'] = max_sucktion_demand
 				lactation['breastmv'] -= max_sucktion_demand
 			else:
-				milkedvolume = lactation['max_nip_flow_rate']*ARGS[2]
-				lactation['breastmv'] -= milkedvolume
+				lactation['get_bm_milkedvolume'] = lactation['max_nip_flow_rate']*ARGS[2]
+				lactation['breastmv'] -= lactation['get_bm_milkedvolume']
 			end
 		!!	Case: Not enough milk in Svetas breasts.
 		elseif lactation['breastmv'] < max_sucktion_demand:
@@ -962,58 +974,51 @@ if $ARGS[0] = '$get_breastmilk':
 			end
 			!!	Now we know how much time we have and how much demand we have. Time to check if Sveta can do it.
 			!!	For the case, that svetas milk flow is not big enough pumptime left will be 0, therefore this is handled here.
-			if pumptime_left >0:
+			if pumptime_left > 0:
 				if lactation['max_nip_flow_rate'] >= lactation['suck_flow_rate']:
 					!!	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.
-					if (lactation['suck_flow_rate']*100) <= ((lactaterate*100)/60):
-						milkedvolume += lactation['suck_flow_rate']*pumptime_left
+					if (lactation['suck_flow_rate']*100) <= ((lactation['lactaterate']*100)/60):
+						lactation['get_bm_milkedvolume'] += lactation['suck_flow_rate']*pumptime_left
 					else
-						milkedvolume += ((((lactaterate*100)/60)*pumptime_left)/100)
+						lactation['get_bm_milkedvolume'] += ((((lactation['lactaterate']*100)/60)*pumptime_left)/100)
 						breastcounter += 2
 					end
 				else
 					!!	Same here as above.
-					if (lactation['max_nip_flow_rate']*100) <= ((lactaterate*100)/60):
-						milkedvolume += lactation['max_nip_flow_rate']*pumptime_left
+					if (lactation['max_nip_flow_rate']*100) <= ((lactation['lactaterate']*100)/60):
+						lactation['get_bm_milkedvolume'] += lactation['max_nip_flow_rate']*pumptime_left
 						breastcounter += 2
 					else
-						milkedvolume += ((((lactaterate*100)/60)*pumptime_left)/100)
+						lactation['get_bm_milkedvolume'] += ((((lactation['lactaterate']*100)/60)*pumptime_left)/100)
 						breastcounter += 2
 					end
 				end
-				!!	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
+				!!	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
 				if pumptime_left > 60:
 					if ((pumptime_left*100)/60) > 100:
-						lactaterate_use -= ((((lactaterate*100)/60)*(pumptime_left mod 60))/100)
+						lactation['used_lactaterate'] -= ((((lactation['lactaterate']*100)/60)*(pumptime_left mod 60))/100)
 					else
-						lactaterate_use = lactaterate
+						lactation['used_lactaterate'] = lactation['lactaterate']
 					end
 				else
-					if lactaterate >= lactaterate_use:
-						lactaterate_use -= milkedvolume
+					if lactation['lactaterate'] >= lactation['used_lactaterate']:
+						lactation['used_lactaterate'] -= lactation['get_bm_milkedvolume']
 					else
-						lactaterate_use = lactaterate
+						lactation['used_lactaterate'] = lactation['lactaterate']
 					end
 				end
-				if lactaterate_use <= 0: lactaterate_use = 0
+				if lactation['used_lactaterate'] <= 0: lactation['used_lactaterate'] = 0
 				!!	Sveta had to make milk, so she needs to use some of her body resources to make the milk.
-				if milkedvolume > 0:
+				if lactation['get_bm_milkedvolume'] > 0:
 					!!	energy usage flag on. Can be used in events to show that sveta is getting hungry or thirsty
 					energytomilkpump = 1
-					pcs_stam -= max_sucktion_demand/30000
-					if pcs_stam <= 0: pcs_stam = 0
-					pcs_sweat += pumptime/30
-					pcs_hydra -= milkedvolume/120
-					if pcs_hydra < 1: pcs_hydra = 1
-					pcs_energy -= milkedvolume/1200
+					func('lact_lib','prod_milk',lactation['get_bm_milkedvolume'])
 				end
 			end
 			!!	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.
-			if temp_var > milkedvolume:
-				lactation['dailyoverdemand'] += (temp_var - milkedvolume)
-			end
+			if temp_var > lactation['get_bm_milkedvolume']: lactation['dailyoverdemand'] += (temp_var - lactation['get_bm_milkedvolume'])
 			!!	time to add the pumped lactation['breastmv'] to the milkedvolume and empty lactation['breastmv'].
-			milkedvolume += lactation['breastmv']
+			lactation['get_bm_milkedvolume'] += lactation['breastmv']
 			lactation['breastmv'] = 0
 			!!	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.
 			!!	Else - there will only be nipple pain.
@@ -1036,21 +1041,21 @@ if $ARGS[0] = '$get_breastmilk':
 				end
 			end
 			if lactation['max_nip_flow_rate'] >= lactation['suck_flow_rate']:
-				if (lactation['suck_flow_rate']*100) > ((lactaterate*100)/60):
-					temp_var = pain['breasts'] + (((lactation['suck_flow_rate']*100)-((lactaterate*100)/60))*pumptime_left)/1000
+				if (lactation['suck_flow_rate']*100) > ((lactation['lactaterate']*100)/60):
+					temp_var = pain['breasts'] + (((lactation['suck_flow_rate']*100)-((lactation['lactaterate']*100)/60))*pumptime_left)/1000
 					if temp_var > 20:
 						pain['breasts'] = 20
 					else
-						pain['breasts'] += (((lactation['suck_flow_rate']*100)-((lactaterate*100)/60))*pumptime_left)/1000
+						pain['breasts'] += (((lactation['suck_flow_rate']*100)-((lactation['lactaterate']*100)/60))*pumptime_left)/1000
 					end
 				end
 			else
-				if (lactation['max_nip_flow_rate']*100) > ((lactaterate*100)/60):
-					temp_var = pain['breasts'] + (((lactation['max_nip_flow_rate']*100)-((lactaterate*100)/60))*pumptime_left)/1000
+				if (lactation['max_nip_flow_rate']*100) > ((lactation['lactaterate']*100)/60):
+					temp_var = pain['breasts'] + (((lactation['max_nip_flow_rate']*100)-((lactation['lactaterate']*100)/60))*pumptime_left)/1000
 					if temp_var > 20:
 						pain['breasts'] = 20
 					else
-						pain['breasts'] += (((lactation['max_nip_flow_rate']*100)-((lactaterate*100)/60))*pumptime_left)/1000
+						pain['breasts'] += (((lactation['max_nip_flow_rate']*100)-((lactation['lactaterate']*100)/60))*pumptime_left)/1000
 					end
 				end
 			end
@@ -1061,7 +1066,7 @@ if $ARGS[0] = '$get_breastmilk':
 			breastcounter += pumptime/10
 		end
 		!!	Done - Result is the milked volume.
-		RESULT = milkedvolume
+		result = lactation['get_bm_milkedvolume']
 	end
 end