From 10999dc9059e9824ba034dc502be41b7342724c7 Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Sun, 10 Jun 2018 01:03:49 +0200 Subject: [PATCH] Grid map detaching: content edition. --- Content.Server/EntryPoint.cs | 16 +++++----------- .../Components/Power/PowerDebugTool.cs | 2 +- .../Weapon/Melee/MeleeWeaponComponent.cs | 2 +- .../Ranged/Hitscan/HitscanWeaponComponent.cs | 2 +- .../Weapon/Ranged/Projectile/ProjectileWeapon.cs | 2 +- .../Components/Weapon/Ranged/RangedWeapon.cs | 4 ++-- .../EntitySystems/Click/InteractionSystem.cs | 10 +++++----- Content.Server/Placement/SpawnHelpers.cs | 4 ++-- engine | 2 +- 9 files changed, 19 insertions(+), 25 deletions(-) diff --git a/Content.Server/EntryPoint.cs b/Content.Server/EntryPoint.cs index 2f3abf50d0..85d14bff3a 100644 --- a/Content.Server/EntryPoint.cs +++ b/Content.Server/EntryPoint.cs @@ -111,21 +111,15 @@ namespace Content.Server { case ServerRunLevel.PreGame: var timing = IoCManager.Resolve(); - - var mainMap = new MapId(1); - var mainGrid = new GridId(1); - - IoCManager.Resolve().FallbackSpawnPoint = new LocalCoordinates(0, 0, mainGrid, mainMap); - var mapLoader = IoCManager.Resolve(); var mapMan = IoCManager.Resolve(); - var startTime = timing.RealTime; - { - var newMap = mapMan.CreateMap(mainMap); + var newMap = mapMan.CreateMap(); + var grid = mapLoader.LoadBlueprint(newMap, "Maps/stationstation.yml"); - mapLoader.LoadBlueprint(newMap, mainGrid, "Maps/stationstation.yml"); - } + IoCManager.Resolve().FallbackSpawnPoint = new GridLocalCoordinates(Vector2.Zero, grid); + + var startTime = timing.RealTime; var timeSpan = timing.RealTime - startTime; Logger.Info($"Loaded map in {timeSpan.TotalMilliseconds:N2}ms."); diff --git a/Content.Server/GameObjects/Components/Power/PowerDebugTool.cs b/Content.Server/GameObjects/Components/Power/PowerDebugTool.cs index 37946e2511..56ad6ae66c 100644 --- a/Content.Server/GameObjects/Components/Power/PowerDebugTool.cs +++ b/Content.Server/GameObjects/Components/Power/PowerDebugTool.cs @@ -10,7 +10,7 @@ namespace Content.Server.GameObjects.Components.Power { public class PowerDebugTool : SharedPowerDebugTool, IAfterAttack { - void IAfterAttack.Afterattack(IEntity user, LocalCoordinates clicklocation, IEntity attacked) + void IAfterAttack.Afterattack(IEntity user, GridLocalCoordinates clicklocation, IEntity attacked) { if (attacked == null) { diff --git a/Content.Server/GameObjects/Components/Weapon/Melee/MeleeWeaponComponent.cs b/Content.Server/GameObjects/Components/Weapon/Melee/MeleeWeaponComponent.cs index cf9cfb1abf..c84073a629 100644 --- a/Content.Server/GameObjects/Components/Weapon/Melee/MeleeWeaponComponent.cs +++ b/Content.Server/GameObjects/Components/Weapon/Melee/MeleeWeaponComponent.cs @@ -31,7 +31,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee } - void IAfterAttack.Afterattack(IEntity user, LocalCoordinates clicklocation, IEntity attacked) + void IAfterAttack.Afterattack(IEntity user, GridLocalCoordinates clicklocation, IEntity attacked) { var location = user.GetComponent().LocalPosition; var angle = new Angle(clicklocation.ToWorld().Position - location.ToWorld().Position); diff --git a/Content.Server/GameObjects/Components/Weapon/Ranged/Hitscan/HitscanWeaponComponent.cs b/Content.Server/GameObjects/Components/Weapon/Ranged/Hitscan/HitscanWeaponComponent.cs index 0a78c59c7b..6df584f59a 100644 --- a/Content.Server/GameObjects/Components/Weapon/Ranged/Hitscan/HitscanWeaponComponent.cs +++ b/Content.Server/GameObjects/Components/Weapon/Ranged/Hitscan/HitscanWeaponComponent.cs @@ -20,7 +20,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Hitscan string spritename = "Objects/laser.png"; - protected override void Fire(IEntity user, LocalCoordinates clicklocation) + protected override void Fire(IEntity user, GridLocalCoordinates clicklocation) { var userposition = user.GetComponent().WorldPosition; //Remember world positions are ephemeral and can only be used instantaneously var angle = new Angle(clicklocation.Position - userposition); diff --git a/Content.Server/GameObjects/Components/Weapon/Ranged/Projectile/ProjectileWeapon.cs b/Content.Server/GameObjects/Components/Weapon/Ranged/Projectile/ProjectileWeapon.cs index 84e758b31c..7f0157a48b 100644 --- a/Content.Server/GameObjects/Components/Weapon/Ranged/Projectile/ProjectileWeapon.cs +++ b/Content.Server/GameObjects/Components/Weapon/Ranged/Projectile/ProjectileWeapon.cs @@ -17,7 +17,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Projectile private float _velocity = 20f; - protected override void Fire(IEntity user, LocalCoordinates clicklocation) + protected override void Fire(IEntity user, GridLocalCoordinates clicklocation) { var userposition = user.GetComponent().LocalPosition; //Remember world positions are ephemeral and can only be used instantaneously var angle = new Angle(clicklocation.Position - userposition.Position); diff --git a/Content.Server/GameObjects/Components/Weapon/Ranged/RangedWeapon.cs b/Content.Server/GameObjects/Components/Weapon/Ranged/RangedWeapon.cs index 3edad9c967..869b3faf8c 100644 --- a/Content.Server/GameObjects/Components/Weapon/Ranged/RangedWeapon.cs +++ b/Content.Server/GameObjects/Components/Weapon/Ranged/RangedWeapon.cs @@ -9,7 +9,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged { public override string Name => "RangedWeapon"; - void IAfterAttack.Afterattack(IEntity user, LocalCoordinates clicklocation, IEntity attacked) + void IAfterAttack.Afterattack(IEntity user, GridLocalCoordinates clicklocation, IEntity attacked) { if (UserCanFire(user) && WeaponCanFire()) { @@ -27,7 +27,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged return true; } - protected virtual void Fire(IEntity user, LocalCoordinates clicklocation) + protected virtual void Fire(IEntity user, GridLocalCoordinates clicklocation) { return; } diff --git a/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs b/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs index 7b6dce0985..62f34eba08 100644 --- a/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs @@ -51,7 +51,7 @@ namespace Content.Server.GameObjects.EntitySystems /// /// /// - bool RangedAttackby(IEntity user, IEntity attackwith, LocalCoordinates clicklocation); + bool RangedAttackby(IEntity user, IEntity attackwith, GridLocalCoordinates clicklocation); } /// @@ -66,7 +66,7 @@ namespace Content.Server.GameObjects.EntitySystems /// /// /// The entity that was clicked on out of range. May be null if no entity was clicked on.true - void Afterattack(IEntity user, LocalCoordinates clicklocation, IEntity attacked); + void Afterattack(IEntity user, GridLocalCoordinates clicklocation, IEntity attacked); } /// @@ -193,7 +193,7 @@ namespace Content.Server.GameObjects.EntitySystems /// /// /// - public static void InteractAfterattack(IEntity user, IEntity weapon, LocalCoordinates clicklocation) + public static void InteractAfterattack(IEntity user, IEntity weapon, GridLocalCoordinates clicklocation) { List afterattacks = weapon.GetAllComponents().ToList(); @@ -210,7 +210,7 @@ namespace Content.Server.GameObjects.EntitySystems /// /// /// - public static void Interaction(IEntity user, IEntity weapon, IEntity attacked, LocalCoordinates clicklocation) + public static void Interaction(IEntity user, IEntity weapon, IEntity attacked, GridLocalCoordinates clicklocation) { List interactables = attacked.GetAllComponents().ToList(); @@ -296,7 +296,7 @@ namespace Content.Server.GameObjects.EntitySystems /// /// /// - public static void RangedInteraction(IEntity user, IEntity weapon, IEntity attacked, LocalCoordinates clicklocation) + public static void RangedInteraction(IEntity user, IEntity weapon, IEntity attacked, GridLocalCoordinates clicklocation) { List rangedusables = attacked.GetAllComponents().ToList(); diff --git a/Content.Server/Placement/SpawnHelpers.cs b/Content.Server/Placement/SpawnHelpers.cs index cbcba32a5c..51f7b6d28c 100644 --- a/Content.Server/Placement/SpawnHelpers.cs +++ b/Content.Server/Placement/SpawnHelpers.cs @@ -20,10 +20,10 @@ namespace Content.Server.Placement { var entMan = IoCManager.Resolve(); var tBase = entMan.SpawnEntity("TurretBase"); - tBase.GetComponent().LocalPosition = new LocalCoordinates(localPosition, grid); + tBase.GetComponent().LocalPosition = new GridLocalCoordinates(localPosition, grid); var tTop = entMan.SpawnEntity("TurretTopLight"); - tTop.GetComponent().LocalPosition = new LocalCoordinates(localPosition, grid); + tTop.GetComponent().LocalPosition = new GridLocalCoordinates(localPosition, grid); tTop.GetComponent().AttachParent(tBase); } } diff --git a/engine b/engine index 170e1ad5af..653d1c9c44 160000 --- a/engine +++ b/engine @@ -1 +1 @@ -Subproject commit 170e1ad5afe018339b3936550260dc91fb296505 +Subproject commit 653d1c9c440df0a27823df6b280b0bcfb9668e3f