| @@ -922,6 +922,55 @@ fn colonists_sow_empty_farm_tiles() { |
| 922 |
922 |
); |
| 923 |
923 |
} |
| 924 |
924 |
|
|
925 |
+ |
|
926 |
+ |
|
927 |
+#[test] |
|
928 |
+fn hungry_colonies_sow_before_gathering_materials() { |
|
929 |
+ let farm = [UVec2::new(8, 8)]; |
|
930 |
+ let mut app = farm_app(&farm); |
|
931 |
+ app.world_mut() |
|
932 |
+ .resource_mut::<WorldMap>() |
|
933 |
+ .set_plant(UVec2::new(3, 2), Some(Plant::Tree)); |
|
934 |
+ set_goals( |
|
935 |
+ &mut app, |
|
936 |
+ &[(ItemKind::Vegetables, 30), (ItemKind::Wood, 30)], |
|
937 |
+ ); |
|
938 |
+ let colonist = spawn_colonist(&mut app, UVec2::new(2, 2)); |
|
939 |
+ run_ticks(&mut app, 61); |
|
940 |
+ assert!(matches!( |
|
941 |
+ task(&app, colonist), |
|
942 |
+ Some(Task::Work { |
|
943 |
+ kind: WorkKind::Sow, |
|
944 |
+ .. |
|
945 |
+ }) |
|
946 |
+ )); |
|
947 |
+} |
|
948 |
+ |
|
949 |
+#[test] |
|
950 |
+fn hungry_colonies_harvest_before_gathering_materials() { |
|
951 |
+ let farm = [UVec2::new(8, 8)]; |
|
952 |
+ let mut app = farm_app(&farm); |
|
953 |
+ { |
|
954 |
+ let mut map = app.world_mut().resource_mut::<WorldMap>(); |
|
955 |
+ map.set_plant(UVec2::new(3, 2), Some(Plant::Tree)); |
|
956 |
+ map.set_plant(farm[0], Some(Plant::Crop)); |
|
957 |
+ map.set_growth(farm[0], 1.0); |
|
958 |
+ } |
|
959 |
+ set_goals( |
|
960 |
+ &mut app, |
|
961 |
+ &[(ItemKind::Vegetables, 30), (ItemKind::Wood, 30)], |
|
962 |
+ ); |
|
963 |
+ let colonist = spawn_colonist(&mut app, UVec2::new(2, 2)); |
|
964 |
+ run_ticks(&mut app, 61); |
|
965 |
+ assert!(matches!( |
|
966 |
+ task(&app, colonist), |
|
967 |
+ Some(Task::Work { |
|
968 |
+ kind: WorkKind::Harvest, |
|
969 |
+ .. |
|
970 |
+ }) |
|
971 |
+ )); |
|
972 |
+} |
|
973 |
+ |
| 925 |
974 |
#[test] |
| 926 |
975 |
fn ripe_crops_are_harvested_into_vegetables_and_resown() { |
| 927 |
976 |
let farm = [UVec2::new(8, 8)]; |