mirror of
https://github.com/Cesarus85/ringfall-mjolnir-vr.git
synced 2026-10-26 17:01:08 +01:00
Network: glass and destructible scenery break the same for everyone
Breakable surfaces (glass) are broken by each machine's own projectiles with its own random damage, so a pane could shatter on the host and stay whole, still blocking, on a client. In co-op the host now sends each break (and a few again every refresh, for late joiners), and a client breaks the same surface with its shards. Destructible scenery and devices (lights, panels) are the map's, at the same index on every machine, but only damage to units was synced: a client's shots never damaged them, and what the host broke didn't break or play its effects on the clients. A client now reports its hits on them like any other, the host checks and deals them, and every client deals the host's damage to its own copy, which breaks, plays its effects and is destroyed as the host's was. Both are new message kinds that a client without them ignores, so the network version is unchanged.
This commit is contained in:
1 parent
13c14df95c
commit
7a1ffca28b
6 files changed
+161
-1
No files matched your search
@@ -2654,6 +2654,20 @@ void damage_replay_kill(
|
||||
distributed_damage_authorized = FALSE;
|
||||
}
|
||||
|
||||
/* ... damage to scenery or a device, dealt as the host dealt it: the copy
|
||||
breaks, plays its effects and is destroyed as the host's was */
|
||||
void damage_replay_static(
|
||||
long object_index,
|
||||
struct damage_data *damage,
|
||||
short node_index,
|
||||
short region_index,
|
||||
short material_index)
|
||||
{
|
||||
distributed_damage_authorized = TRUE;
|
||||
object_cause_damage(damage, object_index, node_index, region_index, material_index, NULL);
|
||||
distributed_damage_authorized = FALSE;
|
||||
}
|
||||
|
||||
/* the host's: what damage_set_network_state takes */
|
||||
void damage_get_network_state(
|
||||
long object_index,
|
||||
|
||||
Reference in new issue
Block a user