В чём отличие этого нового: using Content.Server.Explosion.EntitySystems; using…
- User
В чём отличие этого нового: using Content.Server.Explosion.EntitySystems; using Robust.Shared.Containers; using Robust.Shared.Prototypes;
namespace Content.Server.Explosion.Components; /// /// Grenades that, when triggered, explode into projectiles /// [RegisterComponent, Access(typeof(ProjectileGrenadeSystem))] public sealed partial class ProjectileGrenadeComponent : Component { public Container Container = default!;
/// <summary> /// The kind of projectile that the prototype is filled with. /// </summary> [DataField] public EntProtoId? FillPrototype; /// <summary> /// If we have a pre-fill how many more can we spawn. /// </summary> public int UnspawnedCount; /// <summary> /// Total amount of projectiles /// </summary> [DataField] public int Capacity = 3; /// <summary> /// Should the angle of the projectiles be uneven? /// </summary> [DataField] public bool RandomAngle = false; /// <summary> /// The minimum speed the projectiles may come out at /// </summary> [DataField] public float MinVelocity = 2f; /// <summary> /// The maximum speed the projectiles may come out at /// </summary> [DataField] public float MaxVelocity = 6f;} От этого старого: using Content.Server.Explosion.EntitySystems; using Robust.Shared.Containers; using Robust.Shared.Prototypes;
namespace Content.Server.Explosion.Components { [RegisterComponent, Access(typeof(ClusterGrenadeSystem))] public sealed partial class ClusterGrenadeComponent : Component { public Container GrenadesContainer = default!;
/// <summary> /// What we fill our prototype with if we want to pre-spawn with grenades. /// </summary> [DataField("fillPrototype")] public EntProtoId? FillPrototype; /// <summary> /// If we have a pre-fill how many more can we spawn. /// </summary> public int UnspawnedCount; /// <summary> /// Maximum grenades in the container. /// </summary> [DataField("maxGrenadesCount")] public int MaxGrenades = 3; /// <summary> /// Maximum delay in seconds between individual grenade triggers /// </summary> [ViewVariables(VVAccess.ReadWrite)] [DataField("grenadeTriggerIntervalMax")] public float GrenadeTriggerIntervalMax = 0f; /// <summary> /// Minimum delay in seconds between individual grenade triggers /// </summary> [ViewVariables(VVAccess.ReadWrite)] [DataField("grenadeTriggerIntervalMin")] public float GrenadeTriggerIntervalMin = 0f; /// <summary> /// Minimum delay in seconds before any grenades start to be triggered. /// </summary> [ViewVariables(VVAccess.ReadWrite)] [DataField("baseTriggerDelay")] public float BaseTriggerDelay = 1.0f; /// <summary> /// Decides if grenades trigger after getting launched /// </summary> [DataField("triggerGrenades")] public bool TriggerGrenades = true; /// <summary> /// Does the cluster grenade shoot or throw /// </summary> [ViewVariables(VVAccess.ReadWrite)] [DataField("grenadeType")] public Enum GrenadeType = Components.GrenadeType.Throw; /// <summary> /// The speed at which grenades get thrown /// </summary> [ViewVariables(VVAccess.ReadWrite)] [DataField("velocity")] public float Velocity = 5; /// <summary> /// Should the spread be random /// </summary> [ViewVariables(VVAccess.ReadWrite)] [DataField("randomSpread")] public bool RandomSpread = false; /// <summary> /// Should the angle be random /// </summary> [ViewVariables(VVAccess.ReadWrite)] [DataField("randomAngle")] public bool RandomAngle = false; /// <summary> /// Static distance grenades will be thrown to. /// </summary> [ViewVariables(VVAccess.ReadWrite)] [DataField("distance")] public float Distance = 1f; /// <summary> /// Max distance grenades should randomly be thrown to. /// </summary> [ViewVariables(VVAccess.ReadWrite)] [DataField("maxSpreadDistance")] public float MaxSpreadDistance = 2.5f; /// <summary> /// Minimal distance grenades should randomly be thrown to. /// </summary> [ViewVariables(VVAccess.ReadWrite)] [DataField("minSpreadDistance")] public float MinSpreadDistance = 0f; /// <summary> /// This is the end. /// </summary> public bool CountDown; } public enum GrenadeType { Throw, Shoot } - Assistant
Обе версии кода представляют собой компоненты для гранат в контексте игры, но они имеют разные цели и функциональные возможности. Вот основные отличия между двумя представленными версиями:
-
Имя компонента:
- Новый компонент называется
ProjectileGrenadeComponent, в то время как старый называется . Это отражает разные механики: первый фокусируется на выстрелах снарядов, а второй на создании кластерных гранат.
- Новый компонент называется
-
- User
- Assistant
- User
- Assistant
- User
Не трогай код, только прототип. Код для ознакомления
- Assistant
- User
- Assistant
- User
У нас теперь есть вот такие гранаты ещё using Content.Shared.Explosion.Components; using Content.Shared.Interaction; using Content.Shared.Whitelist; using Robust.Shared.Containers;
- Assistant
- User
- Assistant
- User
- Assistant
- User
Этот прототип крашит сервер
- Assistant