Anime-Game-Servers / Grasscutter-Quests

A server software implementation, ineroperable with a certain anime game client. The code in this repository is fully custom made for edyoucational purposes and future preservation, no copyrighted code is allowed in this repository.
https://grasscutters.xyz/grasscutter
GNU Affero General Public License v3.0
137 stars 31 forks source link

Make region entering/leaving symmetrical #170

Open scooterboo opened 3 weeks ago

scooterboo commented 3 weeks ago

Description

Entities spawning inside of regions caused the regions to trigger. This was particularly bad in the chasm where paimon give some tips about babbling rocks. the region is in group 166001385, and it is triggered by a mushroom in group 166001308. There are other affected groups. groups where you are supposed to follow a trail of gadgets, but the regions centered on those gadgets are triggered by the gadgets!

The old definitions of leaving and entering a region used to roughly be: If something is inside a region and it had not been marked as inside the region in the previous tick, trigger enter region. If something was marked as inside a region and now is outside the region, trigger leave region.

As an edge case, this triggered enter region when an entity spawns inside a region, or a region spawns around and entity.

I have redefined it as follows: If something was marked outside a region and moved into a region, trigger enter region. If something was marked inside a region and moved outside a region, trigger leave region.

Basically, I have made the definitions of enter region and leave region symmetrical.

By request, I have tacked on code that regions can only be triggered by avatars. This renders all of the above moot. :/

Checklist:

sonarcloud[bot] commented 2 weeks ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud