Commit Graph

111 Commits

Author SHA1 Message Date
Paul Chote
ab4a7e3558 Replace System.Drawing primitives with our own. 2019-03-04 18:26:42 +00:00
abcdefg30
cadbd0d9ab Change the year number in all cs headers from 2018 to 2019 2019-01-26 23:15:21 +01:00
rob-v
9ed2ffea91 Fix Warhead.IsValidAgainst (FrozenActor.Owner null) 2019-01-19 12:03:15 +00:00
Mustafa Alperen Seki
6a599e57f6 Remove check for full health for negative damage warheads 2018-11-21 19:25:45 +01:00
Andre Mohren
99de33bbe3 Added smudge chance. 2018-11-21 18:00:11 +01:00
Andre Mohren
b1a44086a0 Removed unused using directives. 2018-11-17 17:23:22 +00:00
reaperrr
cd82382f68 Change CreateEffectWarhead to use World.LocalRandom 2018-11-11 19:50:16 +01:00
Andre Mohren
8b8a14e0b8 Proper usage of IHealthInfo. 2018-10-30 20:59:04 +00:00
reaperrr
f18ce8cfda Make HitShape mandatory for damaging actors and refactor warheads.
* Adds support for linking Armor traits to HitShapes.
* Adds spread support to TargetDamageWarhead
* Removes ring-damage support from HealthPercentageDamage
* Removes IsValidAgainst check from DoImpact(Actor victim...) overload
  and instead lets warheads perform the check beforehand
  (to avoid HitShape look-ups on invalid targets).
* Reduces duplication and improves readability of Warhead implementations
2018-10-26 22:03:34 +02:00
Andre Mohren
640078a2b1 Refactored Health usage to IHealth. 2018-09-29 18:12:40 +02:00
reaperrr
ade85f8977 Skip DamageWarhead armor lookups if no Versus defined
- directly return 100 when no Versus values are defined (meaning the warhead would have 100% efficiency vs. all armor types anyway)
2018-09-29 12:54:34 +01:00
Chris Forbes
d4ef841678 Convert masses of HashSet<string> to BitSet<DamageType> 2018-07-28 20:12:42 +01:00
Zimmermann Gyula
c4b5ec5241 Shift temporary owner-change logic from D2k to Common. 2018-05-20 19:44:35 +02:00
RoosterDragon
5bd5a384b7 Use a BitSet for representing target types.
- Rename Bits<T> to BitSet<T>.
- Implement set based helpers for BitSet<T>.
- When representing TargetTypes of ITargetable in various traits, use a BitSet<TargetableType> instead of HashSet<string> for better performance & reduced memory usage.
- Fix FieldLoader to trim input values when generating a BitSet<T>.
- Require T in BitSet<T> and BitSetAllocator<T> to be a class since it's just a marker value. This allows the JIT to instantiate generic code for these classes once, as they don't benefit from specialized code for T. (Typically JITs will generate shared code for all reference types, and unique code for every value type encountered).
2018-03-21 12:07:44 +01:00
Mustafa Alperen Seki
5e7e3bb011 Add DamageTypes to Kill() and make some traits use it. 2018-03-09 00:25:29 +01:00
Alexis Hunt
08ad7d7f4e Refactor handling of hit radii in projectiles.
penev discovered that the RulesetLoaded functions of projectiles were
never being called, meaning that their blocking calculations were not
properly accounting for actors with large hitboxes.

The best fix for this is to change FindActorsOnLine to always account
for the largest actor's hit radius, rather than forcing callers to pass
the largest radius. Per the comment in Util.cs, as a result, move this
computation to ActorMap. I decided to simplify by not making a separate
calculation for actors that block projectiles only; this may cause a
small performance degradation as the search space is a bit larger.

Similarly to this, I've removed the ability to specify a search radius
manually. Because this is only a search radius, setting a value smaller
than the largest eligible actor makes no sense; that would lead to
completely inconsistent blocking. Setting a larger value, on the other
hand, would make no difference.

CreateEffectWarhead was the only place in core code any of these search
radii were set, and that's because 0 was a mysterious magic value that
made the warhead incapable of hitting actors. I replaced it with a
boolean flag that more clearly indicates the actual behaviour.

Fixes #14151.
2018-02-21 23:26:41 +01:00
Arular101
8a60918841 Update copyright notice year to 2018 2018-01-17 00:47:34 +01:00
Andre Mohren
edeb980f5b Implemented a percentual chance to play the ImpactSound to CreateEffectWarhead 2017-10-07 10:15:22 +02:00
rob-v
d4e9e0e069 Add Visualization chat commands 2017-07-23 15:08:24 +02:00
reaperrr
1b0ae1e512 Mention hard-coded 'Air' TargetType in CEWH.AirThreshod desc 2017-07-13 20:58:47 +02:00
reaperrr
cf5abc68ad Refactor CreateEffectWarhead ImpactTypes
Use target validity to simplify ImpactTypes.
2017-07-13 20:58:47 +02:00
reaperrr
2650973d51 Add ForceDisplayAtGroundLevel to CreateEffectWarhead
Allows to force the effect to always play at ground level, regardless of explosion altitude.
2017-06-27 23:19:32 +02:00
reaperrr
1d2361cdd3 Change default and auto-calc of victim scans to -1
For all projectiles and warheads.

Not really a must for everything else, but for CreateEffectWarhead, the
ImpactTypes refactor (separate PR) makes it a bit harder to make the
warhead valid in every situation, so setting the victim scan to zero is the easiest way to disable scanning for actors completely.
2017-06-25 22:40:12 +02:00
reaperrr
dc5818d035 Warhead style fixes
Implement interfaces explicitly
2017-06-25 22:40:12 +02:00
reaperrr
43b55ae333 Move Shape from Health to new HitShape trait
Renamed Shape to Type
2017-06-04 00:07:08 +02:00
reaperrr
d04c6275da Make warheads use the the most sensible victim scan radius
By default, but allow custom overrides.
2017-05-13 11:15:38 -07:00
atlimit8
4767b91037 Remove LoadUsing where FieldLoader.GetValue works for the dictionaries 2017-04-19 09:51:06 -05:00
Paul Chote
da5a725458 Add support for per-source and total external condition caps. 2017-02-18 19:10:22 +00:00
reaperrr
a8f7b0e2de Add TargetDamageWarhead
Only deals damage to the actor that was targeted by the carrying
projectile.

Currently only supported by InstantHit projectile.
2017-01-30 21:22:06 +01:00
Paul Chote
255214e77c Fix timed external conditions being rejected instead of reset. 2017-01-26 22:52:26 +00:00
reaperrr
7e3e950b5d Fix air explosions leaving smudges
LeaveSmudgeWarhead now only spawns smudges if the explosion happened at or below a certein altitude.
2017-01-01 17:14:31 +01:00
Taryn Hill
43317e0f5d Update copyright notice year to 2017 2016-12-31 23:46:13 -06:00
Paul Chote
f360c10569 Rename ConditionManager variables. 2016-12-23 15:02:52 +00:00
Paul Chote
dcad5c3f7c Rename UpgradeManager to ConditionManager. 2016-12-23 14:57:56 +00:00
Paul Chote
9ddfdc45b3 Introduce SoundType enum. 2016-12-23 11:34:23 +00:00
Paul Chote
764401be10 Port GrantUpgradeWarhead to GrantExternalConditionWarhead. 2016-12-06 17:21:13 +00:00
reaperrr
7235835280 Move ImpactType to Common.Warhead 2016-10-20 20:31:38 +02:00
Paul Chote
365bd5b9bd Rename ResourceType trait fields for consistency. 2016-09-25 17:04:18 +01:00
Zimmermann Gyula
cf8fff2b99 Remove passing the warheads from DamageWarhead to AttackInfo.
Added a Damage class to pass damage value and damage(types) instead.
This removes a great amount of overhead and longterm opens possibilities to have damagetypes without warheads.
2016-07-12 10:09:49 +02:00
reaperrr
4b1e243df3 Make smudges not spawn or grow when cell contains invalid target
This can be used to prevent smudges to spawn below buildings, vehicles etc.
2016-07-07 20:51:21 +02:00
reaperrr
51b88bfbaf Remove Explosion effect and use SpriteEffect instead 2016-05-23 23:30:49 +02:00
Oliver Brakmann
b4664d1ec5 Merge pull request #11192 from reaperrr/fix-effectwh
Fix direct hit check in CreateEffectWarhead
2016-05-18 21:52:30 +02:00
reaperrr
3aa811bd2e Rename 'unit' to 'victim' in CEWH's GetDirectHit check 2016-04-26 19:47:21 +02:00
reaperrr
fe7fe9b49b Fix CreateEffectWarhead's HitShape distance check
Originally, this was comparing distance beween pos and unit.CenterPosition with HitShape's OuterRadius. However, the OuterRadius can exceed the shape for Capsule and Rectangular shapes, so I tried to adress that a few months ago by using the DistanceFromEdge check instead. The approach was bogus, though. DistanceFromEdge just calculates the distance of a position to the edge, so by comparing it with the distance between pos and victim.CenterPosition in combination with using LengthSquared, it was entirely possible the explosion would be within the HitShape, but closer to the edge than the victim.CenterPosition and the check would return false.
Now we just check if DistanceFromEdge is 0 or negative, which means the impact is inside the HitShape.
2016-04-26 19:47:20 +02:00
reaperrr
3a8a8110be Extend CreateEffectWarhead's GetDirectHit to scan a WDist radius for hits
Instead of only the impact cell.
2016-04-26 19:47:18 +02:00
Matthias Mailänder
133a0f54a3 Check for invalid targets to avoid crashing. 2016-04-18 08:46:04 +02:00
reaperrr
a83f44d907 Unhardcode Explosion "Image"
Add ExplosionCollection property to CreateEffectWarhead
2016-03-20 13:48:53 +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
Pavel Penev
489ee9fc54 Add support for multiple impact sounds to CreateEffectWarhead
Have the engine pick one impact sound at random from the provided list.
2016-01-31 16:22:47 +02:00