Anshar-Eternalis / anshar

ModFest 2023 submission
GNU Lesser General Public License v3.0
3 stars 1 forks source link

Make BeaconComponent simpler #9

Closed Lgmrszd closed 9 months ago

Lgmrszd commented 9 months ago

Made beacon component a lot more simpler now since we don't actually need to have it always active after chunk is unloaded and loaded again.

BeaconComponent now tracks its current state (active). It it also capable of checking whenever it is valid or not (directly taking it from BeaconBlockEntity). Beacon is active when the pyramid is present and the sky is visible (beam is here).

Whenever BeaconComponent detects that is valid, but not active, it will attempt to activate. Other way around, whenever it detects that it is not valid but still active, it will attempt to deactivate. If valid and active, it will keep checking pyramid every so often for the frequency change.

We also no longer store frequency identifier with the Beacon Component because why would we need to in the first place (unloaded beacons stored in the network and loaded ones calculate it anyway)

NetworkComponent might need additional rewriting to be more efficient: since newly-loaded beacons are not guaranteed to have same frequency as before unloading, we're trying to remove it from every Network

HamaIndustries commented 9 months ago

LGTM