Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: February 21st Beta Updates #1344

Merged
merged 30 commits into from
Feb 21, 2025
Merged

feat: February 21st Beta Updates #1344

merged 30 commits into from
Feb 21, 2025

Conversation

Pazaz
Copy link
Contributor

@Pazaz Pazaz commented Feb 21, 2025

mark-b5 and others added 30 commits February 19, 2025 19:17
# Entity validation rework

This PR aims to build a robust system for how references to entities are
validated to be active entities in the game world. This applies to Locs,
Players, Objs, and Npcs

## New boolean Entity.isActive

`Entity` now has a new boolean `isActive`. `isActive` will be what we
use to keep track of if the `Entity` currently should be available in
the `World`

- `isActive` is set to `true` inside of `Zone.addObj()`,
`Zone.addStaticObj()`, `Zone.addLoc()`, and `Zone.addStaticLoc()` for
non-pathing entities
- `isActive` is also set to `true` inside of `World.addNpc()` and
`World.addPlayer()` for pathing entities
- `isActive` is set to `false` inside of `Zone.removeObj()`, and
`Zone.removeLoc()` non-pathing entities
- `isActive` is also set to `false` inside of `World.removeNpc()` and
`World.removePlayer()` for pathing entities

Essentially, whenever we add an `Entity` to the `World`, we mark the
`Entity` as `isActive`, and when we remove it from the `World`, we unset
`isActive`. This gives us a really quick way to check if the `Entity`
exists in the `World`

## New Boolean Obj.isRevealed

`Obj` also has a unique new boolean called `isRevealed`. `isRevealed` is
used to keep track of whether or not the `Obj` is available to all
players or just its initial owner

- `isRevealed` is set to `true` when `Zone.revealObj()` is called
- `isRevealed` is also set to `true` when `Zone.addStaticObj()` is
called

Inside of `Zone.addObj()`,

- `isRevealed` is set to `true` if the `Obj` has a lifecycle of
'RESPAWN' or is the `Obj` has no receiver
- `isRevealed` is set to `false` if the `Obj` has a receiver and a
lifecycle of 'DESPAWN'

## New polymorphic method Entity.isValid(): boolean

`Entity` has a new method `isValid(): boolean` that should be used to be
able to quickly check if an `Entity` is valid for interactions. This
method is to be overwritten by children classes for specific checks
related to each child

- `Entity.isValid()` by default just returns `isActive`
- `Loc.isValid()` does not overwrite `Entity`'s implementation
- `Npc.isValid()` first checks if the `Npc` is delayed, and then calls
`super.isEntity()`
- `Obj.isValid(hash64: bigint)` takes in the player's 64bit id and does
the following checks
- If the `Obj.isRevealed` is false, it checks that its receiver hash
matches `hash64`
  - It checks that `Obj.count` is greater than 0
  - Finally call `super.isEntity()`
- `Player.isValid()` does the following checks
  - Check `Player.loggingOut`
  - Make sure the player is visible
  - Call `super.isEntity()`

## Places where Entity.isValid() is being referenced for validation

- `PathingEntity.setInteraction()` now checks if the target is
`isValid()` before allowing interaction to be set
- `Player.validateTarget()` now checks if the target `isValid()` as one
of its checks
- `OBJ_COUNT` and `OBJ_TAKEITEM` commands now check against
`Obj.isValid(Player.hash64)`

## Issues this fixes

- #1188
- https://discord.com/channels/953326730632904844/1340360421529616495
- Others
* fix(engine): More robust tracking for Entity validation

* chore(engine): Removed debugging console.logs()

* fix(engine): Move Player.isActive logic into cleanup and onLogin

* fix(engine): Replace lifecycle check with .isValid() check for safe lookups

* chore(engine): Remove redundant Player.isLoggingOut check from Player hunts
Co-authored-by: tannerdino <tannerdino@gmail.com>
* fix(content): rework mining sounds to match video

* fix(content): move mining anum under %action_delay = map_clock block

* fix(content): amulet of glory to 1/86 chance for gem to match osrs

* fix(content): readd sound_230 on mining success

---------

Co-authored-by: tannerdino <tannerdino@gmail.com>
)

* chore(content): rename fishing rs2 files

* refactor(content): freshfish

* feat(content): lava fish in the lava maze and lava fish refactor

* revert(content): settle with fishing matching videos

* refactor(content): memberfish without %skill_anim and %skill_sound

* refactor(content): rarefish without %skill_anim and %skill_sound

* refactor(content): saltfish anims and sounds

* refactor(content): waterfall fishing anims and sounds

---------

Co-authored-by: tannerdino <tannerdino@gmail.com>
- Stronger types for LoginThread and FriendThread
- Error logging for failure to update compiler / check for update
- Many more minor things that should not affect actual runtime code
- Default `account_id` of `-1` for standalone servers (was `undefined`)

Co-authored-by: locked-chest <179689881+sentientflare@users.noreply.github.com>
…js, fix typo (#1299)

fix: prevent alching cats, allow alch for biohazard/upass objs,fix typo
* fix: watch tower quest fixes

* fix: forgot to add file
* chore(content): watchtower debug, typo

* use ^itwatchtower_questpoints

* %itwatchtower_progress = 0;

* rewards after delay

* %itwatchtower_bits = 0;
* fix: some haunted changes

* fix: typo
* fix(content): match wc anim and sound changes with ents

* fix(content): remove raw herring reference from trees (2005-2006 update)

* fix(content): forgor to remove herring easter egg from trees

---------

Co-authored-by: tannerdino <tannerdino@gmail.com>
…bleDistance() improved (#1329)

* fix(engine): More robust tracking for Entity validation

* chore(engine): Removed debugging console.logs()

* fix(engine): Move Player.isActive logic into cleanup and onLogin

* fix(engine): Replace lifecycle check with .isValid() check for safe lookups

* chore(engine): Remove redundant Player.isLoggingOut check from Player hunts

* fix(engine): Player can pick up item underneath with Loc blocking

* fix(engine): Unsetmapflag is called less often
Co-authored-by: tannerdino <tannerdino@gmail.com>
* fix(engine): add safety check to savefile loading

If for some reason we try to access savefile for a player that should
have one, and it's either absent from the filesystem or has invalid
data, we now reject the login attempt under a generic "Please try again"
message.

Previously, there were no sanity checks on reading the savefile data, or
if we didn't find a savefile for a player which should have one
(`logout_time != null`). In theory, if something went wrong here, it
would be sent to the player as a completely reset tutorial island
account. Then, when they logged out, the new savefile would be written.

* fix(engine): prevent reset player saves

A last-ditch effort to prevent overwriting an existing save with one
that has been reset back to tutorial island.

* fix(engine): more robust tracking of wind-back

---------

Co-authored-by: locked-chest <179689881+sentientflare@users.noreply.github.com>
* fix(engine): improve (and simplify) input tracking

Old code would bail early on the first flush of input events. New code
properly waits for all data to be received (up to a limit). It also
simplifies quite a lot.

Tested:
- Kicks player due to inactivity exactly same as before
- Processes all input event batches received by the client

* fix(engine): dont parse untracked players, rate limit

* feat(engine): switch to raw input storage

---------

Co-authored-by: locked-chest <179689881+sentientflare@users.noreply.github.com>
* fix(content): uncomment out law and death rune rc multiplier

* fix(content): default to 1 rune per ess if no multiplier is defined

---------

Co-authored-by: tannerdino <tannerdino@gmail.com>
* feat: restrict f2p world/area login

* fix: changes to mysql migration

* fix: move teleport pos

---------

Co-authored-by: Pazaz <ItsPazaz@gmail.com>
fix: and check for loc shape
…d some in… (#1337)

* fix: rehinsons dialogue, catapult re-enabled + fixed, cleaned some inzone checks

* chore: remove a debugproc
fix: remove unnecessary mods in rsadec fn
fix: keep similar idkit values when changing gender
fix: checking cleared bit when opening bedobin chest
@Pazaz Pazaz merged commit ff20ec0 into live Feb 21, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants