valence/crates
qualterz c9fbd1a24e
Weather implementation (#260)
<!-- Please make sure that your PR is aligned with the guidelines in
CONTRIBUTING.md to the best of your ability. -->
<!-- Good PRs have tests! Make sure you have sufficient test coverage.
-->

## Description

<!-- Describe the changes you've made. You may include any justification
you want here. -->

An implementation of basic weather systems.

The weather component attached to a world instance would be handled for
all clients, except those that have their own weather component; these
clients would be handled separately.

## Test Plan

<!-- Explain how you tested your changes, and include any code that you
used to test this. -->
<!-- If there is an example that is sufficient to use in place of a
playground, replace the playground section with a note that indicates
this. -->

<details>

<summary>Playground</summary>

```rust
fn handle_command_events(
    instances: Query<Entity, With<Instance>>,
    mut exec_cmds: EventReader<CommandExecution>,
    mut commands: Commands,
) {
    for cmd in exec_cmds.iter() {
        let msg = cmd.command.to_string();
        let ent = instances.single();

        match msg.as_str() {
            "ar" => {
                commands.entity(ent).insert(Rain(WEATHER_LEVEL.end));
            }
            "rr" => {
                commands.entity(ent).remove::<Rain>();
            }
            "at" => {
                commands.entity(ent).insert(Thunder(WEATHER_LEVEL.end));
            }
            "rt" => {
                commands.entity(ent).remove::<Thunder>();
            }
            _ => (),
        };
    }
}
```

</details>

<!-- You need to include steps regardless of whether or not you are
using a playground. -->
Steps:
1. Run `cargo test --package valence --lib -- weather::test`

#### Related
Part of #210
Past approach #106

<!-- Link to any issues that have context for this or that this PR
fixes. -->
2023-03-16 08:43:26 -04:00
..
packet_inspector Packet inspector updates (#283) 2023-03-10 03:57:55 -08:00
playground Client Component Division (#266) 2023-03-11 06:04:14 -08:00
valence Weather implementation (#260) 2023-03-16 08:43:26 -04:00
valence_anvil Client Component Division (#266) 2023-03-11 06:04:14 -08:00
valence_nbt Refactor valence_protocol (#253) 2023-02-23 22:16:22 -08:00
valence_protocol Refactor Schedule (#289) 2023-03-15 16:12:59 -07:00
valence_protocol_macros Add packet_name (#274) 2023-03-07 04:12:08 -08:00
valence_spatial_index Reorganize Packages (#180) 2022-12-29 16:51:05 -08:00
valence_stresser Client Component Division (#266) 2023-03-11 06:04:14 -08:00