* fix: stimulator now have rainbow effect

* tweak: botany return

* tweak: up delay

* tweak: change delay
This commit is contained in:
CaypenNow
2024-03-27 09:35:15 +05:00
committed by GitHub
parent f90cdc2ca6
commit 9581c466b9
9 changed files with 25 additions and 62 deletions

View File

@@ -15,12 +15,6 @@ namespace Content.Server.Botany.Components
[DataField("seed")] [DataField("seed")]
public SeedData? Seed; public SeedData? Seed;
/// <summary>
/// If not null, overrides the plant's initial health. Otherwise, the plant's initial health is set to the Endurance value.
/// </summary>
[DataField]
public float? HealthOverride = null;
/// <summary> /// <summary>
/// Name of a base seed prototype that is used if <see cref="Seed"/> is null. /// Name of a base seed prototype that is used if <see cref="Seed"/> is null.
/// </summary> /// </summary>

View File

@@ -104,12 +104,11 @@ public sealed partial class BotanySystem : EntitySystem
/// <summary> /// <summary>
/// Spawns a new seed packet on the floor at a position, then tries to put it in the user's hands if possible. /// Spawns a new seed packet on the floor at a position, then tries to put it in the user's hands if possible.
/// </summary> /// </summary>
public EntityUid SpawnSeedPacket(SeedData proto, EntityCoordinates coords, EntityUid user, float? healthOverride = null) public EntityUid SpawnSeedPacket(SeedData proto, EntityCoordinates coords, EntityUid user)
{ {
var seed = Spawn(proto.PacketPrototype, coords); var seed = Spawn(proto.PacketPrototype, coords);
var seedComp = EnsureComp<SeedComponent>(seed); var seedComp = EnsureComp<SeedComponent>(seed);
seedComp.Seed = proto; seedComp.Seed = proto;
seedComp.HealthOverride = healthOverride;
var name = Loc.GetString(proto.Name); var name = Loc.GetString(proto.Name);
var noun = Loc.GetString(proto.Noun); var noun = Loc.GetString(proto.Noun);

View File

@@ -71,17 +71,6 @@ public sealed class PlantHolderSystem : EntitySystem
} }
} }
private int GetCurrentGrowthStage(Entity<PlantHolderComponent> entity)
{
var (uid, component) = entity;
if (component.Seed == null)
return 0;
var result = Math.Max(1, (int) (component.Age * component.Seed.GrowthStages / component.Seed.Maturation));
return result;
}
private void OnExamine(Entity<PlantHolderComponent> entity, ref ExaminedEvent args) private void OnExamine(Entity<PlantHolderComponent> entity, ref ExaminedEvent args)
{ {
if (!args.IsInDetailsRange) if (!args.IsInDetailsRange)
@@ -159,7 +148,6 @@ public sealed class PlantHolderSystem : EntitySystem
if (!_botany.TryGetSeed(seeds, out var seed)) if (!_botany.TryGetSeed(seeds, out var seed))
return; return;
float? seedHealth = seeds.HealthOverride;
var name = Loc.GetString(seed.Name); var name = Loc.GetString(seed.Name);
var noun = Loc.GetString(seed.Noun); var noun = Loc.GetString(seed.Noun);
_popup.PopupCursor(Loc.GetString("plant-holder-component-plant-success-message", _popup.PopupCursor(Loc.GetString("plant-holder-component-plant-success-message",
@@ -169,14 +157,7 @@ public sealed class PlantHolderSystem : EntitySystem
component.Seed = seed; component.Seed = seed;
component.Dead = false; component.Dead = false;
component.Age = 1; component.Age = 1;
if (seedHealth is float realSeedHealth) component.Health = component.Seed.Endurance;
{
component.Health = realSeedHealth;
}
else
{
component.Health = component.Seed.Endurance;
}
component.LastCycle = _gameTiming.CurTime; component.LastCycle = _gameTiming.CurTime;
QueueDel(args.Used); QueueDel(args.Used);
@@ -277,15 +258,9 @@ public sealed class PlantHolderSystem : EntitySystem
return; return;
} }
if (GetCurrentGrowthStage(entity) <= 1)
{
_popup.PopupCursor(Loc.GetString("plant-holder-component-early-sample-message"), args.User);
return;
}
component.Health -= (_random.Next(3, 5) * 10); component.Health -= (_random.Next(3, 5) * 10);
component.Seed.Unique = false; component.Seed.Unique = false;
var seed = _botany.SpawnSeedPacket(component.Seed, Transform(args.User).Coordinates, args.User, component.Health); var seed = _botany.SpawnSeedPacket(component.Seed, Transform(args.User).Coordinates, args.User);
_randomHelper.RandomOffset(seed, 0.25f); _randomHelper.RandomOffset(seed, 0.25f);
var displayName = Loc.GetString(component.Seed.DisplayName); var displayName = Loc.GetString(component.Seed.DisplayName);
_popup.PopupCursor(Loc.GetString("plant-holder-component-take-sample-message", _popup.PopupCursor(Loc.GetString("plant-holder-component-take-sample-message",
@@ -919,7 +894,7 @@ public sealed class PlantHolderSystem : EntitySystem
} }
else if (component.Age < component.Seed.Maturation) else if (component.Age < component.Seed.Maturation)
{ {
var growthStage = GetCurrentGrowthStage((uid, component)); var growthStage = Math.Max(1, (int) (component.Age * component.Seed.GrowthStages / component.Seed.Maturation));
_appearance.SetData(uid, PlantHolderVisuals.PlantRsi, component.Seed.PlantRsi.ToString(), app); _appearance.SetData(uid, PlantHolderVisuals.PlantRsi, component.Seed.PlantRsi.ToString(), app);
_appearance.SetData(uid, PlantHolderVisuals.PlantState, $"stage-{growthStage}", app); _appearance.SetData(uid, PlantHolderVisuals.PlantState, $"stage-{growthStage}", app);

View File

@@ -2,6 +2,7 @@
using Content.Shared._White.Mood; using Content.Shared._White.Mood;
using Content.Shared.Chemistry.Components; using Content.Shared.Chemistry.Components;
using Content.Shared.Damage.Systems; using Content.Shared.Damage.Systems;
using Content.Shared.Drugs;
using Content.Shared.Drunk; using Content.Shared.Drunk;
using Content.Shared.Standing; using Content.Shared.Standing;
using Content.Shared.StatusEffect; using Content.Shared.StatusEffect;
@@ -48,44 +49,29 @@ public sealed class NarcoticEffect : EntitySystem
RaiseLocalEvent(uid, new MoodEffectEvent("Stimulator")); RaiseLocalEvent(uid, new MoodEffectEvent("Stimulator"));
CancellationToken token = movespeedModifierComponent.CancelTokenSource.Token; CancellationToken token = movespeedModifierComponent.CancelTokenSource.Token;
int timer = component.TimerInterval[_robustRandom.Next(0, component.TimerInterval.Count)]; int timer = component.TimerInterval[_robustRandom.Next(0, component.TimerInterval.Count)];
int slur = component.SlurTime[_robustRandom.Next(0, component.SlurTime.Count)]; int slur = component.SlurTime[_robustRandom.Next(0, component.SlurTime.Count)];
switch (Enum.GetValues(typeof(NarcoticEffects)).GetValue(index)) switch (Enum.GetValues(typeof(NarcoticEffects)).GetValue(index))
{ {
case NarcoticEffects.TremorAndShake when _statusEffectsSystem.HasStatusEffect(uid, "Drunk", statusEffectsComp):
Timer.SpawnRepeating(timer, () => _stamina.TakeStaminaDamage(uid, 25F), token);
_statusEffectsSystem.TryAddTime(uid, "Drunk", TimeSpan.FromSeconds(slur), statusEffectsComp);
break;
case NarcoticEffects.Shake when _statusEffectsSystem.HasStatusEffect(uid, "Drunk", statusEffectsComp): case NarcoticEffects.Shake when _statusEffectsSystem.HasStatusEffect(uid, "Drunk", statusEffectsComp):
_statusEffectsSystem.TryAddTime(uid, "Drunk", TimeSpan.FromSeconds(slur), statusEffectsComp); _statusEffectsSystem.TryAddTime(uid, "Drunk", TimeSpan.FromSeconds(slur), statusEffectsComp);
break; break;
case NarcoticEffects.StunAndShake when _statusEffectsSystem.HasStatusEffect(uid, "Drunk", statusEffectsComp): case NarcoticEffects.LieDownAndShake when _statusEffectsSystem.HasStatusEffect(uid, "Drunk", statusEffectsComp):
Timer.SpawnRepeating(timer, () => _standingStateSystem.TryLieDown(uid, standingComp), token); Timer.SpawnRepeating(timer, () => _standingStateSystem.TryLieDown(uid, standingComp), token);
_statusEffectsSystem.TryAddTime(uid, "Drunk", TimeSpan.FromSeconds(slur), statusEffectsComp); _statusEffectsSystem.TryAddTime(uid, "Drunk", TimeSpan.FromSeconds(slur), statusEffectsComp);
break; break;
case NarcoticEffects.Stun: case NarcoticEffects.LieDown:
Timer.SpawnRepeating(timer, () => _standingStateSystem.TryLieDown(uid, standingComp), token); Timer.SpawnRepeating(timer, () => _standingStateSystem.TryLieDown(uid, standingComp), token);
break; break;
case NarcoticEffects.TremorAndShake:
Timer.SpawnRepeating(timer, () => _stamina.TakeStaminaDamage(uid, 25F), token);
_statusEffectsSystem.TryAddStatusEffect<DrunkComponent>(uid, "Drunk", TimeSpan.FromSeconds(slur), true, statusEffectsComp);
break;
case NarcoticEffects.Tremor:
Timer.SpawnRepeating(timer, () => _stamina.TakeStaminaDamage(uid, 25F), token);
break;
case NarcoticEffects.Shake: case NarcoticEffects.Shake:
_statusEffectsSystem.TryAddStatusEffect<DrunkComponent>(uid, "Drunk", TimeSpan.FromSeconds(slur), true, statusEffectsComp); _statusEffectsSystem.TryAddStatusEffect<DrunkComponent>(uid, "Drunk", TimeSpan.FromSeconds(slur), true, statusEffectsComp);
break; break;
case NarcoticEffects.StunAndShake: case NarcoticEffects.LieDownAndShake:
Timer.SpawnRepeating(timer, () => _standingStateSystem.TryLieDown(uid, standingComp), token); Timer.SpawnRepeating(timer, () => _standingStateSystem.TryLieDown(uid, standingComp), token);
_statusEffectsSystem.TryAddStatusEffect<DrunkComponent>(uid, "Drunk", TimeSpan.FromSeconds(slur), true, statusEffectsComp); _statusEffectsSystem.TryAddStatusEffect<DrunkComponent>(uid, "Drunk", TimeSpan.FromSeconds(slur), true, statusEffectsComp);
break; break;

View File

@@ -19,9 +19,7 @@ public sealed partial class NarcoticEffectComponent : Component
[Serializable, NetSerializable] [Serializable, NetSerializable]
public enum NarcoticEffects public enum NarcoticEffects
{ {
Stun, LieDown,
Tremor,
Shake, Shake,
TremorAndShake, LieDownAndShake
StunAndShake
} }

View File

@@ -31,4 +31,4 @@ plant-holder-component-toxins-high-warning = Горит [color=red]предуп
plant-holder-component-light-improper-warning = Мигает [color=yellow]предупреждение о неподходящем уровне освещения[/color]. plant-holder-component-light-improper-warning = Мигает [color=yellow]предупреждение о неподходящем уровне освещения[/color].
plant-holder-component-heat-improper-warning = Мигает [color=orange]предупреждение о неподходящем уровне температуры[/color]. plant-holder-component-heat-improper-warning = Мигает [color=orange]предупреждение о неподходящем уровне температуры[/color].
plant-holder-component-pressure-improper-warning = Мигает [color=lightblue]предупреждение о неподходящем атмосферном давлении[/color]. plant-holder-component-pressure-improper-warning = Мигает [color=lightblue]предупреждение о неподходящем атмосферном давлении[/color].
plant-holder-component-gas-missing-warning = Мигает [color=cyan]предупреждение о неподходящем атмосферном составе[/color]. plant-holder-component-gas-missing-warning = Мигает [color=cyan]предупреждение о неподходящем атмосферном составе[/color].

View File

@@ -127,8 +127,7 @@
noSpawn: true noSpawn: true
components: components:
- type: InstantAction - type: InstantAction
charges: 2 useDelay: 100
useDelay: 5
itemIconStyle: BigAction itemIconStyle: BigAction
priority: -20 priority: -20
icon: icon:

View File

@@ -206,7 +206,7 @@
implantAction: ActionActivateScramImplant implantAction: ActionActivateScramImplant
- type: TriggerImplantAction - type: TriggerImplantAction
- type: ScramImplant - type: ScramImplant
teleportAttempts: 10 # small amount of risk of being teleported into space and lets you teleport off shuttles teleportAttempts: 6 # small amount of risk of being teleported into space and lets you teleport off shuttles
- type: entity - type: entity
parent: BaseSubdermalImplant parent: BaseSubdermalImplant

View File

@@ -25,6 +25,12 @@
Asphyxiation: 2 Asphyxiation: 2
Narcotic: Narcotic:
effects: effects:
- !type:GenericStatusEffect
key: SeeingRainbows
component: SeeingRainbows
type: Add
time: 4
refresh: false
- !type:MovespeedModifier - !type:MovespeedModifier
walkSpeedModifier: 1.35 walkSpeedModifier: 1.35
sprintSpeedModifier: 1.35 sprintSpeedModifier: 1.35
@@ -63,6 +69,12 @@
metabolisms: metabolisms:
Narcotic: Narcotic:
effects: effects:
- !type:GenericStatusEffect
key: SeeingRainbows
component: SeeingRainbows
type: Add
time: 4
refresh: false
- !type:MovespeedModifier - !type:MovespeedModifier
walkSpeedModifier: 1.25 walkSpeedModifier: 1.25
sprintSpeedModifier: 1.25 sprintSpeedModifier: 1.25