Merge branch 'master' of github.com:space-wizards/space-station-14-content
This commit is contained in:
@@ -37,7 +37,6 @@ namespace Content.Client.GameObjects.Components.Storage
|
||||
public override void OnRemove()
|
||||
{
|
||||
Window.Dispose();
|
||||
|
||||
base.OnRemove();
|
||||
}
|
||||
|
||||
@@ -53,6 +52,9 @@ namespace Content.Client.GameObjects.Components.Storage
|
||||
case OpenStorageUIMessage msg:
|
||||
OpenUI();
|
||||
break;
|
||||
case CloseStorageUIMessage msg:
|
||||
// todo: close window/grey it out
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -111,21 +111,15 @@ namespace Content.Server
|
||||
{
|
||||
case ServerRunLevel.PreGame:
|
||||
var timing = IoCManager.Resolve<IGameTiming>();
|
||||
|
||||
var mainMap = new MapId(1);
|
||||
var mainGrid = new GridId(1);
|
||||
|
||||
IoCManager.Resolve<IPlayerManager>().FallbackSpawnPoint = new LocalCoordinates(0, 0, mainGrid, mainMap);
|
||||
|
||||
var mapLoader = IoCManager.Resolve<IMapLoader>();
|
||||
var mapMan = IoCManager.Resolve<IMapManager>();
|
||||
|
||||
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<IPlayerManager>().FallbackSpawnPoint = new GridLocalCoordinates(Vector2.Zero, grid);
|
||||
|
||||
var startTime = timing.RealTime;
|
||||
var timeSpan = timing.RealTime - startTime;
|
||||
Logger.Info($"Loaded map in {timeSpan.TotalMilliseconds:N2}ms.");
|
||||
|
||||
@@ -148,10 +142,8 @@ namespace Content.Server
|
||||
case SessionStatus.Connected:
|
||||
{
|
||||
// timer time must be > tick length
|
||||
IoCManager.Resolve<ITimerManager>().AddTimer(new Timer(250, false, () =>
|
||||
{
|
||||
args.Session.JoinLobby();
|
||||
}));
|
||||
Timer.Spawn(250, args.Session.JoinLobby);
|
||||
|
||||
IoCManager.Resolve<IChatManager>().DispatchMessage(ChatChannel.Server, "Gamemode: Player joined server!", args.Session.Index);
|
||||
}
|
||||
break;
|
||||
@@ -162,11 +154,11 @@ namespace Content.Server
|
||||
if (_server.RunLevel == ServerRunLevel.PreGame && !_countdownStarted)
|
||||
{
|
||||
_countdownStarted = true;
|
||||
IoCManager.Resolve<ITimerManager>().AddTimer(new Timer(2000, false, () =>
|
||||
Timer.Spawn(2000, () =>
|
||||
{
|
||||
_server.RunLevel = ServerRunLevel.Game;
|
||||
_countdownStarted = false;
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
IoCManager.Resolve<IChatManager>().DispatchMessage(ChatChannel.Server, "Gamemode: Player joined Lobby!", args.Session.Index);
|
||||
|
||||
@@ -4,6 +4,8 @@ using Content.Shared.GameObjects.Components.Storage;
|
||||
using SS14.Server.GameObjects;
|
||||
using SS14.Server.GameObjects.Components.Container;
|
||||
using SS14.Server.Interfaces.Player;
|
||||
using SS14.Server.Player;
|
||||
using SS14.Shared.Enums;
|
||||
using SS14.Shared.GameObjects;
|
||||
using SS14.Shared.GameObjects.Serialization;
|
||||
using SS14.Shared.Interfaces.GameObjects;
|
||||
@@ -23,6 +25,7 @@ namespace Content.Server.GameObjects
|
||||
|
||||
private int StorageUsed = 0;
|
||||
private int StorageCapacityMax = 10000;
|
||||
public HashSet<IPlayerSession> SubscribedSessions = new HashSet<IPlayerSession>();
|
||||
|
||||
public override void OnAdd()
|
||||
{
|
||||
@@ -47,8 +50,9 @@ namespace Content.Server.GameObjects
|
||||
{
|
||||
if (storage.Remove(toremove))
|
||||
{
|
||||
Logger.InfoS("Storage", "Storage (UID {0}) had entity (UID {1}) removed from it.", Owner.Uid, toremove.Uid);
|
||||
StorageUsed -= toremove.GetComponent<StoreableComponent>().ObjectSize;
|
||||
UpdateClientInventory();
|
||||
UpdateClientInventories();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -63,8 +67,9 @@ namespace Content.Server.GameObjects
|
||||
{
|
||||
if (CanInsert(toinsert) && storage.Insert(toinsert))
|
||||
{
|
||||
Logger.InfoS("Storage", "Storage (UID {0}) had entity (UID {1}) inserted into it.", Owner.Uid, toinsert.Uid);
|
||||
StorageUsed += toinsert.GetComponent<StoreableComponent>().ObjectSize;
|
||||
UpdateClientInventory();
|
||||
UpdateClientInventories();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -93,6 +98,7 @@ namespace Content.Server.GameObjects
|
||||
/// <returns></returns>
|
||||
bool IAttackby.Attackby(IEntity user, IEntity attackwith)
|
||||
{
|
||||
Logger.DebugS("Storage", "Storage (UID {0}) attacked by user (UID {1}) with entity (UID {2}).", Owner.Uid, user.Uid, attackwith.Uid);
|
||||
var hands = user.GetComponent<HandsComponent>();
|
||||
//Check that we can drop the item from our hands first otherwise we obviously cant put it inside
|
||||
if (hands.Drop(hands.ActiveIndex))
|
||||
@@ -118,21 +124,76 @@ namespace Content.Server.GameObjects
|
||||
/// <returns></returns>
|
||||
bool IUse.UseEntity(IEntity user)
|
||||
{
|
||||
SendNetworkMessage(new OpenStorageUIMessage());
|
||||
var user_session = user.GetComponent<BasicActorComponent>().playerSession;
|
||||
Logger.DebugS("Storage", "Storage (UID {0}) \"used\" by player session (UID {1}).", Owner.Uid, user_session.AttachedEntityUid);
|
||||
SubscribeSession(user_session);
|
||||
SendNetworkMessage(new OpenStorageUIMessage(), user_session.ConnectedClient);
|
||||
UpdateClientInventory(user_session);
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the storage UI on all clients telling them of the entities stored in this container
|
||||
/// Updates the storage UI on all subscribed actors, informing them of the state of the container.
|
||||
/// </summary>
|
||||
private void UpdateClientInventory()
|
||||
private void UpdateClientInventories()
|
||||
{
|
||||
foreach (IPlayerSession session in SubscribedSessions)
|
||||
{
|
||||
UpdateClientInventory(session);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds actor to the update list.
|
||||
/// </summary>
|
||||
/// <param name="actor"></param>
|
||||
public void SubscribeSession(IPlayerSession session)
|
||||
{
|
||||
if (!SubscribedSessions.Contains(session))
|
||||
{
|
||||
Logger.DebugS("Storage", "Storage (UID {0}) subscribed player session (UID {1}).", Owner.Uid, session.AttachedEntityUid);
|
||||
session.PlayerStatusChanged += HandlePlayerSessionChangeEvent;
|
||||
SubscribedSessions.Add(session);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes actor from the update list.
|
||||
/// </summary>
|
||||
/// <param name="channel"></param>
|
||||
public void UnsubscribeSession(IPlayerSession session)
|
||||
{
|
||||
Logger.DebugS("Storage", "Storage (UID {0}) unsubscribed player session (UID {1}).", Owner.Uid, session.AttachedEntityUid);
|
||||
SubscribedSessions.Remove(session);
|
||||
SendNetworkMessage(new CloseStorageUIMessage(), session.ConnectedClient);
|
||||
}
|
||||
|
||||
public void HandlePlayerSessionChangeEvent(object obj, SessionStatusEventArgs SSEA)
|
||||
{
|
||||
Logger.DebugS("Storage", "Storage (UID {0}) handled a status change in player session (UID {1}).", Owner.Uid, SSEA.Session.AttachedEntityUid);
|
||||
if (SSEA.NewStatus != SessionStatus.InGame)
|
||||
{
|
||||
UnsubscribeSession(SSEA.Session);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates storage UI on a client, informing them of the state of the container.
|
||||
/// </summary>
|
||||
private void UpdateClientInventory(IPlayerSession session)
|
||||
{
|
||||
if (session.AttachedEntity == null)
|
||||
{
|
||||
Logger.DebugS("Storage", "Storage (UID {0}) detected no attached entity in player session (UID {1}).", Owner.Uid, session.AttachedEntityUid);
|
||||
UnsubscribeSession(session);
|
||||
return;
|
||||
}
|
||||
Dictionary<EntityUid, int> storedentities = new Dictionary<EntityUid, int>();
|
||||
foreach (var entities in storage.ContainedEntities)
|
||||
{
|
||||
storedentities.Add(entities.Uid, entities.GetComponent<StoreableComponent>().ObjectSize);
|
||||
}
|
||||
SendNetworkMessage(new StorageHeldItemsMessage(storedentities, StorageUsed, StorageCapacityMax));
|
||||
SendNetworkMessage(new StorageHeldItemsMessage(storedentities, StorageUsed, StorageCapacityMax), session.ConnectedClient);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -148,7 +209,6 @@ namespace Content.Server.GameObjects
|
||||
|
||||
switch (message)
|
||||
{
|
||||
|
||||
case RemoveEntityMessage msg:
|
||||
var playerMan = IoCManager.Resolve<IPlayerManager>();
|
||||
var session = playerMan.GetSessionByChannel(netChannel);
|
||||
@@ -165,7 +225,6 @@ namespace Content.Server.GameObjects
|
||||
if (entity != null && storage.Contains(entity))
|
||||
{
|
||||
Remove(entity);
|
||||
UpdateClientInventory();
|
||||
|
||||
var item = entity.GetComponent<ItemComponent>();
|
||||
if (item != null && playerentity.TryGetComponent(out HandsComponent hands))
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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<TransformComponent>().LocalPosition;
|
||||
var angle = new Angle(clicklocation.ToWorld().Position - location.ToWorld().Position);
|
||||
|
||||
@@ -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<TransformComponent>().WorldPosition; //Remember world positions are ephemeral and can only be used instantaneously
|
||||
var angle = new Angle(clicklocation.Position - userposition);
|
||||
|
||||
@@ -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<TransformComponent>().LocalPosition; //Remember world positions are ephemeral and can only be used instantaneously
|
||||
var angle = new Angle(clicklocation.Position - userposition.Position);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
||||
/// <param name="attackwith"></param>
|
||||
/// <param name="clicklocation"></param>
|
||||
/// <returns></returns>
|
||||
bool RangedAttackby(IEntity user, IEntity attackwith, LocalCoordinates clicklocation);
|
||||
bool RangedAttackby(IEntity user, IEntity attackwith, GridLocalCoordinates clicklocation);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -66,7 +66,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
||||
/// <param name="user"></param>
|
||||
/// <param name="clicklocation"></param>
|
||||
/// <param name="attacked">The entity that was clicked on out of range. May be null if no entity was clicked on.true</param>
|
||||
void Afterattack(IEntity user, LocalCoordinates clicklocation, IEntity attacked);
|
||||
void Afterattack(IEntity user, GridLocalCoordinates clicklocation, IEntity attacked);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -193,7 +193,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
||||
/// <param name="user"></param>
|
||||
/// <param name="weapon"></param>
|
||||
/// <param name="clicklocation"></param>
|
||||
public static void InteractAfterattack(IEntity user, IEntity weapon, LocalCoordinates clicklocation)
|
||||
public static void InteractAfterattack(IEntity user, IEntity weapon, GridLocalCoordinates clicklocation)
|
||||
{
|
||||
List<IAfterAttack> afterattacks = weapon.GetAllComponents<IAfterAttack>().ToList();
|
||||
|
||||
@@ -210,7 +210,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
||||
/// <param name="user"></param>
|
||||
/// <param name="weapon"></param>
|
||||
/// <param name="attacked"></param>
|
||||
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<IAttackby> interactables = attacked.GetAllComponents<IAttackby>().ToList();
|
||||
|
||||
@@ -296,7 +296,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
||||
/// <param name="user"></param>
|
||||
/// <param name="weapon"></param>
|
||||
/// <param name="attacked"></param>
|
||||
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<IRangedAttackby> rangedusables = attacked.GetAllComponents<IRangedAttackby>().ToList();
|
||||
|
||||
|
||||
@@ -20,10 +20,10 @@ namespace Content.Server.Placement
|
||||
{
|
||||
var entMan = IoCManager.Resolve<IServerEntityManager>();
|
||||
var tBase = entMan.SpawnEntity("TurretBase");
|
||||
tBase.GetComponent<IServerTransformComponent>().LocalPosition = new LocalCoordinates(localPosition, grid);
|
||||
tBase.GetComponent<IServerTransformComponent>().LocalPosition = new GridLocalCoordinates(localPosition, grid);
|
||||
|
||||
var tTop = entMan.SpawnEntity("TurretTopLight");
|
||||
tTop.GetComponent<IServerTransformComponent>().LocalPosition = new LocalCoordinates(localPosition, grid);
|
||||
tTop.GetComponent<IServerTransformComponent>().LocalPosition = new GridLocalCoordinates(localPosition, grid);
|
||||
tTop.GetComponent<IServerTransformComponent>().AttachParent(tBase);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,4 +56,17 @@ namespace Content.Shared.GameObjects.Components.Storage
|
||||
Directed = true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Component message for closing the storage UI.
|
||||
/// E.g when the player moves too far away from the container.
|
||||
/// </summary>
|
||||
[Serializable, NetSerializable]
|
||||
public class CloseStorageUIMessage : ComponentMessage
|
||||
{
|
||||
public CloseStorageUIMessage()
|
||||
{
|
||||
Directed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
31
README.md
31
README.md
@@ -1,3 +1,32 @@
|
||||
# space-station-14-content
|
||||
# Space Station 14: Content Repo [](https://travis-ci.org/space-wizards/space-station-14-content)
|
||||
|
||||
Space Station 14 is a revived attempt at an SS13 remake.
|
||||
|
||||
This is the primary content repo for Space Station 14. To prevent people forking the engine, a "content" pack is loaded by the client and server. This content contains everything needed to play the game on one specific server.
|
||||
|
||||
If you want to develop SS14, this is the repo you need. Both for engine and content development.
|
||||
|
||||
## Getting in Touch
|
||||
|
||||
* Website: [spacestation14.io](https://spacestation14.io/)
|
||||
* Discord: [Invite Link](https://discord.gg/t2jac3p)
|
||||
* IRC: `irc.rizon.net#spacebus`
|
||||
* Project Management Board: [Waffle](https://waffle.io/space-wizards/space-station-14)
|
||||
* Automatic Content Builds: [builds.spacestation14.io](https://builds.spacestation14.io)
|
||||
|
||||
The IRC is setup to relay back and forth to the Discord server so [IRC nerds](https://xkcd.com/1782/) will not be left out.
|
||||
|
||||
## Documentation
|
||||
|
||||
We have various documentation articles about various systems on the GitHub wikis of this repo and the engine.
|
||||
|
||||
* [Engine Wiki](https://github.com/space-wizards/space-station-14/wiki)
|
||||
* [Content Wiki](https://github.com/space-wizards/space-station-14-content/wiki)
|
||||
|
||||
## Contributing
|
||||
|
||||
We are happy to accept contributions from anybody. Get in Discord or IRC if you want to help. We've got a [list of issues](https://github.com/space-wizards/space-station-14-content/issues) that need to be done and anybody can pick them up. Don't be afraid to ask for help either!
|
||||
|
||||
## Building
|
||||
|
||||
[See the relevant wiki page](https://github.com/space-wizards/space-station-14-content/wiki/Getting-Started)
|
||||
|
||||
Reference in New Issue
Block a user