Doors on all vehicles: no more part-logic FSMs in DoorSync, single sender for hinges
- DoorSync matched every FSM with door/hood/lid/trunk in its name, including the door parts' removal/assembly/bolt/paint FSMs and trigger_ objects, and forced their states at the other players: doors hung crooked, snapped back or came off. Those are excluded now (assembly runs via FsmSync). - HingeSync: on a parked vehicle everyone nearby sent the angle, so doors ping-ponged. Now only the player who clicked near the door (4 s) sends; on a driven vehicle the driver sends; received angles are held 3 s. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+16
@@ -16,6 +16,13 @@ namespace MSCO
|
||||
public class DoorSync
|
||||
{
|
||||
static readonly string[] Keywords = { "door", "gate", "hood", "bonnet", "trunk", "lid", "hatch" };
|
||||
// Nicht die FSMs zum An-/Abbauen, Festschrauben, Lackieren, Speichern ... der Tür-TEILE: deren Zustände wurden
|
||||
// beim Mitspieler erzwungen - Türen hingen schief, lösten sich oder sprangen zurück. Montage läuft über FsmSync.
|
||||
static readonly string[] ExcludedFsms =
|
||||
{
|
||||
"removal", "assembly", "assemble", "boltcheck", "bolt", "screw", "paint", "data", "save", "load", "wiring",
|
||||
"setup", "damage", "tightness", "detach", "attach", "install"
|
||||
};
|
||||
|
||||
const float Cooldown = 1.5f; // Folge-Zustände der Animation nicht nochmal senden
|
||||
const float RescanInterval = 10f; // neue Objekte (z.B. angebaute Autotüren) aufnehmen
|
||||
@@ -102,6 +109,7 @@ namespace MSCO
|
||||
string root = fsm.transform.root.name;
|
||||
if (root == "PLAYER" || root.StartsWith("MSCO_")) continue;
|
||||
if (!Matches(fsm.gameObject.name) && !Matches(fsm.FsmName) && !Matches(fsm.transform.parent != null ? fsm.transform.parent.name : "")) continue;
|
||||
if (IsPartLogic(fsm)) continue;
|
||||
|
||||
string key = FsmSync.PathOf(fsm.transform) + "|" + fsm.FsmName;
|
||||
Tracked t;
|
||||
@@ -110,6 +118,14 @@ namespace MSCO
|
||||
}
|
||||
}
|
||||
|
||||
static bool IsPartLogic(PlayMakerFSM fsm)
|
||||
{
|
||||
string f = fsm.FsmName.ToLower(), o = fsm.gameObject.name.ToLower();
|
||||
if (o.StartsWith("trigger_") || o.StartsWith("bolt")) return true;
|
||||
foreach (string x in ExcludedFsms) if (f.Contains(x)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool Matches(string name)
|
||||
{
|
||||
if (string.IsNullOrEmpty(name)) return false;
|
||||
|
||||
Reference in New Issue
Block a user