Commit Graph

89 Commits

Author SHA1 Message Date
reaperrr
3069bbfa7d Fix infinite loop in HeliReturnToBase
This can happen if HeliAttack tells the heli to return to base when the player doesn't have any of the RearmBuildings available, because the activity queues itself after the HRTB, and the latter will, after a forced land, then queue back HeliAttack, which then immediately queues back HRTB and so on.

Instead, we now assume that if there is no base to return to, going to NextActivity is pointless and don't queue NextActivity.
RTB was likely ordered by HeliAttack due to lack of ammo, so resuming the attack would be pointless.
2018-03-22 22:50:50 +01:00
Arular101
8a60918841 Update copyright notice year to 2018 2018-01-17 00:47:34 +01:00
GSonderling
488cec64b8 Added support for filtering exits by production type. 2017-12-13 04:08:52 +01:00
reaperrr
d602ec6485 Rename SelfReloads to AutoReloads 2017-11-12 19:48:06 +00:00
reaperrr
8b7a71685c Remove AmmoPool-awareness from Armament 2017-11-12 19:48:06 +00:00
reaperrr
6f95080aa4 Add ReloadAmmoPool and adapt AmmoPool
Refactored and simplified Rearm activity.
Uses local Reload now.

Removed AmmoPool.SelfReloads.
2017-11-12 19:48:06 +00:00
Paul Chote
1376ad674e Remove Player.CanViewActor and .CanTargetActor. 2017-11-03 09:56:00 +01:00
reaperrr
db2d432c39 Fix Helis facing target center instead of attacked position 2017-10-16 14:25:03 +02:00
Forcecore
b86d632c8c Land activity now lets the actor to land midair
Midair, at the altitude of the target actor.
2017-09-24 15:03:20 +02:00
reaperrr
5d58374962 Remove FlyCircleTimed activity
A FlyCircle overload is sufficient.
2017-08-31 18:03:59 +02:00
reaperrr
c9ff362ea2 Add TakeOffOnCreation and TakeOffOnResupply to Aircraft
Before this, it was impossible to replicate the behavior of the original games (staying on pad/airfield after reload) without hacking around in Mods.Common.
This allows modders to disable these without meddling with code.
2017-08-31 18:03:59 +02:00
reaperrr
c75e64a952 Properly account for disabled Armaments in various places
These places didn't care if an Armament was disabled, which could lead to unexpected behavior.
2017-08-22 20:55:46 +01:00
Paul Chote
dd709a2679 Revert "Have some activities count as idle activities"
This reverts commit ae111248f3.
2017-08-10 12:22:28 +02:00
Jean-Rémy Buchs
1d1802a163 Add LandOnCondition to the trait Aircraft which triggers a landing and prevents takeoffs while the condition is met 2017-08-08 15:13:50 -05:00
reaperrr
74437ed56c Merge pull request #13178 from rob-v/ReturnHeliToNearestBase
Helis return to nearest base like Planes
2017-05-07 13:16:40 +02:00
reaperrr
7dddc7fc44 Make FallToEarth kill the actor instead of disposing it 2017-04-24 19:12:31 +02:00
rob-v
df07d89f9e Helis return to nearest base like Planes 2017-04-22 15:53:05 +02:00
Oliver Brakmann
b50f15c645 Check for dead destination helipad in HeliReturnToBase 2017-04-17 19:31:53 +02:00
Oliver Brakmann
ff8f204cac Check for dead destination airfield in ReturnToBase 2017-04-17 19:23:11 +02:00
abcdefg30
ae111248f3 Have some activities count as idle activities 2017-03-24 18:06:10 +01:00
Oliver Brakmann
9993a235a7 Convert ResupplyAircraft into a CompositeActivity 2017-01-22 20:42:19 +01:00
Oliver Brakmann
9b0780e87c Make FlyAttack use child activities 2017-01-22 20:41:41 +01:00
Oliver Brakmann
e49b3d6458 Adjust existing activities for changed NextActivity semantics
To make sure existing checks against NextActivity don't check the parent activity by mistake
2017-01-22 20:41:37 +01:00
Taryn Hill
43317e0f5d Update copyright notice year to 2017 2016-12-31 23:46:13 -06:00
Paul Chote
9ddfdc45b3 Introduce SoundType enum. 2016-12-23 11:34:23 +00:00
Oliver Brakmann
2c66ee8c13 Add native support for uninterruptible activities
This pattern occurs a few times throughout the code, so it makes sense to bake it into the Activity class itself.
2016-10-31 18:46:27 +01:00
abcdefg30
55143ced87 Fix HeliReturnToBase not exposing an host actor parameter 2016-10-03 14:56:52 +02:00
Paul Chote
34b10dcb77 Hack around the Lua API. 2016-09-26 17:48:25 +01:00
Paul Chote
ea65ac542e Add AbortOnResupply property to cancel aircraft activities on resupply. 2016-09-25 15:57:17 +01:00
Paul Chote
eeaa461311 Avoid landing-dances when issuing mixed full/empty aircraft RTB orders. 2016-09-25 15:57:16 +01:00
Oliver Brakmann
852d947764 Fix setting MayYieldReservation when there is no reservation 2016-09-15 21:10:47 +02:00
Oliver Brakmann
9fbda6b598 Fix helicopters not taking off when their target got covered by shroud 2016-09-12 23:01:16 +02:00
Oliver Brakmann
daa1f16e98 Prevent an infinite loop when planes go out of ammo and all airfields are gone 2016-09-05 19:59:01 +02:00
Oliver Brakmann
351c231693 Use the yield reservation logic for helicopters as well. Oops. 2016-09-05 19:24:26 +02:00
Oliver Brakmann
fb1f8c4e01 Remove brain-dead logic from TakeOff
1. TakeOff's Tick() method never checks itself whether it is canceled
2. If NextActivity is null, TakeOff is the only activity on the queue
3. Takeoff canceling the queue then just cancels itself, with no effect at all

4. If Takeoff however is running as an inner activity, it will cancel the complete main queue, wrecking all sorts of havoc
2016-09-05 19:20:51 +02:00
Oliver Brakmann
7f64495d6f Make aircraft continue attack on same target after re-arming 2016-09-04 21:31:05 +02:00
Oliver Brakmann
e7d07e5a01 Fix FlyAttack not calling TakeOff for landed aircraft 2016-09-04 21:31:05 +02:00
Oliver Brakmann
6d15406ffe Fix aircraft reservation madness 2016-09-04 21:31:05 +02:00
Matthias Mailänder
020b0e628e Merge pull request #11871 from pchote/fix-production-circle
Remove hardcoded constants from Fly and ProductionAirdrop.
2016-08-27 19:43:15 +02:00
Paul Chote
1ae86f34f8 Overhaul Carryall behaviour, adding support for manual control. 2016-08-27 15:42:18 +01:00
Paul Chote
06ca8b6cf2 Remove hardcoded constant from Fly. 2016-08-24 17:20:07 +01:00
PedroFerreiraRamos
958e35d61f Fix air unit resupply #5966 2016-07-12 20:17:45 -03:00
reaperrr
40e5dfbedb Fix helicopters not returning when all valid weapons are out of ammo
They now return if all weapons are invalid (which includes those that are otherwise valid, but out of ammo) and at least one AmmoPool needs reloading at RearmBuilding.
2016-06-23 14:47:42 +02:00
reaperrr
4f55b088eb Check if weapon without self-reloading is out of ammo when deciding validity
This should prevent attacking helicopters (or other actors) staying at the range to target of a weapon that is out of ammo and needs manual reloading at a RearmBuilding or via upgrades.
2016-06-23 14:47:41 +02:00
reaperrr
2f1a6e8807 Add maximum and minimum range vs. target checks
This adresses the issue that actors would ignore the validity of weapons when deciding the attack distance versus a target. This could result in actors staying out of range of a weapon valid versus target if they carried a weapon with higher range but invalid versus target.
2016-06-16 20:39:45 +02:00
reaperrr
73ec1ec9b2 Remove float from ReturnToBase.CalculateTurnRadius
141 / PI ~= 44.88, so 45 should be accurate enough. This should reduce desync risk while improving performance of this calculation.
2016-03-28 17:20:49 +02:00
reaperrr
cddf182996 Renamed ROT to TurnSpeed on Mobile, Aircraft, Turreted and ThrowsParticle 2016-03-04 15:13:55 +01:00
Paul Chote
e71225496b Clarify GPL version. 2016-02-21 16:30:48 +00:00
Paul Chote
b396965fd9 Update licence header year. 2016-02-21 16:27:31 +00:00
PedroFerreiraRamos
bf97dd6b7b Bug fix #10029 Plane resupply 2016-02-19 08:35:18 -02:00