help me
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
using System.Numerics;
|
||||
using Content.Client.Hands.Systems;
|
||||
using Content.Client.Interactable;
|
||||
using Content.Client.Resources;
|
||||
using Content.Client.UserInterface.Screens;
|
||||
using Content.Shared._CP14.Fishing;
|
||||
using Content.Shared._CP14.Fishing.Components;
|
||||
using Content.Shared._CP14.Input;
|
||||
using Content.Shared.CombatMode;
|
||||
using Content.Shared.Interaction;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.Graphics;
|
||||
@@ -23,14 +23,20 @@ public sealed class CP14FishingSystem : CP14SharedFishingSystem
|
||||
{
|
||||
[Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!;
|
||||
[Dependency] private readonly IResourceCache _resourceCache = default!;
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
[Dependency] private readonly InputSystem _input = default!;
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
[Dependency] private readonly HandsSystem _handsSystem = default!;
|
||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
|
||||
private Popup? _fishingPopup;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<FishingUIStatus>(OnFishingStatusChanged);
|
||||
}
|
||||
public override void Update(float dt)
|
||||
{
|
||||
base.Update(dt);
|
||||
@@ -43,17 +49,73 @@ public sealed class CP14FishingSystem : CP14SharedFishingSystem
|
||||
if (!TryComp<CP14FishingRodComponent>(heldUid, out var fishingRodComponent))
|
||||
return;
|
||||
|
||||
if (!fishingRodComponent.FishCaught)
|
||||
return;
|
||||
|
||||
if (_playerManager.LocalSession?.AttachedEntity is not { } player)
|
||||
return;
|
||||
|
||||
var reeling = _input.CmdStates.GetState(CP14ContentKeyFunctions.CP14FishingAction) == BoundKeyState.Down;
|
||||
RaiseNetworkEvent(new FishingReelKeyMessage(player, reeling));
|
||||
UpdatePressedButtons(fishingRodComponent, player);
|
||||
UpdateUserInterface(fishingRodComponent);
|
||||
}
|
||||
|
||||
private void OpenFishingPopup(EntityUid uid, CP14FishingRodComponent component, AfterInteractEvent args)
|
||||
private void UpdatePressedButtons(CP14FishingRodComponent fishingRodComponent, EntityUid player)
|
||||
{
|
||||
if (fishingRodComponent.CaughtFish is null)
|
||||
return;
|
||||
|
||||
var reelKey = _input.CmdStates.GetState(CP14ContentKeyFunctions.CP14FishingAction) == BoundKeyState.Down;
|
||||
|
||||
if (!TryComp<CombatModeComponent>(player, out var combatMode) ||
|
||||
!combatMode.IsInCombatMode)
|
||||
reelKey = false;
|
||||
|
||||
if (fishingRodComponent.Reeling == reelKey)
|
||||
return;
|
||||
|
||||
RaiseNetworkEvent(new FishingReelKeyMessage(reelKey));
|
||||
}
|
||||
|
||||
private void UpdateUserInterface(CP14FishingRodComponent fishingRodComponent)
|
||||
{
|
||||
var fish = fishingRodComponent.CaughtFish;
|
||||
|
||||
if (fish is null)
|
||||
return;
|
||||
|
||||
TryComp(fish, out CP14FishComponent? fishComponent);
|
||||
|
||||
if (fishComponent is null)
|
||||
return;
|
||||
|
||||
if (!_prototypeManager.Resolve(fishingRodComponent.FishingMinigame, out var minigameStyle))
|
||||
return;
|
||||
|
||||
var floatUI = minigameStyle.Float;
|
||||
var progressbar = minigameStyle.Progressbar;
|
||||
var fishIcon = minigameStyle.FishIcon;
|
||||
|
||||
var firstLayer = _fishingPopup!.GetChild(0);
|
||||
var secondLayer = _fishingPopup!.GetChild(1);
|
||||
|
||||
var progressbarContainer = firstLayer.GetChild(0);
|
||||
var floatContainer = firstLayer.GetChild(1);
|
||||
var fishContainer = secondLayer.GetChild(0);
|
||||
|
||||
floatContainer.Margin = new Thickness(floatUI.Offset.X, 0, floatUI.Offset.Y + fishingRodComponent.FloatPosition, 0);
|
||||
fishContainer.Margin = new Thickness(fishIcon.Offset.X, 0, fishIcon.Offset.Y + fishComponent.FishPosAndDestination.X, 0);
|
||||
}
|
||||
|
||||
private void OnFishingStatusChanged(FishingUIStatus status)
|
||||
{
|
||||
if (status.UIStatus)
|
||||
{
|
||||
OpenFishingPopup(status.Component);
|
||||
}
|
||||
else
|
||||
{
|
||||
CloseFishingPopup();
|
||||
}
|
||||
}
|
||||
|
||||
private void OpenFishingPopup(CP14FishingRodComponent component)
|
||||
{
|
||||
// Getting data
|
||||
if (!_prototypeManager.Resolve(component.FishingMinigame, out var minigameStyle))
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
using Content.Server.Hands.Systems;
|
||||
using Content.Shared._CP14.Fishing;
|
||||
using Content.Shared._CP14.Fishing.Components;
|
||||
using Content.Shared.CombatMode;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Throwing;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
namespace Content.Server._CP14.Fishing;
|
||||
|
||||
@@ -12,6 +15,8 @@ public sealed class CP14FishingSystem : CP14SharedFishingSystem
|
||||
[Dependency] private readonly ThrowingSystem _throwingSystem = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _transformSystem = default!;
|
||||
[Dependency] private readonly HandsSystem _handsSystem = default!;
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -35,19 +40,29 @@ public sealed class CP14FishingSystem : CP14SharedFishingSystem
|
||||
continue;
|
||||
|
||||
PredictedDel(component.FishingFloat);
|
||||
|
||||
component.FishingFloat = null;
|
||||
component.Target = null;
|
||||
DirtyFields(uid, component, null, nameof(CP14FishingRodComponent.FishingFloat), nameof(CP14FishingRodComponent.Target));
|
||||
}
|
||||
}
|
||||
|
||||
private void OnReelingMessage(FishingReelKeyMessage msg)
|
||||
private void OnReelingMessage(FishingReelKeyMessage msg, EntitySessionEventArgs args)
|
||||
{
|
||||
var held = _handsSystem.GetActiveItem(msg.User);
|
||||
|
||||
if (!TryComp<CP14FishingRodComponent>(held, out var rodComponent))
|
||||
if (args.SenderSession.AttachedEntity is not { } player)
|
||||
return;
|
||||
|
||||
rodComponent.Reeling = msg.Reeling;
|
||||
if (!_handsSystem.TryGetActiveItem(player, out var activeItem) ||
|
||||
!TryComp<CP14FishingRodComponent>(activeItem, out var fishingRodComponent))
|
||||
return;
|
||||
|
||||
if (msg.Reeling &&
|
||||
(!TryComp<CombatModeComponent>(player, out var combatMode) ||
|
||||
!combatMode.IsInCombatMode))
|
||||
return;
|
||||
|
||||
fishingRodComponent.Reeling = msg.Reeling;
|
||||
DirtyField(activeItem.Value, fishingRodComponent, nameof(fishingRodComponent.Reeling));
|
||||
}
|
||||
|
||||
private void OnInteract(EntityUid uid, CP14FishingRodComponent component, AfterInteractEvent args)
|
||||
@@ -68,7 +83,10 @@ public sealed class CP14FishingSystem : CP14SharedFishingSystem
|
||||
return;
|
||||
|
||||
args.Handled = true;
|
||||
CastFloat(uid, component, args.Target.Value);
|
||||
|
||||
component.FishingTime = _gameTiming.CurTime;
|
||||
component.FishingTime += TimeSpan.FromSeconds(_random.NextDouble(component.MinAwaitTime, component.MaxAwaitTime));
|
||||
CastFloat(args.Used, component, args.Target.Value);
|
||||
}
|
||||
|
||||
private void CastFloat(EntityUid uid, CP14FishingRodComponent component, EntityUid target)
|
||||
@@ -80,6 +98,13 @@ public sealed class CP14FishingSystem : CP14SharedFishingSystem
|
||||
|
||||
component.FishingFloat = fishingFloat;
|
||||
component.Target = target;
|
||||
component.User = uid;
|
||||
DirtyFields(uid,
|
||||
component,
|
||||
null,
|
||||
nameof(CP14FishingRodComponent.FishingFloat),
|
||||
nameof(CP14FishingRodComponent.Target),
|
||||
nameof(CP14FishingRodComponent.User));
|
||||
|
||||
_throwingSystem.TryThrow(fishingFloat, targetCoords, component.ThrowPower, recoil: false, doSpin: false);
|
||||
}
|
||||
|
||||
@@ -1,21 +1,29 @@
|
||||
using System.Numerics;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
namespace Content.Shared._CP14.Fishing.Behaviors;
|
||||
|
||||
[ImplicitDataDefinitionForInheritors]
|
||||
[ImplicitDataDefinitionForInheritors, UsedImplicitly(ImplicitUseTargetFlags.WithInheritors)]
|
||||
public abstract partial class CP14FishBaseBehavior
|
||||
{
|
||||
public abstract float CalculatePosition(IRobustRandom random, float cordA);
|
||||
/// <summary>
|
||||
/// Calculates fish position
|
||||
/// </summary>
|
||||
/// <param name="random"> Robust random</param>
|
||||
/// <param name="fishCords"> Current fish coordinates</param>
|
||||
/// <returns> Calculated fish coordinates </returns>
|
||||
public abstract Vector2 TryCalculatePosition(IRobustRandom random, Vector2 fishCords);
|
||||
|
||||
/// <summary>
|
||||
/// Speed which fish uses when going from A to B +- 0.2*Speed
|
||||
/// Speed which fish uses when going from A to B +- 0.2 * Speed
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public float Speed;
|
||||
public float Speed = 0.25f;
|
||||
|
||||
/// <summary>
|
||||
/// How long fish will be in point B until selecting next point B +- 0.2*Difficulty
|
||||
/// How long fish will be in point B until selecting next point B +- 0.2 * Difficulty
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public float Difficulty;
|
||||
public TimeSpan Difficulty = TimeSpan.FromSeconds(0.2);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
using System.Numerics;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
namespace Content.Shared._CP14.Fishing.Behaviors;
|
||||
|
||||
public sealed partial class CP14FishLerpBehaviour : CP14FishBaseBehavior
|
||||
{
|
||||
public override Vector2 TryCalculatePosition(IRobustRandom random, Vector2 fishCords)
|
||||
{
|
||||
var speed = Speed + Speed * 0.2f * random.NextFloat(-1, 1);
|
||||
var nextPos = float.Lerp(fishCords.X, fishCords.Y, speed);
|
||||
|
||||
return new Vector2(nextPos, fishCords.Y);
|
||||
}
|
||||
}
|
||||
@@ -25,6 +25,9 @@ public sealed partial class CP14FishingMinigamePrototype : IPrototype
|
||||
[DataField(required: true)]
|
||||
public FishingMinigameElementData Float;
|
||||
|
||||
[DataField(required: true)]
|
||||
public float FishingMinigameSize;
|
||||
|
||||
[DataDefinition]
|
||||
public partial struct FishingMinigameElementData
|
||||
{
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using Content.Shared._CP14.Fishing.Components;
|
||||
using Content.Shared.EntityTable;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Item;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Timing;
|
||||
@@ -9,6 +16,20 @@ public abstract class CP14SharedFishingSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
[Dependency] private readonly EntityTableSystem _entityTable = default!;
|
||||
[Dependency] private readonly MetaDataSystem _metaSystem = default!;
|
||||
[Dependency] private readonly SharedMapSystem _map = default!;
|
||||
|
||||
private MapId? _mapId;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<CP14FishingRodComponent, GettingPickedUpAttemptEvent>(OnPickupEvent);
|
||||
SubscribeLocalEvent<CP14FishingRodComponent, DroppedEvent>(OnDropEvent);
|
||||
}
|
||||
|
||||
public override void Update(float frameTime)
|
||||
{
|
||||
@@ -16,35 +37,214 @@ public abstract class CP14SharedFishingSystem : EntitySystem
|
||||
|
||||
var curTime = _gameTiming.CurTime;
|
||||
var query = EntityQueryEnumerator<CP14FishingRodComponent>();
|
||||
_random.SetSeed((int)curTime.Ticks);
|
||||
while (query.MoveNext(out var uid, out var component))
|
||||
{
|
||||
if (curTime <= component.FishingTime)
|
||||
if (component.User is null)
|
||||
continue;
|
||||
|
||||
if (component.FishingFloat is null)
|
||||
if (component.CaughtFish is null)
|
||||
{
|
||||
TryToCatchFish(uid, component, curTime);
|
||||
continue;
|
||||
}
|
||||
|
||||
component.FishingTime += curTime;
|
||||
UpdateFishingFrequency(component);
|
||||
if (!component.FishHooked)
|
||||
{
|
||||
UpdateFishWaitingStatus(uid, component, curTime);
|
||||
continue;
|
||||
}
|
||||
|
||||
UpdatePositions(uid, component, curTime);
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateFishingFrequency(CP14FishingRodComponent component)
|
||||
private void UpdatePositions(EntityUid fishingRod, CP14FishingRodComponent fishingRodComponent, TimeSpan curTime)
|
||||
{
|
||||
_random.SetSeed((int)_gameTiming.CurTick.Value);
|
||||
component.FishingTime += TimeSpan.FromSeconds(_random.NextDouble(component.MinAwaitTime, component.MaxAwaitTime));
|
||||
var fish = fishingRodComponent.CaughtFish;
|
||||
|
||||
if (fish is null)
|
||||
return;
|
||||
|
||||
TryComp(fish, out CP14FishComponent? fishComponent);
|
||||
|
||||
if (fishComponent is null)
|
||||
return;
|
||||
|
||||
_prototypeManager.Resolve(fishingRodComponent.FishingMinigame, out var minigamePrototype);
|
||||
|
||||
if (minigamePrototype is null)
|
||||
return;
|
||||
|
||||
var maxCord = minigamePrototype.FishingMinigameSize;
|
||||
var floatSpeed = fishingRodComponent.FloatSpeed;
|
||||
var floatPosition = fishingRodComponent.FloatPosition;
|
||||
|
||||
if (fishingRodComponent.Reeling)
|
||||
{
|
||||
if (floatSpeed + floatPosition < maxCord)
|
||||
{
|
||||
fishingRodComponent.FloatPosition += fishingRodComponent.FloatSpeed;
|
||||
}
|
||||
else
|
||||
{
|
||||
fishingRodComponent.FloatPosition = maxCord;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (floatPosition - floatSpeed > 0f)
|
||||
{
|
||||
fishingRodComponent.FloatPosition -= floatSpeed;
|
||||
}
|
||||
else
|
||||
{
|
||||
fishingRodComponent.FloatPosition = 0;
|
||||
}
|
||||
}
|
||||
|
||||
var fishPos = fishComponent.FishPosAndDestination.X;
|
||||
var fishDest = fishComponent.FishPosAndDestination.Y;
|
||||
var fishDiff = fishComponent.FishBehavior.Difficulty;
|
||||
|
||||
if (Math.Abs(fishPos - fishDest) < 0.1f)
|
||||
{
|
||||
UpdateFishDestination(fish.Value, fishComponent, curTime, maxCord);
|
||||
}
|
||||
else
|
||||
{
|
||||
fishComponent.FishPosAndDestination = fishComponent.FishBehavior.TryCalculatePosition(_random, fishComponent.FishPosAndDestination);
|
||||
|
||||
if (Math.Abs(fishPos - fishDest) < 0.1f)
|
||||
{
|
||||
fishComponent.FishSelectPosTime = curTime + fishDiff + fishDiff * 0.2 * _random.NextFloat(-1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
DirtyField(fishingRod, fishingRodComponent, nameof(fishingRodComponent.FloatPosition));
|
||||
DirtyField(fish.Value, fishComponent, nameof(fishComponent.FishPosAndDestination));
|
||||
}
|
||||
|
||||
private void UpdateFishDestination(EntityUid fish, CP14FishComponent fishComponent, TimeSpan curTime, float maxCord)
|
||||
{
|
||||
if (curTime < fishComponent.FishSelectPosTime)
|
||||
return;
|
||||
|
||||
fishComponent.FishPosAndDestination.X = _random.NextFloat(0, maxCord);
|
||||
}
|
||||
|
||||
private void UpdateFishWaitingStatus(EntityUid fishingRod, CP14FishingRodComponent fishingRodComponent, TimeSpan curTime)
|
||||
{
|
||||
var fish = fishingRodComponent.CaughtFish;
|
||||
TryComp(fish, out CP14FishComponent? fishComponent);
|
||||
|
||||
if (fishComponent is null)
|
||||
return;
|
||||
|
||||
if (fishingRodComponent.Reeling)
|
||||
{
|
||||
fishingRodComponent.FishHooked = true;
|
||||
|
||||
var user = fishingRodComponent.User;
|
||||
RaiseLocalEvent(user!.Value, new FishingUIStatus(true, fishingRodComponent));
|
||||
|
||||
DirtyField(fishingRod, fishingRodComponent, nameof(CP14FishingRodComponent.FishHooked));
|
||||
return;
|
||||
}
|
||||
|
||||
if (curTime < fishComponent.FishGetAwayTime)
|
||||
return;
|
||||
|
||||
fishingRodComponent.CaughtFish = null;
|
||||
DirtyField(fishingRod, fishingRodComponent, nameof(CP14FishingRodComponent.CaughtFish));
|
||||
Del(fish);
|
||||
}
|
||||
|
||||
private void TryToCatchFish(EntityUid fishingRod, CP14FishingRodComponent fishingRodComponent, TimeSpan curTime)
|
||||
{
|
||||
if (curTime < fishingRodComponent.FishingTime)
|
||||
return;
|
||||
|
||||
if (fishingRodComponent.FishingFloat is null)
|
||||
return;
|
||||
|
||||
if (fishingRodComponent.Target is null)
|
||||
return;
|
||||
|
||||
var pond = fishingRodComponent.Target;
|
||||
TryComp(pond, out CP14FishingPondComponent? pondComponent);
|
||||
|
||||
if (pondComponent?.LootTable is null)
|
||||
return;
|
||||
|
||||
_prototypeManager.Resolve(pondComponent.LootTable, out var lootTable);
|
||||
|
||||
if (lootTable is null)
|
||||
return;
|
||||
|
||||
var fishes = _entityTable.GetSpawns(lootTable, _random.GetRandom());
|
||||
var fishId = fishes.First();
|
||||
|
||||
EnsurePausedMap();
|
||||
var fish = Spawn(fishId, new MapCoordinates(Vector2.Zero, _mapId!.Value));
|
||||
|
||||
TryComp(fish, out CP14FishComponent? fishComponent);
|
||||
|
||||
if (fishComponent is null)
|
||||
return;
|
||||
|
||||
fishingRodComponent.CaughtFish = fish;
|
||||
fishComponent.FishGetAwayTime = curTime;
|
||||
fishComponent.FishGetAwayTime += TimeSpan.FromSeconds(_random.NextDouble(fishingRodComponent.MinAwaitTime, fishingRodComponent.MaxAwaitTime));
|
||||
DirtyField(fishingRod, fishingRodComponent, nameof(CP14FishingRodComponent.CaughtFish));
|
||||
DirtyField(fish, fishComponent, nameof(CP14FishComponent.FishGetAwayTime));
|
||||
}
|
||||
|
||||
private void OnPickupEvent(EntityUid entity, CP14FishingRodComponent component, GettingPickedUpAttemptEvent ev)
|
||||
{
|
||||
if (ev.Cancelled)
|
||||
return;
|
||||
|
||||
component.User = ev.User;
|
||||
}
|
||||
|
||||
private void OnDropEvent(EntityUid entity, CP14FishingRodComponent component, DroppedEvent ev)
|
||||
{
|
||||
component.User = null;
|
||||
}
|
||||
|
||||
private void EnsurePausedMap()
|
||||
{
|
||||
if (_map.MapExists(_mapId))
|
||||
return;
|
||||
|
||||
var mapUid = _map.CreateMap(out var newMapId);
|
||||
_metaSystem.SetEntityName(mapUid, Loc.GetString("fishing-paused-map-name"));
|
||||
_mapId = newMapId;
|
||||
_map.SetPaused(mapUid, true);
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class FishingReelKeyMessage : EntityEventArgs
|
||||
{
|
||||
public EntityUid User { get; }
|
||||
public bool Reeling { get; }
|
||||
|
||||
public FishingReelKeyMessage(EntityUid user, bool reeling)
|
||||
public FishingReelKeyMessage(bool reeling)
|
||||
{
|
||||
User = user;
|
||||
Reeling = reeling;
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class FishingUIStatus : EntityEventArgs
|
||||
{
|
||||
public bool UIStatus { get; }
|
||||
|
||||
public CP14FishingRodComponent Component { get; }
|
||||
|
||||
public FishingUIStatus(bool uiStatus, CP14FishingRodComponent component)
|
||||
{
|
||||
UIStatus = uiStatus;
|
||||
Component = component;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,23 @@
|
||||
using System.Numerics;
|
||||
using Content.Shared._CP14.Fishing.Behaviors;
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared._CP14.Fishing.Components;
|
||||
|
||||
[RegisterComponent]
|
||||
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState(fieldDeltas: true), AutoGenerateComponentPause]
|
||||
public sealed partial class CP14FishComponent : Component
|
||||
{
|
||||
[DataField(required: true)]
|
||||
public CP14FishBaseBehavior FishBehavior;
|
||||
public CP14FishBaseBehavior FishBehavior = default!;
|
||||
|
||||
[AutoNetworkedField, AutoPausedField]
|
||||
public TimeSpan FishSelectPosTime = TimeSpan.Zero;
|
||||
|
||||
[AutoNetworkedField, AutoPausedField]
|
||||
public TimeSpan FishGetAwayTime = TimeSpan.Zero;
|
||||
|
||||
[AutoNetworkedField]
|
||||
public Vector2 FishPosAndDestination;
|
||||
|
||||
[DataField]
|
||||
public double MinAwaitTime = 1;
|
||||
|
||||
@@ -6,30 +6,44 @@ namespace Content.Shared._CP14.Fishing.Components;
|
||||
/// <summary>
|
||||
/// Allows to fish with this item
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState, AutoGenerateComponentPause]
|
||||
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState(fieldDeltas: true), AutoGenerateComponentPause]
|
||||
public sealed partial class CP14FishingRodComponent : Component
|
||||
{
|
||||
[AutoNetworkedField]
|
||||
// Vars
|
||||
[AutoNetworkedField, ViewVariables]
|
||||
public EntityUid? FishingFloat;
|
||||
|
||||
[AutoNetworkedField]
|
||||
public EntityUid? Target;
|
||||
[AutoNetworkedField, ViewVariables]
|
||||
public EntityUid? User;
|
||||
|
||||
[AutoNetworkedField, AutoPausedField]
|
||||
[AutoNetworkedField, ViewVariables]
|
||||
public float FloatPosition = 0f;
|
||||
|
||||
[AutoNetworkedField, AutoPausedField, ViewVariables]
|
||||
public TimeSpan FishingTime = TimeSpan.Zero;
|
||||
|
||||
[AutoNetworkedField]
|
||||
public bool FishCaught;
|
||||
[AutoNetworkedField, ViewVariables]
|
||||
public EntityUid? CaughtFish;
|
||||
|
||||
[AutoNetworkedField]
|
||||
[AutoNetworkedField, ViewVariables]
|
||||
public bool Reeling;
|
||||
|
||||
[AutoNetworkedField, ViewVariables]
|
||||
public bool FishHooked;
|
||||
|
||||
[AutoNetworkedField, ViewVariables]
|
||||
public EntityUid? Target;
|
||||
|
||||
// Data definitions
|
||||
[DataField]
|
||||
public EntProtoId FloatPrototype = "CP14DefaultFishingFloat";
|
||||
|
||||
[DataField]
|
||||
public ProtoId<CP14FishingMinigamePrototype> FishingMinigame = "Default";
|
||||
|
||||
[DataField]
|
||||
public float FloatSpeed = 2f;
|
||||
|
||||
[DataField]
|
||||
public float MaxFishingDistance = 5f;
|
||||
|
||||
|
||||
1
Resources/Locale/en-US/_CP14/fishing/fishing.ftl
Normal file
1
Resources/Locale/en-US/_CP14/fishing/fishing.ftl
Normal file
@@ -0,0 +1 @@
|
||||
fishing-paused-map-name = Fish map
|
||||
1
Resources/Locale/ru-RU/_CP14/fishing/fishing.ftl
Normal file
1
Resources/Locale/ru-RU/_CP14/fishing/fishing.ftl
Normal file
@@ -0,0 +1 @@
|
||||
fishing-paused-map-name = Рыбная карта
|
||||
@@ -97,4 +97,6 @@
|
||||
- type: Tag
|
||||
tags:
|
||||
- FootstepSound
|
||||
- CP14Mosquito
|
||||
- CP14Mosquito
|
||||
- type: CP14Fish
|
||||
fishBehavior: !type:CP14FishLerpBehaviour
|
||||
@@ -72,6 +72,7 @@
|
||||
effects:
|
||||
- !type:ExtinguishReaction
|
||||
- type: CP14FishingPond
|
||||
lootTable: CP14WaterFishingLootTable
|
||||
|
||||
- type: entity
|
||||
parent: CP14FloorWaterOptimized
|
||||
|
||||
5
Resources/Prototypes/_CP14/Fishing/loottables.yml
Normal file
5
Resources/Prototypes/_CP14/Fishing/loottables.yml
Normal file
@@ -0,0 +1,5 @@
|
||||
- type: entityTable
|
||||
id: CP14WaterFishingLootTable
|
||||
table: !type:GroupSelector
|
||||
children:
|
||||
- id: CP14MobMonsterFlem
|
||||
@@ -16,3 +16,4 @@
|
||||
texture: /Textures/_CP14/Interface/Fishing/Default/float.png
|
||||
size: 22, 76
|
||||
offset: 26, 12
|
||||
fishingMinigameSize: 281
|
||||
Reference in New Issue
Block a user