Commit Graph

1684 Commits

Author SHA1 Message Date
Paul Chote
a06cfb4004 Move TerrainRenderer to a mod-defined trait. 2018-10-13 18:16:56 +02:00
Andre Mohren
450dc70375 Refactored cursors.yaml to use palettes from rules. 2018-10-07 19:28:11 +02:00
teinarss
e353c8c176 Changed SubCell to byte 2018-09-30 19:48:27 +01:00
Andre Mohren
640078a2b1 Refactored Health usage to IHealth. 2018-09-29 18:12:40 +02:00
Paul Chote
09d8aafddf Add a lint test for audio notifications.
Only traits are linted - the UI still hardcodes
too many audio references for this to be worthwhile.
2018-09-26 13:57:05 +02:00
Chris Forbes
d4ef841678 Convert masses of HashSet<string> to BitSet<DamageType> 2018-07-28 20:12:42 +01:00
Paul Chote
ebf3ec0e90 Add some basic safeguards around RenderPlayer.set. 2018-05-31 18:54:07 +02:00
Paul Chote
ba8eac0e38 Remove deprecated Order.TargetActor and Target.FromOrder. 2018-05-30 18:06:59 +02:00
Mustafa Alperen Seki
367a7f617c Added OwnerLostAction
Allows customisation of what will happen to an actor when its owner
loses.
2018-05-28 10:42:45 +01:00
reaperrr
45ee4ad4cf Move IOccupySpace interface right above IPositionable in TraitsInterfaces 2018-05-07 19:40:07 +02:00
reaperrr
3c34330925 Skip check for ITemporaryBlocker entirely if rules don't contain any temporary blockers
This benefits all mods without temporary blockers like gates or energy walls.
2018-05-04 19:40:18 +02:00
reaperrr
a52e83ca49 Add Locomotor lint check 2018-05-03 10:49:21 +02:00
reaperrr
ccd070afd6 Make IRenderModifier require explicit implementation 2018-04-29 11:59:49 +01:00
reaperrr
06dbf71461 Make IStoreResources require explicit implementation 2018-04-29 11:59:49 +01:00
reaperrr
cc4c5a5492 Make IVoiced require explicit implementation 2018-04-29 11:59:49 +01:00
Paul Chote
da29250711 Move PlayerResources to Mods.Common. 2018-04-28 20:42:10 +02:00
reaperrr
18ed04eab5 Only use largest blocker instead of largest actor for projectile blocker overscan
Before this, we unconditionally used the largest OuterRadius of all actors inside a mod for overscanning of blockable projectiles.
However, in many mods the only blockable actors are 1-cell walls, and even if there are gates like in TS, they usually aren't the largest actors in terms of hit-shape.

So this measure should save a bit of performance by reducing the overscan radius of blockable projectiles, especially in mods where walls are the only blocking actors.
2018-04-22 10:55:23 +02:00
Chris Forbes
dddd057e3d Add IPositionable.CanExistInCell
This is like CanEnterCell, but doesn't take into account conflicting
actors, etc.
2018-04-10 01:01:53 +02:00
reaperrr
0c52ff3ae5 Cache TargetablePositions in Actor
To speed up Target.Positions.
2018-04-07 17:24:13 +01: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
RoosterDragon
d2f2029caf Add FirstNonEmptyBounds method for IDecorationBounds interface.
This provides a more efficient way of determining the bounds by avoiding LINQ. A helper that works directly on arrays prevents allocation of an enumerator when the collection is know to be an array.
2018-03-18 22:06:12 +01:00
RoosterDragon
3b642b1a79 Reuse TargetTypes collection in FrozenActor.RefreshState. 2018-03-18 16:50:20 +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
RoosterDragon
a726b57367 Fix order serialization issues. 2018-01-28 15:41:28 +01:00
Arular101
8a60918841 Update copyright notice year to 2018 2018-01-17 00:47:34 +01:00
RoosterDragon
b1e2ee9b79 ScreenMap should TickRender, rather than just Tick.
This is as FrozenUnderFog.TickRender queues an update to the screen map. If this is not processed in the same tick, this results in screen bounds for the frozen actor being 1 tick behind. By making ScreenMap TickRender, it ensures changes from both Tick and TickRender traits are processed, rather than just Tick traits.
2018-01-06 15:16:59 +01:00
RoosterDragon
c60ca83751 Revert "Fix actors disappearing for a tick when swapping to the frozen actor."
This reverts commit 2eb090f153.

This fixes flicker for the actor->frozen transition, but then introduces the same flicker for the frozen->actor transition instead.
2018-01-06 15:16:59 +01:00
Paul Chote
2eb090f153 Fix actors disappearing for a tick when swapping to the frozen actor. 2018-01-01 16:01:44 +01:00
Paul Chote
f8abd5d319 Serialize the correct player in FrozenActor-targeting orders. 2018-01-01 16:01:44 +01:00
reaperrr
04fb0f209d Spatially partition some actor overlays 2017-12-23 17:56:11 +00:00
Paul Chote
9dc330b300 Update FrozenActor TargetTypes alongside other variable state. 2017-12-22 02:33:25 +01:00
Paul Chote
b9e03ac009 Add FrozenActorLayer.FrozenActorsInRegion. 2017-12-22 02:33:25 +01:00
Paul Chote
e35e93557c Remove obsolete NearestCellTo helper. 2017-12-18 07:47:15 +00:00
reaperrr
01a88862b3 Remove IDisable for good 2017-12-17 21:18:44 +00:00
RoosterDragon
dd2ae9fe5e Avoid LINQ in some Tick methods.
As Tick is called often, avoiding allocation overhead in these methods is useful.
2017-12-17 01:28:25 +01:00
Paul Chote
3f67feab0e Rename boolean LobbyOption fields. 2017-12-12 22:43:11 +01:00
Paul Chote
36fccbc453 Add Checkbox/Dropdown to lobby options yaml fields. 2017-12-12 22:43:11 +01:00
Paul Chote
ea32c758eb Expose default UI labels and tooltips to yaml. 2017-12-12 22:43:11 +01:00
Paul Chote
2c17780b94 Make ShroudInfo fields readonly. 2017-12-12 22:43:11 +01:00
Paul Chote
97cdce7448 Add additional metadata to lobby options. 2017-12-12 22:43:11 +01:00
Paul Chote
c87409ed1a Remove legacy bounds code. 2017-12-11 19:45:07 +01:00
Paul Chote
ff5b4b15b3 Introduce IDecorationBounds to replace Actor.SelectionOverlayBounds. 2017-12-11 19:45:07 +01:00
Paul Chote
6f5d035e79 Introduce IMouseBounds and split/rework mouse rectangles.
The render bounds for an actor now include the area covered
by bibs, shadows, and any other widgets. In many cases this
area is much larger than we really want to consider for
tooltips and mouse selection.

An optional Margin is added to Selectable to support cases
like infantry, where we want the mouse area of the actor
to be larger than the drawn selection box.
2017-12-11 19:45:07 +01:00
Paul Chote
8fcc80b05a Use IRender.ScreenBounds in ScreenMap.
Traits are now required to trigger a ScreenMap update whenever they
believe that their ScreenBounds have changed.
2017-12-11 19:45:07 +01:00
Paul Chote
fa65fef4d1 Add IRenderModifier.ModifyScreenBounds to support WithShadow. 2017-12-11 19:45:07 +01:00
Paul Chote
86bfe28ade Add ScreenBounds method to IRender interface.
This method is expected to return Rectangles that cover
the region where Renderables returned by Render may exist.
2017-12-11 19:45:07 +01:00
Paul Chote
46f6263061 Update ScreenMap state in a single pass at the end of the tick. 2017-12-11 19:45:07 +01:00
Paul Chote
9e18ec7314 Simplify ScreenMap bounds checking. 2017-12-11 19:45:07 +01:00
RoosterDragon
7a7eed4fb7 Add FirstEnabledTraitOrDefault helper method.
This avoids the allocations caused by LINQ when using traits.FirstOrDefault(Exts.IsTraitEnabled). This is important in FrozenActorLayer.RefreshState which is called very often. We apply the new helper method to all areas using the old pattern. An overload that takes an array allows arrays to be enumerated without causing allocations.
2017-12-10 13:39:24 +00:00