+rep (#1376)
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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]
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
requirements:
|
||||
- !type:OverallPlaytimeRequirement
|
||||
time: 3600 # 1 hours
|
||||
special:
|
||||
- !type:CP14AddGlobalReputationSpecial
|
||||
|
||||
- type: startingGear
|
||||
id: CP14MerchantGear
|
||||
|
||||
Reference in New Issue
Block a user