Initial commit for getting deployments to display

This commit is contained in:
TJ 2021-06-11 23:30:06 -05:00
parent 516e6a0bd1
commit b701662dbe
2 changed files with 70 additions and 63 deletions

View file

@ -1728,71 +1728,70 @@ export default class Actor5e extends Actor {
*/
async deployInto(target, { coord=false, gunner=false, mech=false, oper=false,
pilot=false, tech=false, crew=false, pass=false}={}) {
// Get the starship Actor data and the new char data
const sship = duplicate(this.toJSON());
const ssDeploy = sship.data.attributes.deployment;
const char = target;
const charUUID = char.uuid;
const charName = char.data.name;
const charRank = char.data.data.attributes.rank;
let charProf = 0;
if (charRank.total > 0) {
charProf = char.data.data.attributes.prof;
// Get the starship Actor data and the new char data
const sship = duplicate(this.toJSON());
const ssDeploy = sship.data.attributes.deployment;
const char = target;
const charUUID = char.uuid;
const charName = char.data.name;
const charRank = char.data.data.attributes.rank;
let charProf = 0;
if (charRank === undefined || charRank.total > 0) {
charProf = char.data.data.attributes.prof;
}
if (coord) {
ssDeploy.coord.uuid = charUUID;
ssDeploy.coord.name = charName;
ssDeploy.coord.rank = charRank ? charRank.coord : 0;
ssDeploy.coord.prof = charProf;
}
if (gunner) {
ssDeploy.gunner.uuid = charUUID;
ssDeploy.gunner.name = charName;
ssDeploy.gunner.rank = charRank ? charRank.gunner : 0;
ssDeploy.gunner.prof = charProf;
}
if (mech) {
ssDeploy.mechanic.uuid = charUUID;
ssDeploy.mechanic.name = charName;
ssDeploy.mechanic.rank = charRank ? charRank.mechanic : 0;
ssDeploy.mechanic.prof = charProf;
}
if (oper) {
ssDeploy.operator.uuid = charUUID;
ssDeploy.operator.name = charName;
ssDeploy.operator.rank = charRank ? charRank.operator : 0;
ssDeploy.operator.prof = charProf;
}
if (pilot) {
ssDeploy.pilot.uuid = charUUID;
ssDeploy.pilot.name = charName;
ssDeploy.pilot.rank = charRank ? charRank.pilot : 0;
ssDeploy.pilot.prof = charProf;
}
if (tech) {
ssDeploy.technician.uuid = charUUID;
ssDeploy.technician.name = charName;
ssDeploy.technician.rank = charRank ? charRank.technician : 0;
ssDeploy.technician.prof = charProf;
}
if (crew) {
ssDeploy.crew.push({ uuid: charUUID, name: charName, rank: charRank, prof: charProf });
}
if (pass) {
ssDeploy.passenger.push({ uuid: charUUID, name: charName, rank: charRank, prof: charProf });
}
this.update({ "data.attributes.deployment": ssDeploy });
}
if (coord){
ssDeploy.coord.uuid = charUUID;
ssDeploy.coord.name = charName;
ssDeploy.coord.rank = charRank.coord;
ssDeploy.coord.prof = charProf;
}
if (gunner){
ssDeploy.gunner.uuid = charUUID;
ssDeploy.gunner.name = charName;
ssDeploy.gunner.rank = charRank.gunner;
ssDeploy.gunner.prof = charProf;
}
if (mech){
ssDeploy.mechanic.uuid = charUUID;
ssDeploy.mechanic.name = charName;
ssDeploy.mechanic.rank = charRank.mechanic;
ssDeploy.mechanic.prof = charProf;
}
if (oper){
ssDeploy.operator.uuid = charUUID;
ssDeploy.operator.name = charName;
ssDeploy.operator.rank = charRank.operator;
ssDeploy.operator.prof = charProf;
}
if (pilot){
ssDeploy.pilot.uuid = charUUID;
ssDeploy.pilot.name = charName;
ssDeploy.pilot.rank = charRank.pilot;
ssDeploy.pilot.prof = charProf;
}
if (tech){
ssDeploy.technician.uuid = charUUID;
ssDeploy.technician.name = charName;
ssDeploy.technician.rank = charRank.technician;
ssDeploy.technician.prof = charProf;
}
if (crew){
ssDeploy.crew.push({"uuid": charUUID, "name": charName, "rank": charRank, "prof": charProf});
}
if (pass){
ssDeploy.passenger.push({"uuid": charUUID, "name": charName, "rank": charRank, "prof": charProf});
}
this.update({"data.attributes.deployment": ssDeploy});
}
/**
* Transform this Actor into another one.

View file

@ -8,6 +8,14 @@
<li class="filter-item" data-filter="reaction">{{localize "SW5E.Reaction"}}</li>
</ul>
<ol>
<li>Coordinator: {{data.attributes.deployment.coord.name}}</li>
<li>Gunner: {{data.attributes.deployment.gunner.name}}</li>
<li>Mechanic: {{data.attributes.deployment.mechanic.name}}</li>
<li>Operator: {{data.attributes.deployment.operator.name}}</li>
<li>Pilot: {{data.attributes.deployment.pilot.name}}</li>
<li>Technician: {{data.attributes.deployment.technician.name}}</li>
</ol>
<ol class="group-list">
{{#each sections as |section sid|}}