Skip to content

Commit

Permalink
P33 (#502)
Browse files Browse the repository at this point in the history
* Update CombatAI.cs

- when stopping npc, reset movement to null;
- periodically check primary hostile.

* Update WaypointMovement.cs

- velocity vector in the case of zero length is calculated in the direction of the unit;
- if at the start already at destination, then set Arrived to true.

* Camouflage

* Performance optimization

Update Zone.cs

- Mutex + HashSet insted of ImmutableHashSet.

Skip robotComponent update if not active.

* Update GlobalConfiguration.cs

- the camouflage bonus is now a robot property rather than a zone effect.

* - Better error handling, turrets shouldn't stuck now. Or lesser at least
- Energy fields are no longer mineable by indy turrets

* - Dead robots no more resurrecting by being unable to drop inexistent painting into loot

* - T1 Scorcher added

* - Added NOX modules

* no message

* - Last changes before test

* - Electric damage now penetrates shield

* - RCU are now aggro on players with molecular instability

* - Various changes

* Spectator revamp

* Changes made after testing

* - Added drones max speed and reactor sealing

* - Temp. New resources and large drillers added

* - Project Valhalla vAlpha

* - PerpetuumBootstrapper divided into smaller modules

* - Partial code cleanup

* - Adaptive alloy vAlpha

* - Dreadnought modules vAlpha

* - Outpost Decay starts in 5 days

* - Excavator module

* - Forced channels
- AI fixes
- Other

---------

Co-authored-by: AqpAnaciy <[email protected]>
Co-authored-by: Dolzhukov, Viktor <[email protected]>
  • Loading branch information
3 people authored Dec 14, 2024
1 parent 72da7ae commit 7ade31a
Show file tree
Hide file tree
Showing 122 changed files with 6,147 additions and 4,344 deletions.
53 changes: 53 additions & 0 deletions src/Perpetuum.Bootstrapper/ContainerBuilderExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
using Autofac;
using Autofac.Builder;
using Perpetuum.EntityFramework;
using Perpetuum.Host.Requests;
using Perpetuum.Services.Looting;
using Perpetuum.Zones.NpcSystem.Flocks;
using Perpetuum.Zones.NpcSystem.Presences;

namespace Perpetuum.Bootstrapper
{
internal static class ContainerBuilderExtensions
{
public static IRegistrationBuilder<T, ConcreteReflectionActivatorData, SingleRegistrationStyle> RegisterRequestHandler<T>(this ContainerBuilder builder, Command command) where T : IRequestHandler<IRequest>
{
return RegisterRequestHandler<T, IRequest>(builder, command);
}

public static void RegisterFlock<T>(this ContainerBuilder builder, PresenceType presenceType) where T : Flock
{
_ = builder.RegisterType<T>().Keyed<Flock>(presenceType).OnActivated(e =>
{
e.Instance.EntityService = e.Context.Resolve<IEntityServices>();
e.Instance.LootService = e.Context.Resolve<ILootService>();
});
}

public static IRegistrationBuilder<T, ConcreteReflectionActivatorData, SingleRegistrationStyle>
RegisterPresence<T>(this ContainerBuilder builder, PresenceType presenceType) where T : Presence
{
return builder.RegisterType<T>().Keyed<Presence>(presenceType).PropertiesAutowired();
}

public static IRegistrationBuilder<T, ConcreteReflectionActivatorData, SingleRegistrationStyle>
RegisterZoneRequestHandler<T>(this ContainerBuilder builder, Command command) where T : IRequestHandler<IZoneRequest>
{
return RegisterRequestHandler<T, IZoneRequest>(builder, command);
}

private static IRegistrationBuilder<TRequestHandler, ConcreteReflectionActivatorData, SingleRegistrationStyle> RegisterRequestHandler<TRequestHandler, TRequest>(ContainerBuilder builder, Command command)
where TRequestHandler : IRequestHandler<TRequest>
where TRequest : IRequest
{
IRegistrationBuilder<TRequestHandler, ConcreteReflectionActivatorData, SingleRegistrationStyle> res = builder.RegisterType<TRequestHandler>();

_ = builder.Register(c =>
{
return c.Resolve<RequestHandlerProfiler<TRequest>>(new TypedParameter(typeof(IRequestHandler<TRequest>), c.Resolve<TRequestHandler>()));
}).Keyed<IRequestHandler<TRequest>>(command);

return res;
}
}
}
11 changes: 11 additions & 0 deletions src/Perpetuum.Bootstrapper/EntityAggregateServices.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using Perpetuum.EntityFramework;

namespace Perpetuum.Bootstrapper
{
internal class EntityAggregateServices : IEntityServices
{
public IEntityFactory Factory { get; set; }
public IEntityDefaultReader Defaults { get; set; }
public IEntityRepository Repository { get; set; }
}
}
39 changes: 39 additions & 0 deletions src/Perpetuum.Bootstrapper/Modules/AutoActivatedTypesModule.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using Autofac;
using Autofac.Builder;
using Perpetuum.Groups.Corporations;
using Perpetuum.Host;
using Perpetuum.Services;
using Perpetuum.Services.ExtensionService;
using Perpetuum.Services.MarketEngine;
using Perpetuum.Services.Relay;
using Perpetuum.Services.Sessions;
using Perpetuum.Threading.Process;
using System;

namespace Perpetuum.Bootstrapper.Modules
{
internal class AutoActivatedTypesModule : Module
{
protected override void Load(ContainerBuilder builder)
{
_ = RegisterAutoActivate<HostOnlineStateWriter>(builder, TimeSpan.FromSeconds(7));
_ = RegisterAutoActivate<ServerInfoService>(builder, TimeSpan.FromMinutes(5));
_ = RegisterAutoActivate<MarketCleanUpService>(builder, TimeSpan.FromHours(1));
_ = RegisterAutoActivate<SessionCountWriter>(builder, TimeSpan.FromMinutes(5));
_ = RegisterAutoActivate<VolunteerCEOProcessor>(builder, TimeSpan.FromMinutes(10));
_ = RegisterAutoActivate<GiveExtensionPointsService>(builder, TimeSpan.FromMinutes(10));
_ = RegisterAutoActivate<ArtifactRefresher>(builder, TimeSpan.FromHours(7));
}

private IRegistrationBuilder<T, ConcreteReflectionActivatorData, SingleRegistrationStyle> RegisterAutoActivate<T>(
ContainerBuilder builder,
TimeSpan interval)
where T : IProcess
{
return builder.RegisterType<T>().SingleInstance().AutoActivate().OnActivated(e =>
{
e.Context.Resolve<IProcessManager>().AddProcess(e.Instance.ToAsync().AsTimed(interval));
});
}
}
}
35 changes: 35 additions & 0 deletions src/Perpetuum.Bootstrapper/Modules/ChannelTypesModule.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using Autofac;
using Perpetuum.RequestHandlers.Channels;
using Perpetuum.Services.Channels;

namespace Perpetuum.Bootstrapper.Modules
{
internal class ChannelTypesModule : Module
{
protected override void Load(ContainerBuilder builder)
{
_ = builder.RegisterType<ChannelRepository>().As<IChannelRepository>();
_ = builder.RegisterType<ChannelMemberRepository>().As<IChannelMemberRepository>();
_ = builder.RegisterType<ChannelBanRepository>().As<IChannelBanRepository>();
_ = builder.RegisterType<ChannelManager>().As<IChannelManager>().SingleInstance();

builder.RegisterRequestHandler<ChannelCreate>(Commands.ChannelCreate);
builder.RegisterRequestHandler<ChannelList>(Commands.ChannelList);
builder.RegisterRequestHandler<ChannelListAll>(Commands.ChannelListAll);
builder.RegisterRequestHandler<ChannelMyList>(Commands.ChannelMyList);
builder.RegisterRequestHandler<ChannelJoin>(Commands.ChannelJoin);
builder.RegisterRequestHandler<ChannelLeave>(Commands.ChannelLeave);
builder.RegisterRequestHandler<ChannelKick>(Commands.ChannelKick);
builder.RegisterRequestHandler<ChannelTalk>(Commands.ChannelTalk);
builder.RegisterRequestHandler<ChannelSetMemberRole>(Commands.ChannelSetMemberRole);
builder.RegisterRequestHandler<ChannelSetPassword>(Commands.ChannelSetPassword);
builder.RegisterRequestHandler<ChannelSetTopic>(Commands.ChannelSetTopic);
builder.RegisterRequestHandler<ChannelBan>(Commands.ChannelBan);
builder.RegisterRequestHandler<ChannelRemoveBan>(Commands.ChannelRemoveBan);
builder.RegisterRequestHandler<ChannelGetBannedMembers>(Commands.ChannelGetBannedMembers);
builder.RegisterRequestHandler<ChannelGlobalMute>(Commands.ChannelGlobalMute);
builder.RegisterRequestHandler<ChannelGetMutedCharacters>(Commands.ChannelGetMutedCharacters);
builder.RegisterRequestHandler<ChannelCreateForTerminals>(Commands.ChannelCreateForTerminals);
}
}
}
35 changes: 35 additions & 0 deletions src/Perpetuum.Bootstrapper/Modules/CommandsModule.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using Autofac;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Module = Autofac.Module;

namespace Perpetuum.Bootstrapper.Modules
{
internal class CommandsModule : Module
{
protected override void Load(ContainerBuilder builder)
{
foreach (Command command in GetCommands())
{
_ = builder.RegisterInstance(command).As<Command>().Keyed<Command>(command.Text.ToUpper());
}

_ = builder.Register<Func<string, Command>>(x =>
{
IComponentContext ctx = x.Resolve<IComponentContext>();
return commandText =>
{
commandText = commandText.ToUpper();
return ctx.IsRegisteredWithKey<Command>(commandText) ? ctx.ResolveKeyed<Command>(commandText) : null;
};
});
}

public static IEnumerable<Command> GetCommands()
{
return typeof(Commands).GetFields(BindingFlags.Static | BindingFlags.Public).Select(info => (Command)info.GetValue(null));
}
}
}
118 changes: 118 additions & 0 deletions src/Perpetuum.Bootstrapper/Modules/EffectsModule.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
using Autofac;
using Perpetuum.ExportedTypes;
using Perpetuum.Zones;
using Perpetuum.Zones.Effects;
using Perpetuum.Zones.Effects.ZoneEffects;
using System;

namespace Perpetuum.Bootstrapper.Modules
{
internal class EffectsModule : Module
{
protected override void Load(ContainerBuilder builder)
{
_ = builder.RegisterType<EffectBuilder>();

_ = builder.RegisterType<ZoneEffectHandler>().As<IZoneEffectHandler>();

_ = builder.Register<Func<IZone, IZoneEffectHandler>>(x =>
{
IComponentContext ctx = x.Resolve<IComponentContext>();
return zone => new ZoneEffectHandler(zone);
});

_ = builder.RegisterType<InvulnerableEffect>().Keyed<Effect>(EffectType.effect_invulnerable);
_ = builder.RegisterType<CoTEffect>().Keyed<Effect>(EffectType.effect_eccm);
_ = builder.RegisterType<CoTEffect>().Keyed<Effect>(EffectType.effect_stealth);

_ = builder.RegisterType<GangEffect>().Keyed<Effect>(EffectType.effect_aura_gang_core_recharge_time);
_ = builder.RegisterType<GangEffect>().Keyed<Effect>(EffectType.effect_aura_gang_critical_hit_chance);
_ = builder.RegisterType<GangEffect>().Keyed<Effect>(EffectType.effect_aura_gang_locking_time);
_ = builder.RegisterType<GangEffect>().Keyed<Effect>(EffectType.effect_aura_gang_signature_radius);
_ = builder.RegisterType<GangEffect>().Keyed<Effect>(EffectType.effect_aura_gang_fast_extraction);
_ = builder.RegisterType<GangEffect>().Keyed<Effect>(EffectType.effect_aura_gang_core_usage_gathering);
_ = builder.RegisterType<GangEffect>().Keyed<Effect>(EffectType.effect_aura_gang_siege);
_ = builder.RegisterType<GangEffect>().Keyed<Effect>(EffectType.effect_aura_gang_speed);
_ = builder.RegisterType<GangEffect>().Keyed<Effect>(EffectType.effect_aura_gang_repaired_amount);
_ = builder.RegisterType<GangEffect>().Keyed<Effect>(EffectType.effect_aura_gang_locking_range);
_ = builder.RegisterType<GangEffect>().Keyed<Effect>(EffectType.effect_aura_gang_ewar_optimal);
_ = builder.RegisterType<GangEffect>().Keyed<Effect>(EffectType.effect_aura_gang_armor_max);
_ = builder.RegisterType<GangEffect>().Keyed<Effect>(EffectType.effect_aura_gang_shield_absorbtion_ratio);
_ = builder.RegisterType<GangEffect>().Keyed<Effect>(EffectType.effect_excavator);

// NOX effects

_ = builder.RegisterType<NoxEffect>().Keyed<Effect>(EffectType.nox_effect_repair_negation);
_ = builder.RegisterType<NoxEffect>().Keyed<Effect>(EffectType.nox_effect_shield_negation);
_ = builder.RegisterType<NoxEffect>().Keyed<Effect>(EffectType.nox_effect_teleport_negation);

// intrusion effects

_ = builder.RegisterType<CorporationEffect>().Keyed<Effect>(EffectType.effect_intrusion_geoscan_lvl1);
_ = builder.RegisterType<CorporationEffect>().Keyed<Effect>(EffectType.effect_intrusion_geoscan_lvl2);
_ = builder.RegisterType<CorporationEffect>().Keyed<Effect>(EffectType.effect_intrusion_geoscan_lvl3);
_ = builder.RegisterType<CorporationEffect>().Keyed<Effect>(EffectType.effect_intrusion_mining_lvl1);
_ = builder.RegisterType<CorporationEffect>().Keyed<Effect>(EffectType.effect_intrusion_mining_lvl2);
_ = builder.RegisterType<CorporationEffect>().Keyed<Effect>(EffectType.effect_intrusion_mining_lvl3);
_ = builder.RegisterType<CorporationEffect>().Keyed<Effect>(EffectType.effect_intrusion_harvester_lvl1);
_ = builder.RegisterType<CorporationEffect>().Keyed<Effect>(EffectType.effect_intrusion_harvester_lvl2);
_ = builder.RegisterType<CorporationEffect>().Keyed<Effect>(EffectType.effect_intrusion_harvester_lvl3);
_ = builder.RegisterType<CorporationEffect>().Keyed<Effect>(EffectType.effect_intrusion_detection_lvl1);
_ = builder.RegisterType<CorporationEffect>().Keyed<Effect>(EffectType.effect_intrusion_detection_lvl2);
_ = builder.RegisterType<CorporationEffect>().Keyed<Effect>(EffectType.effect_intrusion_detection_lvl3);
_ = builder.RegisterType<CorporationEffect>().Keyed<Effect>(EffectType.effect_intrusion_masking_lvl1);
_ = builder.RegisterType<CorporationEffect>().Keyed<Effect>(EffectType.effect_intrusion_masking_lvl2);
_ = builder.RegisterType<CorporationEffect>().Keyed<Effect>(EffectType.effect_intrusion_masking_lvl3);
_ = builder.RegisterType<CorporationEffect>().Keyed<Effect>(EffectType.effect_intrusion_repair_lvl1);
_ = builder.RegisterType<CorporationEffect>().Keyed<Effect>(EffectType.effect_intrusion_repair_lvl2);
_ = builder.RegisterType<CorporationEffect>().Keyed<Effect>(EffectType.effect_intrusion_repair_lvl3);
_ = builder.RegisterType<CorporationEffect>().Keyed<Effect>(EffectType.effect_intrusion_core_lvl1);
_ = builder.RegisterType<CorporationEffect>().Keyed<Effect>(EffectType.effect_intrusion_core_lvl2);
_ = builder.RegisterType<CorporationEffect>().Keyed<Effect>(EffectType.effect_intrusion_core_lvl3);
_ = builder.RegisterType<CorporationEffect>().Keyed<Effect>(EffectType.effect_intrusion_signals_lvl4_combined);
_ = builder.RegisterType<CorporationEffect>().Keyed<Effect>(EffectType.effect_intrusion_industrial_lvl4_combined);
_ = builder.RegisterType<CorporationEffect>().Keyed<Effect>(EffectType.effect_intrusion_engineering_lvl4_combined);

_ = builder.RegisterType<AuraEffect>().Keyed<Effect>(EffectType.effect_pbs_mining_tower_gammaterial_lvl1);
_ = builder.RegisterType<AuraEffect>().Keyed<Effect>(EffectType.effect_pbs_mining_tower_gammaterial_lvl2);
_ = builder.RegisterType<AuraEffect>().Keyed<Effect>(EffectType.effect_pbs_mining_tower_gammaterial_lvl3);
_ = builder.RegisterType<AuraEffect>().Keyed<Effect>(EffectType.effect_pbs_gap_generator_masking_lvl1);
_ = builder.RegisterType<AuraEffect>().Keyed<Effect>(EffectType.effect_pbs_gap_generator_masking_lvl2);
_ = builder.RegisterType<AuraEffect>().Keyed<Effect>(EffectType.effect_pbs_gap_generator_masking_lvl3);
_ = builder.RegisterType<AuraEffect>().Keyed<Effect>(EffectType.effect_pbs_engineering_lvl1);
_ = builder.RegisterType<AuraEffect>().Keyed<Effect>(EffectType.effect_pbs_engineering_lvl2);
_ = builder.RegisterType<AuraEffect>().Keyed<Effect>(EffectType.effect_pbs_engineering_lvl3);
_ = builder.RegisterType<AuraEffect>().Keyed<Effect>(EffectType.effect_pbs_industry_lvl1);
_ = builder.RegisterType<AuraEffect>().Keyed<Effect>(EffectType.effect_pbs_industry_lvl2);
_ = builder.RegisterType<AuraEffect>().Keyed<Effect>(EffectType.effect_pbs_industry_lvl3);
_ = builder.RegisterType<AuraEffect>().Keyed<Effect>(EffectType.effect_pbs_sensors_lvl1);
_ = builder.RegisterType<AuraEffect>().Keyed<Effect>(EffectType.effect_pbs_sensors_lvl2);
_ = builder.RegisterType<AuraEffect>().Keyed<Effect>(EffectType.effect_pbs_sensors_lvl3);
_ = builder.RegisterType<AuraEffect>().Keyed<Effect>(EffectType.effect_pbs_booster_cycle_time_lvl1);
_ = builder.RegisterType<AuraEffect>().Keyed<Effect>(EffectType.effect_pbs_booster_cycle_time_lvl2);
_ = builder.RegisterType<AuraEffect>().Keyed<Effect>(EffectType.effect_pbs_booster_cycle_time_lvl3);
_ = builder.RegisterType<AuraEffect>().Keyed<Effect>(EffectType.effect_pbs_booster_resist_lvl1);
_ = builder.RegisterType<AuraEffect>().Keyed<Effect>(EffectType.effect_pbs_booster_resist_lvl2);
_ = builder.RegisterType<AuraEffect>().Keyed<Effect>(EffectType.effect_pbs_booster_resist_lvl3);
_ = builder.RegisterType<AuraEffect>().Keyed<Effect>(EffectType.effect_pbs_booster_sensor_lvl1);
_ = builder.RegisterType<AuraEffect>().Keyed<Effect>(EffectType.effect_pbs_booster_sensor_lvl2);
_ = builder.RegisterType<AuraEffect>().Keyed<Effect>(EffectType.effect_pbs_booster_sensor_lvl3);

// New Bonuses - OPP
_ = builder.RegisterType<AuraEffect>().Keyed<Effect>(EffectType.effect_beta_bonus);
_ = builder.RegisterType<AuraEffect>().Keyed<Effect>(EffectType.effect_beta2_bonus);
_ = builder.RegisterType<AuraEffect>().Keyed<Effect>(EffectType.effect_alpha_bonus);
_ = builder.RegisterType<AuraEffect>().Keyed<Effect>(EffectType.effect_alpha2_bonus);

_ = builder.Register<EffectFactory>(x =>
{
IComponentContext ctx = x.Resolve<IComponentContext>();

return effectType =>
{
return !ctx.IsRegisteredWithKey<Effect>(effectType) ? new Effect() : ctx.ResolveKeyed<Effect>(effectType);
};
});
}
}
}
Loading

0 comments on commit 7ade31a

Please sign in to comment.