Some checks reported errors
studiorailgun/Renderer/pipeline/head Something is wrong with the build of this commit
66 lines
2.0 KiB
Java
66 lines
2.0 KiB
Java
package electrosphere.server.macro.character;
|
|
|
|
import org.joml.Vector3d;
|
|
|
|
import electrosphere.engine.Globals;
|
|
import electrosphere.server.datacell.Realm;
|
|
import electrosphere.server.macro.character.data.CharacterDataStrings;
|
|
import electrosphere.server.macro.character.diety.Diety;
|
|
import electrosphere.server.macro.race.Race;
|
|
import electrosphere.server.macro.structure.Structure;
|
|
import electrosphere.server.macro.town.Town;
|
|
|
|
/**
|
|
* Utility functions for dealing with characters
|
|
*/
|
|
public class CharacterUtils {
|
|
|
|
/**
|
|
* Adds diety data for the character
|
|
* @param character The character
|
|
* @param diety The diety data
|
|
*/
|
|
public static void addDiety(Character character, Diety diety){
|
|
character.putData(CharacterDataStrings.DIETY, diety);
|
|
}
|
|
|
|
/**
|
|
* Gets diety data for the character
|
|
* @param character The character
|
|
* @return The diety data
|
|
*/
|
|
public static Diety getDiety(Character character){
|
|
return (Diety)character.getData(CharacterDataStrings.DIETY);
|
|
}
|
|
|
|
public static void addShelter(Character character, Structure shelter){
|
|
character.putData(CharacterDataStrings.SHELTER, shelter);
|
|
}
|
|
|
|
public static Structure getShelter(Character character){
|
|
return (Structure)character.getData(CharacterDataStrings.SHELTER);
|
|
}
|
|
|
|
public static void addHometown(Character character, Town town){
|
|
character.putData(CharacterDataStrings.HOMETOWN, town);
|
|
}
|
|
|
|
public static Town getHometown(Character character){
|
|
return (Town)character.getData(CharacterDataStrings.HOMETOWN);
|
|
}
|
|
|
|
/**
|
|
* Spawns a character
|
|
* @param realm The realm to spawn the character within
|
|
* @return The character
|
|
*/
|
|
public static Character spawnCharacter(Realm realm, Vector3d position){
|
|
Character rVal = Globals.characterService.createCharacter(null, 0);
|
|
rVal.setPos(position);
|
|
Race.setRace(rVal, Race.create("human", "human"));
|
|
realm.getDataCellManager().evaluateMacroObject(rVal);
|
|
return rVal;
|
|
}
|
|
|
|
}
|