Fixed broken logging for actions
This commit is contained in:
@@ -4,7 +4,8 @@ import {insertCreatureLog} from '/imports/api/creature/log/CreatureLogs.js';
|
||||
export default function applyAction({prop, creature}){
|
||||
spendResources(prop);
|
||||
insertCreatureLog.call({
|
||||
log: prop.name,
|
||||
creatureId: creature._id,
|
||||
log: {
|
||||
text: prop.name,
|
||||
creatureId: creature._id},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,7 +10,9 @@ export default function applyAttack({
|
||||
}){
|
||||
let result = math.roll(1, 20) + prop.rollBonusResult;
|
||||
insertCreatureLog.call({
|
||||
log: `${prop.name} attack. ${result} to hit`,
|
||||
creatureId: creature._id,
|
||||
log: {
|
||||
text: `${prop.name} attack. ${result} to hit`,
|
||||
creatureId: creature._id,
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -74,12 +74,9 @@ const insertCreatureLog = new ValidatedMethod({
|
||||
},
|
||||
validate: new SimpleSchema({
|
||||
log: CreatureLogSchema.omit('type', 'date'),
|
||||
creatureId: {
|
||||
type: String,
|
||||
regEx: SimpleSchema.RegEx.Id,
|
||||
},
|
||||
}).validator(),
|
||||
run({log, creatureId}){
|
||||
run({log}){
|
||||
const creatureId = log.creatureId;
|
||||
const creature = Creatures.findOne(creatureId, {fields: {
|
||||
readers: 1,
|
||||
writers: 1,
|
||||
@@ -93,10 +90,6 @@ const insertCreatureLog = new ValidatedMethod({
|
||||
if (typeof log === 'string'){
|
||||
log = {text: log};
|
||||
}
|
||||
if (Meteor.isServer){
|
||||
Meteor._sleepForMs(5000);
|
||||
}
|
||||
log.creatureId = creatureId;
|
||||
log.date = new Date();
|
||||
// Insert it
|
||||
let id = CreatureLogs.insert(log);
|
||||
|
||||
Reference in New Issue
Block a user