diff options
author | metamuffin <metamuffin@disroot.org> | 2024-07-16 19:19:02 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2024-07-16 19:19:02 +0200 |
commit | d29035fe985bbea44111fc9bf9ddf454ffa81379 (patch) | |
tree | 64ac17bb471d3701271c525054e02c13980146bd /light-client | |
parent | 8fdc97c466bcb7c2ba0d1b5f4aa0aaf95063b74e (diff) | |
download | hurrycurry-d29035fe985bbea44111fc9bf9ddf454ffa81379.tar hurrycurry-d29035fe985bbea44111fc9bf9ddf454ffa81379.tar.bz2 hurrycurry-d29035fe985bbea44111fc9bf9ddf454ffa81379.tar.zst |
interacting with light
Diffstat (limited to 'light-client')
-rw-r--r-- | light-client/assets/misc.ini | 1 | ||||
-rw-r--r-- | light-client/assets/textures/solid.ta | 1 | ||||
-rw-r--r-- | light-client/src/game.rs | 13 |
3 files changed, 15 insertions, 0 deletions
diff --git a/light-client/assets/misc.ini b/light-client/assets/misc.ini index 07052b90..eb79e7e1 100644 --- a/light-client/assets/misc.ini +++ b/light-client/assets/misc.ini @@ -1,2 +1,3 @@ player=player +solid=solid diff --git a/light-client/assets/textures/solid.ta b/light-client/assets/textures/solid.ta new file mode 100644 index 00000000..78981922 --- /dev/null +++ b/light-client/assets/textures/solid.ta @@ -0,0 +1 @@ +a diff --git a/light-client/src/game.rs b/light-client/src/game.rs index 2692e6fc..231f6bd1 100644 --- a/light-client/src/game.rs +++ b/light-client/src/game.rs @@ -42,6 +42,7 @@ pub struct Game { misc_textures: MiscTextures, item_sprites: Vec<Sprite>, movement_send_cooldown: f32, + interacting: bool, } pub struct Tile { @@ -71,6 +72,7 @@ impl Game { movement_send_cooldown: 0., misc_textures: MiscTextures::init(renderer), item_sprites: Vec::new(), + interacting: false, } } @@ -217,6 +219,17 @@ impl Game { self.movement_send_cooldown += 0.04 } + if interact != self.interacting { + if interact { + packet_out.push_back(PacketS::Interact { + pos: Some(self.players[&self.my_id].movement.get_interact_target()), + }); + } else { + packet_out.push_back(PacketS::Interact { pos: None }); + } + self.interacting = interact; + } + for (pid, player) in &mut self.players { if *pid == self.my_id { let movement_packet = |