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:
@@ -68,11 +68,19 @@ public sealed partial class CP14DemiplaneSystem
|
||||
|
||||
private void GeneratorUsedInHand(Entity<CP14DemiplaneUsingOpenComponent> ent, ref UseInHandEvent args)
|
||||
{
|
||||
if (args.Handled)
|
||||
return;
|
||||
|
||||
if (!TryComp<CP14DemiplaneDataComponent>(ent, out var generator))
|
||||
return;
|
||||
|
||||
args.Handled = true;
|
||||
|
||||
UseGenerator((ent, generator), args.User);
|
||||
|
||||
QueueDel(ent);
|
||||
}
|
||||
|
||||
//Ed: I hate this function.
|
||||
private void UseGenerator(Entity<CP14DemiplaneDataComponent> generator, EntityUid? user = null)
|
||||
{
|
||||
@@ -130,10 +138,6 @@ public sealed partial class CP14DemiplaneSystem
|
||||
var connection = EnsureComp<CP14DemiplaneRiftComponent>(spawnedRift);
|
||||
AddDemiplaneRandomExitPoint(demiplane.Value, (spawnedRift, connection));
|
||||
}
|
||||
|
||||
#if !DEBUG
|
||||
QueueDel(generator); //wtf its crash debug build!
|
||||
#endif
|
||||
}
|
||||
|
||||
private void OnVerbExamine(Entity<CP14DemiplaneDataComponent> ent, ref GetVerbsEvent<ExamineVerb> args)
|
||||
|
||||
@@ -20,6 +20,19 @@ public sealed partial class CP14StationEconomySystem : CP14SharedStationEconomyS
|
||||
InitPriceEvents();
|
||||
|
||||
SubscribeLocalEvent<CP14StationEconomyComponent, StationPostInitEvent>(OnStationPostInit);
|
||||
SubscribeLocalEvent<PrototypesReloadedEventArgs>(OnPrototypesReloaded);
|
||||
}
|
||||
|
||||
private void OnPrototypesReloaded(PrototypesReloadedEventArgs ev)
|
||||
{
|
||||
if (!ev.WasModified<CP14TradingPositionPrototype>())
|
||||
return;
|
||||
|
||||
var query = EntityQueryEnumerator<CP14StationEconomyComponent>();
|
||||
while (query.MoveNext(out var uid, out var economyComponent))
|
||||
{
|
||||
UpdatePricing((uid, economyComponent));
|
||||
}
|
||||
}
|
||||
|
||||
private void OnStationPostInit(Entity<CP14StationEconomyComponent> ent, ref StationPostInitEvent args)
|
||||
|
||||
@@ -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