Trade reputation rework + Merchants back + Mining contract (#1347)
* refactor unlocking * fix contract debug crashing * Update dev_map.yml * bugfixes and content rebalance * ore buy contract
This commit is contained in:
@@ -31,11 +31,14 @@ public sealed partial class CP14TradingPlatformSystem : CP14SharedTradingPlatfor
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<CP14TradingPlatformComponent, CP14TradingPositionBuyAttempt>(OnBuyAttempt);
|
||||
SubscribeLocalEvent<CP14SellingPlatformComponent, CP14MagicEnergyOverloadEvent>(OnMagicOverload);
|
||||
SubscribeLocalEvent<CP14SellingPlatformComponent, CP14MagicEnergyLevelChangeEvent>(OnMagicChange);
|
||||
}
|
||||
|
||||
private void OnMagicOverload(Entity<CP14SellingPlatformComponent> ent, ref CP14MagicEnergyOverloadEvent args)
|
||||
private void OnMagicChange(Entity<CP14SellingPlatformComponent> ent, ref CP14MagicEnergyLevelChangeEvent args)
|
||||
{
|
||||
if (args.NewValue != args.MaxValue)
|
||||
return;
|
||||
|
||||
_magicEnergy.ClearEnergy(ent.Owner);
|
||||
|
||||
if (!TryComp<ItemPlacerComponent>(ent, out var itemPlacer))
|
||||
@@ -69,7 +72,10 @@ public sealed partial class CP14TradingPlatformSystem : CP14SharedTradingPlatfor
|
||||
|
||||
public bool TryBuyPosition(Entity<CP14TradingReputationComponent?> user, Entity<CP14TradingPlatformComponent> platform, ProtoId<CP14TradingPositionPrototype> position)
|
||||
{
|
||||
if (!CanBuyPosition(user, platform!, position))
|
||||
if (Timing.CurTime < platform.Comp.NextBuyTime)
|
||||
return false;
|
||||
|
||||
if (!CanBuyPosition(user, position))
|
||||
return false;
|
||||
|
||||
if (!Proto.TryIndex(position, out var indexedPosition))
|
||||
@@ -112,7 +118,7 @@ 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 / 10;
|
||||
user.Comp.Reputation[indexedPosition.Faction] += (float)price / 100;
|
||||
Dirty(user);
|
||||
|
||||
_audio.PlayPvs(platform.Comp.BuySound, Transform(platform).Coordinates);
|
||||
|
||||
Reference in New Issue
Block a user