Small progress on tabletop
This commit is contained in:
@@ -10,13 +10,13 @@ export default function computeAction(computation, node){
|
||||
if (!prop.resources) return;
|
||||
prop.resources.itemsConsumed.forEach(itemConsumed => {
|
||||
if (!itemConsumed.itemId) return;
|
||||
if (itemConsumed.available < itemConsumed.quantity.value){
|
||||
if (itemConsumed.available < itemConsumed.quantity?.value){
|
||||
prop.insufficientResources = true;
|
||||
}
|
||||
});
|
||||
prop.resources.attributesConsumed.forEach(attConsumed => {
|
||||
if (!attConsumed.variableName) return;
|
||||
if (attConsumed.available < attConsumed.quantity.value){
|
||||
if (attConsumed.available < attConsumed.quantity?.value){
|
||||
prop.insufficientResources = true;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -28,7 +28,7 @@ let BuffSchema = createPropertySchema({
|
||||
'self',
|
||||
'target',
|
||||
],
|
||||
defaultValue: 'every',
|
||||
defaultValue: 'target',
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import { Random } from 'meteor/random';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
import createPropertySchema from '/imports/api/properties/subSchemas/createPropertySchema.js';
|
||||
|
||||
const AttributeConsumedSchema = createPropertySchema({
|
||||
_id: {
|
||||
type: String,
|
||||
regEx: SimpleSchema.RegEx.Id,
|
||||
autoValue(){
|
||||
if (!this.isSet) return Random.id();
|
||||
}
|
||||
},
|
||||
variableName: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.variableName,
|
||||
},
|
||||
quantity: {
|
||||
type: 'fieldToCompute',
|
||||
optional: true,
|
||||
},
|
||||
});
|
||||
|
||||
const ComputedOnlyAttributeConsumedSchema = createPropertySchema({
|
||||
quantity: {
|
||||
type: 'computedOnlyField',
|
||||
optional: true,
|
||||
},
|
||||
available: {
|
||||
type: Number,
|
||||
optional: true,
|
||||
},
|
||||
statId: {
|
||||
type: String,
|
||||
regEx: SimpleSchema.RegEx.Id,
|
||||
optional: true,
|
||||
},
|
||||
statName: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.name,
|
||||
},
|
||||
});
|
||||
|
||||
const ComputedAttributeConsumedSchema = new SimpleSchema()
|
||||
.extend(AttributeConsumedSchema)
|
||||
.extend(ComputedOnlyAttributeConsumedSchema);
|
||||
|
||||
export {
|
||||
AttributeConsumedSchema,
|
||||
ComputedOnlyAttributeConsumedSchema,
|
||||
ComputedAttributeConsumedSchema
|
||||
};
|
||||
@@ -1,64 +0,0 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import { Random } from 'meteor/random';
|
||||
import { storedIconsSchema } from '/imports/api/icons/Icons.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
import createPropertySchema from '/imports/api/properties/subSchemas/createPropertySchema.js';
|
||||
|
||||
const ItemConsumedSchema = createPropertySchema({
|
||||
_id: {
|
||||
type: String,
|
||||
regEx: SimpleSchema.RegEx.Id,
|
||||
autoValue(){
|
||||
if (!this.isSet) return Random.id();
|
||||
}
|
||||
},
|
||||
tag: {
|
||||
type: String,
|
||||
optional: true,
|
||||
},
|
||||
quantity: {
|
||||
type: 'fieldToCompute',
|
||||
optional: true,
|
||||
},
|
||||
itemId: {
|
||||
type: String,
|
||||
regEx: SimpleSchema.RegEx.Id,
|
||||
optional: true,
|
||||
},
|
||||
});
|
||||
|
||||
const ComputedOnlyItemConsumedSchema = new SimpleSchema({
|
||||
available: {
|
||||
type: Number,
|
||||
optional: true,
|
||||
},
|
||||
quantity: {
|
||||
type: 'computedOnlyField',
|
||||
optional: true,
|
||||
},
|
||||
itemName: {
|
||||
type: String,
|
||||
max: STORAGE_LIMITS.name,
|
||||
optional: true,
|
||||
},
|
||||
itemIcon: {
|
||||
type: storedIconsSchema,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.icon,
|
||||
},
|
||||
itemColor: {
|
||||
type: String,
|
||||
optional: true,
|
||||
regEx: /^#([a-f0-9]{3}){1,2}\b$/i,
|
||||
},
|
||||
});
|
||||
|
||||
const ComputedItemConsumedSchema = new SimpleSchema()
|
||||
.extend(ItemConsumedSchema)
|
||||
.extend(ComputedOnlyItemConsumedSchema);
|
||||
|
||||
export {
|
||||
ItemConsumedSchema,
|
||||
ComputedOnlyItemConsumedSchema,
|
||||
ComputedItemConsumedSchema
|
||||
};
|
||||
@@ -48,4 +48,8 @@ let TabletopSchema = new SimpleSchema({
|
||||
|
||||
Tabletops.attachSchema(TabletopSchema);
|
||||
|
||||
import '/imports/api/tabletop/methods/removeTabletop.js';
|
||||
import '/imports/api/tabletop/methods/insertTabletop.js';
|
||||
import '/imports/api/tabletop/methods/addCreaturesToTabletop.js';
|
||||
|
||||
export default Tabletops;
|
||||
|
||||
@@ -4,7 +4,7 @@ import { RateLimiterMixin } from 'ddp-rate-limiter-mixin';
|
||||
import Tabletops from '../Tabletops.js';
|
||||
import { assertAdmin } from '/imports/api/sharing/sharingPermissions.js';
|
||||
import { assertUserHasPaidBenefits } from '/imports/api/users/patreon/tiers.js';
|
||||
import { assertUserIsTabletopOwner } from './shared/tabletopPermissions/js';
|
||||
import { assertUserIsTabletopOwner } from './shared/tabletopPermissions.js';
|
||||
import Creatures from '/imports/api/creature/creatures/Creatures.js';
|
||||
|
||||
const removeTabletop = new ValidatedMethod({
|
||||
|
||||
Reference in New Issue
Block a user