Hooked up PlayerSession to BasicActorComponent. Beginning damage implementation.

This commit is contained in:
spoogemonster
2011-10-17 17:38:02 +00:00
parent bcbd68d12d
commit 940462d862
12 changed files with 82 additions and 14 deletions
@@ -2,10 +2,28 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ServerInterfaces;
namespace SGO
{
public class BasicActorComponent : GameObjectComponent
{
IPlayerSession playerSession;
public BasicActorComponent()
{
family = SS3D_shared.GO.ComponentFamily.Actor;
}
public override void SetParameter(ComponentParameter parameter)
{
switch (parameter.MemberName)
{
case "playersession":
if (parameter.ParameterType == typeof(IPlayerSession))
playerSession = (IPlayerSession)parameter.Parameter;
break;
}
}
}
}
@@ -2,12 +2,38 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SS3D_shared.GO;
namespace SGO.Component.Damageable
{
public class DamageableComponent
public class DamageableComponent : GameObjectComponent
{
public DamageableComponent()
{
family = SS3D_shared.GO.ComponentFamily.Damageable;
}
public override void RecieveMessage(object sender, SS3D_shared.GO.ComponentMessageType type, List<ComponentReplyMessage> replies, params object[] list)
{
switch (type)
{
case SS3D_shared.GO.ComponentMessageType.Damage:
/// Who damaged, how much, what type
ApplyDamage((Entity)list[0], (int)list[0], (DamageType)list[1]);
break;
}
}
private void ApplyDamage(Entity damager, int damageamount, DamageType damType)
{
throw new NotImplementedException();
}
private void ApplyDamage(int p)
{
throw new NotImplementedException();
}
}
}
+3 -3
View File
@@ -22,11 +22,11 @@ namespace SGO
set { }
}
private string m_parameterType;
private Type m_parameterType;
/// <summary>
/// The type of parameter specified
/// </summary>
public string ParameterType
public Type ParameterType
{
get
{ return m_parameterType; }
@@ -44,7 +44,7 @@ namespace SGO
set { }
}
public ComponentParameter(string memberName, string parameterType, object parameter)
public ComponentParameter(string memberName, Type parameterType, object parameter)
{
m_memberName = memberName;
m_parameterType = parameterType;
+2
View File
@@ -30,6 +30,7 @@ namespace SS3D_shared.GO
Health, // Has hitpoints, applies damage, organs?
Renderable, // Can be rendered -- sprite or particle system
Light,
Damageable,
}
public enum ItemComponentNetMessage
@@ -107,6 +108,7 @@ namespace SS3D_shared.GO
UnEquipItemToHand,
EquipItemInHand,
DropItemInCurrentHand,
Damage,
}
public enum Hand
+1 -1
View File
@@ -59,7 +59,7 @@ namespace SS3D_shared.GO
Cut,
}
public enum MeleeType
public enum DamageType
{
Hit,
Slice,
+2 -1
View File
@@ -11,6 +11,7 @@ public enum ServerServiceType
LogManager,
NetServer,
Map,
ChatManager
ChatManager,
PlayerManager
}
+2 -2
View File
@@ -31,8 +31,8 @@ namespace SS3D_Server.Atom.Object.Door
AddComponent(SS3D_shared.GO.ComponentFamily.Interactable, ComponentFactory.Singleton.GetComponent("BasicInteractableComponent"));
AddComponent(SS3D_shared.GO.ComponentFamily.Collidable, ComponentFactory.Singleton.GetComponent("CollidableComponent"));
AddComponent(SS3D_shared.GO.ComponentFamily.LargeObject, ComponentFactory.Singleton.GetComponent("BasicDoorComponent"));
GetComponent(SS3D_shared.GO.ComponentFamily.LargeObject).SetParameter(new ComponentParameter("OpenSprite", "string", "door_ewo"));
GetComponent(SS3D_shared.GO.ComponentFamily.LargeObject).SetParameter(new ComponentParameter("ClosedSprite", "string", "door_ew"));
GetComponent(SS3D_shared.GO.ComponentFamily.LargeObject).SetParameter(new ComponentParameter("OpenSprite", typeof(string), "door_ewo"));
GetComponent(SS3D_shared.GO.ComponentFamily.LargeObject).SetParameter(new ComponentParameter("ClosedSprite", typeof(string), "door_ew"));
}
protected override void ApplyAction(Atom a, Mob.Mob m)
+5 -1
View File
@@ -6,14 +6,17 @@ using System.Text;
using Lidgren.Network;
using SS3D_shared;
using ServerServices;
using ServerInterfaces;
namespace SS3D_Server.Modules
{
public class PlayerManager
public class PlayerManager: IService
{
/* This class will manage connected player sessions. */
public Dictionary<int, PlayerSession> playerSessions;
public ServerServiceType ServiceType { get { return ServerServiceType.PlayerManager; } }
public PlayerManager()
{
playerSessions = new Dictionary<int, PlayerSession>();
@@ -87,5 +90,6 @@ namespace SS3D_Server.Modules
s.JoinGame();
}
}
}
}
+6 -2
View File
@@ -10,10 +10,11 @@ using SS3D_shared;
using SS3D_shared.GO;
using SGO;
using ServerServices;
using ServerInterfaces;
namespace SS3D_Server.Modules
{
public class PlayerSession
public class PlayerSession : IPlayerSession
{
/* This class represents a connected player session */
@@ -44,7 +45,10 @@ namespace SS3D_Server.Modules
//Add input component.
a.AddComponent(ComponentFamily.Input, SGO.ComponentFactory.Singleton.GetComponent("KeyBindingInputComponent"));
a.AddComponent(ComponentFamily.Mover, ComponentFactory.Singleton.GetComponent("PlayerInputMoverComponent"));
a.AddComponent(ComponentFamily.Actor, ComponentFactory.Singleton.GetComponent("BasicActorComponent"));
BasicActorComponent actorComponent = (BasicActorComponent)ComponentFactory.Singleton.GetComponent("BasicActorComponent");
actorComponent.SetParameter(new ComponentParameter("playersession", typeof(IPlayerSession), this));
a.AddComponent(ComponentFamily.Actor, actorComponent);
attachedAtom = a;
SendAttachMessage();
}
+11
View File
@@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ServerInterfaces
{
public interface IPlayerSession
{
}
}
+1
View File
@@ -41,6 +41,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="IChatManager.cs" />
<Compile Include="IPlayerSession.cs" />
<Compile Include="IService.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
+3 -2
View File
@@ -1,3 +1,4 @@
@echo off
if exist out goto continue
:cleanup
@@ -6,9 +7,9 @@ goto gen
:gen
mkdir out
cd ..\..\
svn log --xml -r228:HEAD -v > Tools\statsvn\out\svn.log
svn log -g --xml -v svn://games.ques.to/ss3d/ss3d/trunk > Tools\statsvn\out\svn.log
cd Tools\statsvn\out
java -jar ..\statsvn.jar -include "SS3D_Client/**/*.cs:SS3d_server/**/*.cs:SS3D_shared/**/*.cs" svn.log ..\..\..\
java -jar ..\statsvn.jar -threads 5 -include "**/*.cs" svn.log ..\..\..\
cd ..
goto end