fix: Fix CODEC in tutorial#427
Conversation
Update the plugin to store the componentType in the component class. Also add in a component codec builder to allow component storage to disk.
Add a few additional comments
Add aditional comment about throw comdition
Fix this call to comp thats not local anymore
|
This already exists in 2 guides and is greatly covered here: https://hytalemodding.dev/en/docs/guides/ecs/hytale-ecs-theory#codec |
|
Even though its specified in another location, Currently the example doesn't properly use the CODEC making it dead code. Wouldn't it still be worth updating the example to show how to properly use the CODEC? Or just remove the CODEC from the example. |
|
I think we should just update the example to reflect the correct code, all our examples across the website need to be consistent. |
In this specific example it's actually not wise to use a codec as this example showcases a component used for a temporary player state change, like the DeathComponent, which you wouldn't persist (which is what codec does and this PR tries to implement). There are example here, using the PosionComponent as an example: https://hytalemodding.dev/en/docs/guides/ecs/hytale-ecs-theory#codec (example of a codec to persist a persist component) This is also done here: https://hytalemodding.dev/en/docs/guides/ecs/block-components (custom block with a persistent component but no data) Codecs are used for all persistence across hytale thus I believe having them covered in the ECS theory guide is appropriate. If you really want to display codec usage, which already is done along with the rest of ECS types then please do it with an appropriate example. |
Pull Request
Description
Type of Change
Screenshots
If applicable, add before/after screenshots:
Checklist
bun run devbun audit(no critical vulnerabilities)Thank you for contributing!