@@ -9,6 +9,7 @@ include "scenario/scripts/entity.lua"
99include " scenario/scripts/misc.lua"
1010include " scenario/scripts/token.lua"
1111include " scenario/scripts/ui.lua"
12+ include " scripts/canreproduce.lua"
1213
1314--- Service for modifiying animals
1415AnimalService = {}
@@ -115,6 +116,22 @@ function AnimalService.setBathroom (animal, bathroom)
115116 setNeed (animal , " bathroom" , bathroom )
116117end
117118
119+ ---- BREATH ----
120+
121+ --- Get animal breath
122+ --- @param animal animal
123+ --- @return float
124+ function AnimalService .getBreath (animal )
125+ return animal :BFG_GET_ATTR_FLOAT (" breath" )
126+ end
127+
128+ --- Set animal breath
129+ --- @param animal animal
130+ --- @param breath float
131+ function AnimalService .setBreath (animal , breath )
132+ setNeed (animal , " breath" , breath )
133+ end
134+
118135---- CRATE ----
119136
120137--- Set animal crated status
@@ -128,6 +145,20 @@ function AnimalService.setCrated (animal, isCrated)
128145 end
129146end
130147
148+ --- Get whether or not an animal can be crated
149+ --- @param animal animal
150+ --- @return bool
151+ function AnimalService .getCrateOption (animal )
152+ return animal :BFG_GET_ATTR_BOOLEAN (" b_showCrate" )
153+ end
154+
155+ --- Set whether or not an animal can be crated
156+ --- @param animal animal
157+ --- @param canBeCrated bool
158+ function AnimalService .setCrateOption (animal , canBeCrated )
159+ animal :BFG_SET_ATTR_BOOLEAN (" b_showCrate" , canBeCrated )
160+ end
161+
131162---- DELETE ----
132163
133164--- Delete animal
@@ -168,6 +199,18 @@ function AnimalService.setExercise (animal, exercise)
168199 setNeed (animal , " exercise" , exercise )
169200end
170201
202+ ---- FAMILY ----
203+
204+ --- Get an animal's children
205+ --- @param animal animal
206+ --- @return animalList
207+ function AnimalService .getChildren (animal )
208+ local childrenList = animal :sendMessage (" BFAI_GET_RELATED_ENTITIES" , " child" )
209+ if childrenList ~= nil and type (childrenList ) == " table" then
210+ return childrenList
211+ end
212+ end
213+
171214---- GENDER ----
172215
173216--- Get animal gender, returns true if male, false if female
@@ -294,6 +337,13 @@ function AnimalService.setPregnant (animal, isPregnant)
294337 end
295338end
296339
340+ --- Get if animal has pregnancy token
341+ --- @param animal animal
342+ --- @return bool
343+ function AnimalService .getPregnancyToken (animal )
344+ return checkforpregnant (animal )
345+ end
346+
297347---- PRIVACY ----
298348
299349--- Get animal privacy
@@ -342,6 +392,29 @@ function AnimalService.setReleaseOption (animal, canBeReleased)
342392 animal :BFG_SET_ATTR_BOOLEAN (" b_showRelease" , canBeReleased )
343393end
344394
395+ ---- REPRODUCTION ----
396+
397+ --- Get animal reproduction stat
398+ --- @param animal animal
399+ --- @return float
400+ function AnimalService .getReproduction (animal )
401+ return animal :BFG_GET_ATTR_FLOAT (" reproduction" )
402+ end
403+
404+ --- Set animal reproduction stat
405+ --- @param animal animal
406+ --- @param reproduction float
407+ function AnimalService .setReproduction (animal , reproduction )
408+ setNeed (animal , " reproduction" , reproduction )
409+ end
410+
411+ --- Get if animal can reproduce
412+ --- @param animal animal
413+ --- @return bool
414+ function AnimalService .getCanReproduce (animal )
415+ return canreproduce (animal )
416+ end
417+
345418---- REST ----
346419
347420--- Get animal rest status
0 commit comments