Stop network serializing prototypes (#38602)

* Stop network serializing prototypes

Send the damn proto ID instead.

* Fix sandbox violation
This commit is contained in:
Pieter-Jan Briers
2025-06-27 01:27:23 +02:00
committed by GitHub
parent bb7e7c3e5f
commit 73df3b1593
28 changed files with 120 additions and 59 deletions

View File

@@ -64,8 +64,11 @@ public sealed class VocalSystem : EntitySystem
return;
}
if (component.EmoteSounds is not { } sounds)
return;
// just play regular sound based on emote proto
args.Handled = _chat.TryPlayEmoteSound(uid, component.EmoteSounds, args.Emote);
args.Handled = _chat.TryPlayEmoteSound(uid, _proto.Index(sounds), args.Emote);
}
private void OnScreamAction(EntityUid uid, VocalComponent component, ScreamActionEvent args)
@@ -85,7 +88,10 @@ public sealed class VocalSystem : EntitySystem
return true;
}
return _chat.TryPlayEmoteSound(uid, component.EmoteSounds, component.ScreamId);
if (component.EmoteSounds is not { } sounds)
return false;
return _chat.TryPlayEmoteSound(uid, _proto.Index(sounds), component.ScreamId);
}
private void LoadSounds(EntityUid uid, VocalComponent component, Sex? sex = null)
@@ -97,6 +103,10 @@ public sealed class VocalSystem : EntitySystem
if (!component.Sounds.TryGetValue(sex.Value, out var protoId))
return;
_proto.TryIndex(protoId, out component.EmoteSounds);
if (!_proto.HasIndex(protoId))
return;
component.EmoteSounds = protoId;
}
}