Basis for the job system (#434)
* Add basic yaml Jobs file * Add Job Prototype * Rename Jobs to Job * Remove BaseJob * Add the Job class child of Role * Add code for spawning as an assistant. Not actually working, the job prototype can't be found. * Fix role instead of job left in yaml * Add starting gear support for job and the starting gear for assistant as an exemple * Link job with starting gear in yaml * Better naming and some error handling * Tweak error handling
This commit is contained in:
committed by
Pieter-Jan Briers
parent
480d3b26c4
commit
447db2e458
@@ -1,13 +1,17 @@
|
||||
using System.Text;
|
||||
using Content.Server.Mobs.Roles;
|
||||
using Content.Server.Players;
|
||||
using Content.Shared.Jobs;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Interfaces.Reflection;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server.Mobs
|
||||
{
|
||||
|
||||
public class MindInfoCommand : IClientCommand
|
||||
{
|
||||
public string Command => "mindinfo";
|
||||
@@ -47,6 +51,10 @@ namespace Content.Server.Mobs
|
||||
|
||||
public class AddRoleCommand : IClientCommand
|
||||
{
|
||||
#pragma warning disable 649
|
||||
[Dependency] private IPrototypeManager _prototypeManager;
|
||||
#pragma warning restore 649
|
||||
|
||||
public string Command => "addrole";
|
||||
|
||||
public string Description => "Adds a role to a player's mind.";
|
||||
@@ -65,9 +73,8 @@ namespace Content.Server.Mobs
|
||||
if (mgr.TryGetPlayerData(new NetSessionId(args[0]), out var data))
|
||||
{
|
||||
var mind = data.ContentData().Mind;
|
||||
var refl = IoCManager.Resolve<IReflectionManager>();
|
||||
var type = refl.LooseGetType(args[1]);
|
||||
mind.AddRole(type);
|
||||
var role = new Job(mind, _prototypeManager.Index<JobPrototype>(args[1]));
|
||||
mind.AddRole(role);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -78,6 +85,11 @@ namespace Content.Server.Mobs
|
||||
|
||||
public class RemoveRoleCommand : IClientCommand
|
||||
{
|
||||
|
||||
#pragma warning disable 649
|
||||
[Dependency] private IPrototypeManager _prototypeManager;
|
||||
#pragma warning restore 649
|
||||
|
||||
public string Command => "rmrole";
|
||||
|
||||
public string Description => "Removes a role from a player's mind.";
|
||||
@@ -96,9 +108,8 @@ namespace Content.Server.Mobs
|
||||
if (mgr.TryGetPlayerData(new NetSessionId(args[0]), out var data))
|
||||
{
|
||||
var mind = data.ContentData().Mind;
|
||||
var refl = IoCManager.Resolve<IReflectionManager>();
|
||||
var type = refl.LooseGetType(args[1]);
|
||||
mind.RemoveRole(type);
|
||||
var role = new Job(mind, _prototypeManager.Index<JobPrototype>(args[1]));
|
||||
mind.RemoveRole(role);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user