Skip to content

Commit

Permalink
move vehicle methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Muttley committed Dec 3, 2024
1 parent 0f991ce commit 42f2071
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 48 deletions.
40 changes: 0 additions & 40 deletions system/src/sheets/FalloutBaseActorSheet.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -605,46 +605,6 @@ export default class FalloutBaseActorSheet extends ActorSheet {
});
}

async _onVehicleCoverRoll(event) {

const numOfDice = this.actor.system.cover.value;

let rollName = `${game.i18n.localize("TYPES.Actor.vehicle")} ${game.i18n.localize("FALLOUT.VEHICLE.cover")}`;

let actorUUID;
let _token = this.actor.token;
if (_token) actorUUID = this.actor.token.uuid;
else actorUUID = this.actor.uuid;

// console.warn(fromUuidSync(actorUUID).actor)

fallout.DialogD6.createDialog({
rollName: rollName,
diceNum: numOfDice,
actor: actorUUID,
});
}

async _onVehicleImpactRoll(event) {

const numOfDice = this.actor.system.impact.value;

let rollName = `${game.i18n.localize("TYPES.Actor.vehicle")} ${game.i18n.localize("FALLOUT.VEHICLE.impact")}`;

let actorUUID;
let _token = this.actor.token;
if (_token) actorUUID = this.actor.token.uuid;
else actorUUID = this.actor.uuid;

// console.warn(fromUuidSync(actorUUID).actor)

fallout.DialogD6.createDialog({
rollName: rollName,
diceNum: numOfDice,
actor: actorUUID,
});
}

async _onWeaponRoll(event) {
const li = $(event.currentTarget).parents(".item");
const item = this.actor.items.get(li.data("item-id"));
Expand Down
3 changes: 0 additions & 3 deletions system/src/sheets/FalloutPcSheet.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import FalloutBaseActorSheet from "./FalloutBaseActorSheet.mjs";

/**
* @extends {ActorSheet}
*/
export default class FalloutPcSheet extends FalloutBaseActorSheet {

chemDoseManager;
Expand Down
54 changes: 49 additions & 5 deletions system/src/sheets/FalloutVehicleSheet.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import FalloutBaseActorSheet from "./FalloutBaseActorSheet.mjs";

/**
* @extends {FalloutBaseActorSheet}
*/export default class FalloutVehicleSheet extends FalloutBaseActorSheet {
export default class FalloutVehicleSheet extends FalloutBaseActorSheet {

/** @override */
static get defaultOptions() {
Expand All @@ -20,11 +18,13 @@ import FalloutBaseActorSheet from "./FalloutBaseActorSheet.mjs";
});
}


/** @override */
get initialTab() {
return "abilities";
}


/** @override */
get inventorySections() {
return [
Expand All @@ -33,11 +33,13 @@ import FalloutBaseActorSheet from "./FalloutBaseActorSheet.mjs";
];
}


/** @override */
get template() {
return "systems/fallout/templates/actor/vehicle-sheet.hbs";
}


/** @override */
activateListeners(html) {
super.activateListeners(html);
Expand All @@ -56,6 +58,7 @@ import FalloutBaseActorSheet from "./FalloutBaseActorSheet.mjs";

}


async getData(options) {
const context = await super.getData(options);

Expand Down Expand Up @@ -130,8 +133,8 @@ import FalloutBaseActorSheet from "./FalloutBaseActorSheet.mjs";
return context;
}

async _updateObject(event, formData) {

async _updateObject(event, formData) {
for (const resistanceType of ["energy", "physical"]) {
const key = `_all_${resistanceType}`;
const val = formData[key] ?? null;
Expand All @@ -151,8 +154,8 @@ import FalloutBaseActorSheet from "./FalloutBaseActorSheet.mjs";

}

async _getVehicleQualities(context, actor) {

async _getVehicleQualities(context, actor) {
const vehicleQualities = [];
for (const key in CONFIG.FALLOUT.VEHICLE_QUALITIES) {
vehicleQualities.push({
Expand All @@ -169,6 +172,47 @@ import FalloutBaseActorSheet from "./FalloutBaseActorSheet.mjs";
);
}


async _onVehicleCoverRoll(event) {
const numOfDice = this.actor.system.cover.value;

let rollName = `${game.i18n.localize("TYPES.Actor.vehicle")} ${game.i18n.localize("FALLOUT.VEHICLE.cover")}`;

let actorUUID;
let _token = this.actor.token;
if (_token) actorUUID = this.actor.token.uuid;
else actorUUID = this.actor.uuid;

// console.warn(fromUuidSync(actorUUID).actor)

fallout.DialogD6.createDialog({
rollName: rollName,
diceNum: numOfDice,
actor: actorUUID,
});
}


async _onVehicleImpactRoll(event) {
const numOfDice = this.actor.system.impact.value;

let rollName = `${game.i18n.localize("TYPES.Actor.vehicle")} ${game.i18n.localize("FALLOUT.VEHICLE.impact")}`;

let actorUUID;
let _token = this.actor.token;
if (_token) actorUUID = this.actor.token.uuid;
else actorUUID = this.actor.uuid;

// console.warn(fromUuidSync(actorUUID).actor)

fallout.DialogD6.createDialog({
rollName: rollName,
diceNum: numOfDice,
actor: actorUUID,
});
}


async _onVehicleWeaponRoll(event) {
const li = $(event.currentTarget).parents(".item");
const item = this.actor.items.get(li.data("item-id"));
Expand Down

0 comments on commit 42f2071

Please sign in to comment.