Implement StorageButton on HandsGUI and click empty hand to swap… (#517)
Also moved duplicate sprite view code to ItemSlotManager
This commit is contained in:
committed by
Pieter-Jan Briers
parent
9a76c70b37
commit
e0aaab56e3
@@ -496,7 +496,7 @@ namespace Content.Server.GameObjects
|
||||
break;
|
||||
}
|
||||
|
||||
case ActivateInhandMsg msg:
|
||||
case UseInHandMsg msg:
|
||||
{
|
||||
var playerMan = IoCManager.Resolve<IPlayerManager>();
|
||||
var session = playerMan.GetSessionByChannel(netChannel);
|
||||
@@ -511,6 +511,21 @@ namespace Content.Server.GameObjects
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case ActivateInHandMsg msg:
|
||||
{
|
||||
var playerMan = IoCManager.Resolve<IPlayerManager>();
|
||||
var session = playerMan.GetSessionByChannel(netChannel);
|
||||
var playerEntity = session.AttachedEntity;
|
||||
var used = GetHand(msg.Index)?.Owner;
|
||||
|
||||
if (playerEntity == Owner && used != null)
|
||||
{
|
||||
var interactionSystem = _entitySystemManager.GetEntitySystem<InteractionSystem>();
|
||||
interactionSystem.TryInteractionActivate(Owner, used);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -281,6 +281,20 @@ namespace Content.Server.GameObjects.EntitySystems
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Activates the Activate behavior of an object
|
||||
/// Verifies that the user is capable of doing the use interaction first
|
||||
/// </summary>
|
||||
/// <param name="user"></param>
|
||||
/// <param name="used"></param>
|
||||
public void TryInteractionActivate(IEntity user, IEntity used)
|
||||
{
|
||||
if (user != null && used != null && ActionBlockerSystem.CanUse(user))
|
||||
{
|
||||
InteractionActivate(user, used);
|
||||
}
|
||||
}
|
||||
|
||||
private void InteractionActivate(IEntity user, IEntity used)
|
||||
{
|
||||
var activateMsg = new ActivateInWorldMessage(user, used);
|
||||
|
||||
Reference in New Issue
Block a user