Browse Source

runtime fix

Taislin 6 tháng trước cách đây
mục cha
commit
8c56cbae4a

+ 1 - 1
Content.Shared/CCVar/CCVars.Vote.cs

@@ -44,7 +44,7 @@ public sealed partial class CCVars
     ///     The required ratio of the server that must agree for a restart round vote to go through.
     /// </summary>
     public static readonly CVarDef<float> VoteRestartRequiredRatio =
-        CVarDef.Create("vote.restart_required_ratio", 0.85f, CVar.SERVERONLY);
+        CVarDef.Create("vote.restart_required_ratio", 0.75f, CVar.SERVERONLY);
 
     /// <summary>
     /// Whether or not to prevent the restart vote from having any effect when there is an online admin

+ 10 - 2
Content.Shared/Damage/Systems/RequireProjectileTargetSystem.cs

@@ -49,18 +49,26 @@ private void PreventCollide(Entity<RequireProjectileTargetComponent> ent, ref Pr
         }
 
         var other = args.OtherEntity;
-        if (TryComp(other, out ProjectileComponent? projectile) &&
+        // Resolve the ProjectileComponent on the 'other' entity (the projectile)
+        if (TryComp(other, out ProjectileComponent? projectileComp) &&
             CompOrNull<TargetedProjectileComponent>(other)?.Target != ent)
         {
             // Prevents shooting out of while inside of crates
-            var shooter = projectile.Shooter;
+            var shooter = projectileComp.Shooter;
             if (!shooter.HasValue)
                 return;
 
             // ProjectileGrenades delete the entity that's shooting the projectile,
             // so it's impossible to check if the entity is in a container
             if (TerminatingOrDeleted(shooter.Value))
+            {
+                // If the shooter is deleted, nullify the reference in the projectile component
+                // to prevent network errors when serializing ProjectileComponent's state.
+                // This ensures that GetNetEntity won't be called on a deleted entity.
+                projectileComp.Shooter = null;
+                Dirty(other, projectileComp); // Mark the ProjectileComponent as dirty so the change is networked.
                 return;
+            }
 
             if (!_container.IsEntityOrParentInContainer(shooter.Value))
                 args.Cancelled = true;