This commit is contained in:
Red
2025-06-03 18:12:44 +03:00
committed by GitHub
parent f47c94fc08
commit c41f20706e
4 changed files with 42 additions and 2 deletions

View File

@@ -118,8 +118,8 @@ public sealed partial class CP14TradingPlatformSystem : CP14SharedTradingPlatfor
if (indexedPosition.Service is not null)
indexedPosition.Service.Buy(EntityManager, Proto, platform);
user.Comp.Reputation[indexedPosition.Faction] += (float)price / 100;
Dirty(user);
AddReputation(user, indexedPosition.Faction, (float)price / 100);
_audio.PlayPvs(platform.Comp.BuySound, Transform(platform).Coordinates);

View File

@@ -0,0 +1,24 @@
using Content.Shared._CP14.Trading.Prototypes;
using Content.Shared._CP14.Trading.Systems;
using Content.Shared.Roles;
using Robust.Shared.Prototypes;
namespace Content.Shared._CP14.Trading;
public sealed partial class CP14AddGlobalReputationSpecial : JobSpecial
{
[DataField]
public float Reputation = 1f;
public override void AfterEquip(EntityUid mob)
{
var entMan = IoCManager.Resolve<IEntityManager>();
var protoMan = IoCManager.Resolve<IPrototypeManager>();
var tradeSys = entMan.System<CP14SharedTradingPlatformSystem>();
foreach (var faction in protoMan.EnumeratePrototypes<CP14TradingFactionPrototype>())
{
tradeSys.AddReputation(mob, faction, Reputation);
}
}
}

View File

@@ -79,6 +79,20 @@ public abstract partial class CP14SharedTradingPlatformSystem : EntitySystem
return true;
}
public void AddReputation(Entity<CP14TradingReputationComponent?> user,
ProtoId<CP14TradingFactionPrototype> faction, float rep)
{
if (!Resolve(user.Owner, ref user.Comp, false))
return;
if (!user.Comp.Reputation.ContainsKey(faction))
user.Comp.Reputation.Add(faction, rep);
else
user.Comp.Reputation[faction] += rep;
Dirty(user);
}
}
[Serializable, NetSerializable]

View File

@@ -10,6 +10,8 @@
requirements:
- !type:OverallPlaytimeRequirement
time: 3600 # 1 hours
special:
- !type:CP14AddGlobalReputationSpecial
- type: startingGear
id: CP14MerchantGear