Skip to content

Commit

Permalink
projectile refactoring: fixes, docs, enhancements (#2295)
Browse files Browse the repository at this point in the history
* projectile refactoring: fixes, docs, enhancements

- projectile related code has been refactored, documented and commented.
- renamed variables to follow current Intersect's naming conventions.
- fixed variable typos.
- removed unused variables, libraries and imports.
- a lot of methods have been merged into one (GetProjectileOffset, GetRange, FindProjectileRotation) for better organization.
- created AdjustPositionOnMapBoundaries methods for better organization within CheckForCollision (server and client)
- Suppress finalization to optimize garbage collection on projectile disposal (client), this is important for performance and to prevent the finalizer from running.
- fixes server crash due to IndexOutOfRangeException when attacking across maps.
- fixes projectiles not crossing map boundaries when stepping into more than one boundary (ie. diagonal crossing maps).
- fixes server crash due to Z Dimension and Z block level issues with projectiles.
- fixes projectile issues when stepping into Z block attributes, now they are destroyed when they are supposed to.
- Linear interpolation improvements (client): we had time as a constant, this caused the two problems: non linear movement and the object not actually reaching the target position visually, so now, linear interpolation is dinamically based on the elapsed time since the projectile was spawned. Also, The interpolation factor is now clamped to ensure that the projectile does not overshoot its target position.
- GetProjectileLerping considers Options.Instance.Processing.ProjectileUpdateInterval in order to visually adjust projectiles according to the server update intervals
- Pattern Matching Enhancements: specifically the use of the switch expression with pattern matching introduced in C# 8.0 and enhanced in later versions. The use of the or keyword to combine multiple patterns in a single case is a feature of these enhancements, allowing for more concise and readable code when checking for multiple conditions. (GetRange, FindProjectileRotation.

* weylon's review (I)
  • Loading branch information
Arufonsu authored Jul 3, 2024
1 parent 60df923 commit 4d650f0
Show file tree
Hide file tree
Showing 4 changed files with 788 additions and 686 deletions.
Loading

0 comments on commit 4d650f0

Please sign in to comment.