Commit Graph

100 Commits

Author SHA1 Message Date
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
Pavel Penev
7e3ec91d30 Add support for multiple explosions to CreateEffectWarhead
Have the engine pick one explosion at random from the provided list.
2016-01-31 16:22:09 +02:00
RoosterDragon
8e89a6a696 Simplify names, remove unused usings, remove redundant casts. 2016-01-17 21:35:36 +00:00
reaperrr
d93a3a61ee Use DistanceFromEdge instead of OuterRadius for CreateEffectWarhead's hit check 2016-01-01 15:52:13 +01:00
reaperrr
c02206601c Use airMargin in CreateEffectWarhead's water check
Closes #10350.
2016-01-01 15:43:34 +01:00
Huw Pascoe
a8299221db Integrated HitShapes
Integrated hit shapes with field loader and warhead calculations.
2015-12-28 23:25:35 +00:00
RoosterDragon
dcf375a412 Store Targetables in Actor.
This can be used to avoid several lookups for these traits, as well as allow Actor to provide specialised methods to deal with target types efficiently. This also reduces some code duplication.
2015-12-12 20:55:17 +00:00
Taryn Hill
9b9d3c8af5 Add DebugOverlayColor to Warhead
This allows us to render WarheadDebugOverlay circles in a
color-per-warhead fashion.
2015-12-09 20:48:10 -06:00
atlimit8
cdb2da33be CreateEffectWarhead target types support 2015-11-08 12:54:17 -06:00
atlimit8
def564e97c reorganize CreateEffectWarhead.GetImpactType(World world, CPos cell, WPos pos) 2015-11-08 12:54:14 -06:00
Zimmermann Gyula
0f14339763 Fix (HealthPercentage)DamageWarheads ignoring stances/TargetTypes.
Moves the IsValidAgainst check from SpreadDamage level to Damage level
and adds a duplication to HealthPercentageDamageWarhead.
2015-11-01 21:06:54 +01:00
reaperrr
731875c270 Reduce default warhead TargetExtraSearchRadius
There aren't any actors in any shipping mod where a health radius larger
than 1c512 would be feasible, so no need to make the default larger than necessary.
2015-10-26 16:24:16 +01:00