areaspawnr
Advanced tools
Comparing version 0.7.2 to 0.7.3
{ | ||
"editor.tabSize": 4, | ||
"editor.trimAutoWhitespace": true, | ||
"files.exclude": { | ||
"**/*.d.ts": true, | ||
"**/*.js.map": true, | ||
"**/*.js": { "when": "$(basename).ts" }, | ||
"**/*?.js": { "when": "$(basename).tsx" } | ||
}, | ||
"tslint.alwaysShowRuleFailuresAsWarnings": true, | ||
@@ -5,0 +11,0 @@ "tslint.autoFixOnSave": true, |
@@ -1,440 +0,1 @@ | ||
define(function() { return /******/ (function(modules) { // webpackBootstrap | ||
/******/ // The module cache | ||
/******/ var installedModules = {}; | ||
/******/ | ||
/******/ // The require function | ||
/******/ function __webpack_require__(moduleId) { | ||
/******/ | ||
/******/ // Check if module is in cache | ||
/******/ if(installedModules[moduleId]) { | ||
/******/ return installedModules[moduleId].exports; | ||
/******/ } | ||
/******/ // Create a new module (and put it into the cache) | ||
/******/ var module = installedModules[moduleId] = { | ||
/******/ i: moduleId, | ||
/******/ l: false, | ||
/******/ exports: {} | ||
/******/ }; | ||
/******/ | ||
/******/ // Execute the module function | ||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); | ||
/******/ | ||
/******/ // Flag the module as loaded | ||
/******/ module.l = true; | ||
/******/ | ||
/******/ // Return the exports of the module | ||
/******/ return module.exports; | ||
/******/ } | ||
/******/ | ||
/******/ | ||
/******/ // expose the modules object (__webpack_modules__) | ||
/******/ __webpack_require__.m = modules; | ||
/******/ | ||
/******/ // expose the module cache | ||
/******/ __webpack_require__.c = installedModules; | ||
/******/ | ||
/******/ // define getter function for harmony exports | ||
/******/ __webpack_require__.d = function(exports, name, getter) { | ||
/******/ if(!__webpack_require__.o(exports, name)) { | ||
/******/ Object.defineProperty(exports, name, { | ||
/******/ configurable: false, | ||
/******/ enumerable: true, | ||
/******/ get: getter | ||
/******/ }); | ||
/******/ } | ||
/******/ }; | ||
/******/ | ||
/******/ // getDefaultExport function for compatibility with non-harmony modules | ||
/******/ __webpack_require__.n = function(module) { | ||
/******/ var getter = module && module.__esModule ? | ||
/******/ function getDefault() { return module['default']; } : | ||
/******/ function getModuleExports() { return module; }; | ||
/******/ __webpack_require__.d(getter, 'a', getter); | ||
/******/ return getter; | ||
/******/ }; | ||
/******/ | ||
/******/ // Object.prototype.hasOwnProperty.call | ||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; | ||
/******/ | ||
/******/ // __webpack_public_path__ | ||
/******/ __webpack_require__.p = ""; | ||
/******/ | ||
/******/ // Load entry module and return exports | ||
/******/ return __webpack_require__(__webpack_require__.s = 0); | ||
/******/ }) | ||
/************************************************************************/ | ||
/******/ ([ | ||
/* 0 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__, exports], __WEBPACK_AMD_DEFINE_RESULT__ = (function (require, exports) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/** | ||
* Directional equivalents for converting from directions to keys. | ||
*/ | ||
var directionKeys = { | ||
xInc: "left", | ||
xDec: "right", | ||
yInc: "top", | ||
yDec: "bottom", | ||
}; | ||
/** | ||
* Opposite directions for when finding descending order Arrays. | ||
*/ | ||
var directionOpposites = { | ||
xInc: "xDec", | ||
xDec: "xInc", | ||
yInc: "yDec", | ||
yDec: "yInc", | ||
}; | ||
/** | ||
* Conditionally returns a measurement based on what direction String is | ||
* given. This is useful for generically finding boundaries when the | ||
* direction isn't known, such as in findPreThingsSpawnStart and -End. | ||
* | ||
* @param direction The direction by which to order PreThings, as "xInc", | ||
* "xDec", "yInc", or "yDec". | ||
* @param top The upper-most bound to apply within. | ||
* @param right The right-most bound to apply within. | ||
* @param bottom The bottom-most bound to apply within. | ||
* @param left The left-most bound to apply within. | ||
* @returns Either top, right, bottom, or left, depending on direction. | ||
*/ | ||
var getDirectionEnd = function (directionKey, top, right, bottom, left) { | ||
switch (directionKey) { | ||
case "top": | ||
return top; | ||
case "right": | ||
return right; | ||
case "bottom": | ||
return bottom; | ||
case "left": | ||
return left; | ||
default: | ||
throw new Error("Unknown directionKey: '" + directionKey + "'."); | ||
} | ||
}; | ||
/** | ||
* Finds the index from which PreThings should stop having an action | ||
* applied to them in applySpawnAction. This is less efficient than the | ||
* unused version below, but is more reliable for slightly unsorted groups. | ||
* | ||
* @param direction The direction by which to order PreThings, as "xInc", | ||
* "xDec", "yInc", or "yDec". | ||
* @param group The group to find a PreThing index within. | ||
* @param _mid The middle of the group. This is currently unused. | ||
* @param top The upper-most bound to apply within. | ||
* @param right The right-most bound to apply within. | ||
* @param bottom The bottom-most bound to apply within. | ||
* @param left The left-most bound to apply within. | ||
* @returns The index to start spawning PreThings from. | ||
*/ | ||
var findPreThingsSpawnStart = function (direction, group, top, right, bottom, left) { | ||
var directionKey = directionKeys[direction]; | ||
var directionEnd = getDirectionEnd(directionKey, top, right, bottom, left); | ||
for (var i = 0; i < group.length; i += 1) { | ||
if (group[i][directionKey] >= directionEnd) { | ||
return i; | ||
} | ||
} | ||
return group.length; | ||
}; | ||
/** | ||
* Finds the index from which PreThings should stop having an action | ||
* applied to them in applySpawnAction. This is less efficient than the | ||
* unused version below, but is more reliable for slightly unsorted groups. | ||
* | ||
* @param direction The direction by which to order PreThings, as "xInc", | ||
* "xDec", "yInc", or "yDec". | ||
* @param group The group to find a PreThing index within. | ||
* @param _mid The middle of the group. This is currently unused. | ||
* @param top The upper-most bound to apply within. | ||
* @param right The right-most bound to apply within. | ||
* @param bottom The bottom-most bound to apply within. | ||
* @param left The left-most bound to apply within. | ||
* @returns The index to stop spawning PreThings from. | ||
*/ | ||
var findPreThingsSpawnEnd = function (direction, group, top, right, bottom, left) { | ||
var directionKey = directionKeys[direction]; | ||
var directionKeyOpposite = directionKeys[directionOpposites[direction]]; | ||
var directionEnd = getDirectionEnd(directionKeyOpposite, top, right, bottom, left); | ||
for (var i = group.length - 1; i >= 0; i -= 1) { | ||
if (group[i][directionKey] <= directionEnd) { | ||
return i; | ||
} | ||
} | ||
return -1; | ||
}; | ||
/** | ||
* Loads GameStartr maps to spawn and unspawn areas on demand. | ||
*/ | ||
var AreaSpawnr = /** @class */ (function () { | ||
/** | ||
* Initializes a new instance of the AreaSpawnr class. | ||
* | ||
* @param settings Settings to be used for initialization. | ||
*/ | ||
function AreaSpawnr(settings) { | ||
if (!settings) { | ||
throw new Error("No settings given to AreaSpawnr."); | ||
} | ||
if (!settings.mapsCreatr) { | ||
throw new Error("No mapsCreatr provided to AreaSpawnr."); | ||
} | ||
if (!settings.mapScreenr) { | ||
throw new Error("No mapsCreatr provided to AreaSpawnr."); | ||
} | ||
this.mapsCreator = settings.mapsCreatr; | ||
this.mapScreenr = settings.mapScreenr; | ||
this.onSpawn = settings.onSpawn; | ||
this.onUnspawn = settings.onUnspawn; | ||
this.screenAttributes = settings.screenAttributes || []; | ||
this.stretchAdd = settings.stretchAdd; | ||
this.afterAdd = settings.afterAdd; | ||
} | ||
/** | ||
* @returns The attribute names to be copied to MapScreener. | ||
*/ | ||
AreaSpawnr.prototype.getScreenAttributes = function () { | ||
return this.screenAttributes; | ||
}; | ||
/** | ||
* @returns The key by which the current Map is indexed. | ||
*/ | ||
AreaSpawnr.prototype.getMapName = function () { | ||
return this.mapName; | ||
}; | ||
/** | ||
* Gets the map listed under the given name. If no name is provided, the | ||
* mapCurrent is returned instead. | ||
* | ||
* @param name An optional key to find the map under. | ||
* @returns A Map under the given name, or the current map if none given. | ||
*/ | ||
AreaSpawnr.prototype.getMap = function (name) { | ||
return typeof name === "undefined" | ||
? this.mapCurrent | ||
: this.mapsCreator.getMap(name); | ||
}; | ||
/** | ||
* Simple getter pipe to the internal MapsCreator.getMaps() function. | ||
* | ||
* @returns A listing of maps, keyed by their names. | ||
*/ | ||
AreaSpawnr.prototype.getMaps = function () { | ||
return this.mapsCreator.getMaps(); | ||
}; | ||
/** | ||
* @returns The current Area. | ||
*/ | ||
AreaSpawnr.prototype.getArea = function () { | ||
return this.areaCurrent; | ||
}; | ||
/** | ||
* @returns The name of the current Area. | ||
*/ | ||
AreaSpawnr.prototype.getAreaName = function () { | ||
return this.areaCurrent.name; | ||
}; | ||
/** | ||
* @param location The key of the Location to return. | ||
* @returns A Location within the current Map. | ||
*/ | ||
AreaSpawnr.prototype.getLocation = function (location) { | ||
return this.areaCurrent.map.locations[location]; | ||
}; | ||
/** | ||
* @returns The most recently entered Location in the current Area. | ||
*/ | ||
AreaSpawnr.prototype.getLocationEntered = function () { | ||
return this.locationEntered; | ||
}; | ||
/** | ||
* Simple getter function for the internal prethings object. This will be | ||
* undefined before the first call to setMap. | ||
* | ||
* @returns A listing of the current area's Prethings. | ||
*/ | ||
AreaSpawnr.prototype.getPreThings = function () { | ||
return this.prethings; | ||
}; | ||
/** | ||
* Sets the currently manipulated Map in the handler to be the one under a | ||
* given name. Note that this will do very little unless a location is | ||
* provided. | ||
* | ||
* @param name A key to find the map under. | ||
* @param location An optional key for a location to immediately start the | ||
* map in (if not provided, ignored). | ||
* @returns The now-current map. | ||
*/ | ||
AreaSpawnr.prototype.setMap = function (name, location) { | ||
// Get the newly current map from this.getMap normally | ||
this.mapCurrent = this.getMap(name); | ||
if (!this.mapCurrent) { | ||
throw new Error("Unknown Map in setMap: '" + name + "'."); | ||
} | ||
this.mapName = name; | ||
// Most of the work is done by setLocation (by default, the map's first) | ||
if (location !== undefined) { | ||
this.setLocation(location); | ||
} | ||
return this.mapCurrent; | ||
}; | ||
/** | ||
* Goes to a particular location in the given map. Area attributes are | ||
* copied to the MapScreener, PreThings are loaded, and stretches and afters | ||
* are checked. | ||
* | ||
* @param name The key of the Location to start in. | ||
* @returns The newly set Location. | ||
*/ | ||
AreaSpawnr.prototype.setLocation = function (name) { | ||
var location = this.mapCurrent.locations[name]; | ||
if (!location) { | ||
throw new Error("Unknown location in setLocation: '" + name + "'."); | ||
} | ||
this.locationEntered = location; | ||
this.areaCurrent = location.area; | ||
this.areaCurrent.boundaries = { | ||
top: 0, | ||
right: 0, | ||
bottom: 0, | ||
left: 0, | ||
}; | ||
// Copy all the settings from that area into the MapScreenr container | ||
for (var _i = 0, _a = this.screenAttributes; _i < _a.length; _i++) { | ||
var attribute = _a[_i]; | ||
this.mapScreenr.variables[attribute] = this.areaCurrent[attribute]; | ||
} | ||
// Reset the prethings object, enabling it to be used as a fresh start | ||
// For the new Area/Location placements | ||
this.prethings = this.mapsCreator.getPreThings(location.area); | ||
// Optional: set stretch commands | ||
if (this.areaCurrent.stretches) { | ||
this.setStretches(this.areaCurrent.stretches); | ||
} | ||
// Optional: set after commands | ||
if (this.areaCurrent.afters) { | ||
this.setAfters(this.areaCurrent.afters); | ||
} | ||
return location; | ||
}; | ||
/** | ||
* Applies the stretchAdd Function to each given "stretch" command and | ||
* stores the commands in stretches. | ||
* | ||
* @param stretchesRaw Raw descriptions of the stretches. | ||
*/ | ||
AreaSpawnr.prototype.setStretches = function (stretchesRaw) { | ||
if (!this.stretchAdd) { | ||
throw new Error("Cannot call setStretches without a stretchAdd."); | ||
} | ||
for (var i = 0; i < stretchesRaw.length; i += 1) { | ||
this.stretchAdd(stretchesRaw[i], i, stretchesRaw); | ||
} | ||
}; | ||
/** | ||
* Applies the afterAdd Function to each given "after" command and stores | ||
* the commands in afters. | ||
* | ||
* @param aftersRaw Raw descriptions of the afters. | ||
*/ | ||
AreaSpawnr.prototype.setAfters = function (aftersRaw) { | ||
if (!this.afterAdd) { | ||
throw new Error("Cannot call setAfters without an afterAdd."); | ||
} | ||
for (var i = 0; i < aftersRaw.length; i += 1) { | ||
this.afterAdd(aftersRaw[i], i, aftersRaw); | ||
} | ||
}; | ||
/** | ||
* Calls onSpawn on every PreThing touched by the given bounding box, | ||
* determined in order of the given direction. This is a simple wrapper | ||
* around applySpawnAction that also gives it true as the status. | ||
* | ||
* @param direction The direction by which to order PreThings, as "xInc", | ||
* "xDec", "yInc", or "yDec". | ||
* @param top The upper-most bound to spawn within. | ||
* @param right The right-most bound to spawn within. | ||
* @param bottom The bottom-most bound to spawn within. | ||
* @param left The left-most bound to spawn within. | ||
*/ | ||
AreaSpawnr.prototype.spawnArea = function (direction, top, right, bottom, left) { | ||
if (this.onSpawn) { | ||
this.applySpawnAction(this.onSpawn, true, direction, top, right, bottom, left); | ||
} | ||
}; | ||
/** | ||
* Calls onUnspawn on every PreThing touched by the given bounding box, | ||
* determined in order of the given direction. This is a simple wrapper | ||
* around applySpawnAction that also gives it false as the status. | ||
* | ||
* @param direction The direction by which to order PreThings, as "xInc", | ||
* "xDec", "yInc", or "yDec". | ||
* @param top The upper-most bound to spawn within. | ||
* @param right The right-most bound to spawn within. | ||
* @param bottom The bottom-most bound to spawn within. | ||
* @param left The left-most bound to spawn within. | ||
*/ | ||
AreaSpawnr.prototype.unspawnArea = function (direction, top, right, bottom, left) { | ||
if (this.onUnspawn) { | ||
this.applySpawnAction(this.onUnspawn, false, direction, top, right, bottom, left); | ||
} | ||
}; | ||
/** | ||
* Calls onUnspawn on every PreThing touched by the given bounding box, | ||
* determined in order of the given direction. This is used both to spawn | ||
* and un-spawn PreThings, such as during QuadsKeepr shifting. The given | ||
* status is used as a filter: all PreThings that already have the status | ||
* (generally true or false as spawned or unspawned, respectively) will have | ||
* the callback called on them. | ||
* | ||
* @param callback The callback to be run whenever a matching matching | ||
* PreThing is found. | ||
* @param status The spawn status to match PreThings against. Only PreThings | ||
* with .spawned === status will have the callback applied. | ||
* @param direction The direction by which to order PreThings, as "xInc", | ||
* "xDec", "yInc", or "yDec". | ||
* @param top The upper-most bound to apply within. | ||
* @param right The right-most bound to apply within. | ||
* @param bottom The bottom-most bound to apply within. | ||
* @param left The left-most bound to apply within. | ||
*/ | ||
AreaSpawnr.prototype.applySpawnAction = function (callback, status, direction, top, right, bottom, left) { | ||
// For each group of PreThings currently able to spawn... | ||
for (var name_1 in this.prethings) { | ||
if (!this.prethings.hasOwnProperty(name_1)) { | ||
continue; | ||
} | ||
// Don't bother trying to spawn the group if it has no members | ||
var group = this.prethings[name_1][direction]; | ||
if (group.length === 0) { | ||
continue; | ||
} | ||
// Find the start and end points within the PreThings Array | ||
// Ex. if direction="xInc", go from .left >= left to .left <= right | ||
var start = findPreThingsSpawnStart(direction, group, top, right, bottom, left); | ||
var end = findPreThingsSpawnEnd(direction, group, top, right, bottom, left); | ||
// Loop through all the directionally valid PreThings, spawning if | ||
// They're within the bounding box | ||
for (var i = start; i <= end; i += 1) { | ||
var prething = group[i]; | ||
// For example: if status is true (spawned), don't spawn again | ||
if (prething.spawned !== status) { | ||
prething.spawned = status; | ||
callback(prething); | ||
} | ||
} | ||
} | ||
}; | ||
return AreaSpawnr; | ||
}()); | ||
exports.AreaSpawnr = AreaSpawnr; | ||
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), | ||
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); | ||
/***/ }) | ||
/******/ ])});; | ||
define(function(){return function(t){var r={};function e(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=t,e.c=r,e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:n})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,r){if(1&r&&(t=e(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(e.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var o in t)e.d(n,o,function(r){return t[r]}.bind(null,o));return n},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},e.p="",e(e.s=0)}([function(t,r,e){var n,o;n=[e,r,e(1)],void 0===(o=function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),function(t){for(var e in t)r.hasOwnProperty(e)||(r[e]=t[e])}(e)}.apply(r,n))||(t.exports=o)},function(t,r,e){var n;void 0===(n=function(t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var e={xDec:"right",xInc:"left",yDec:"bottom",yInc:"top"},n={xDec:"xInc",xInc:"xDec",yDec:"yInc",yInc:"yDec"},o=function(t,r,e,n,o){switch(t){case"top":return r;case"right":return e;case"bottom":return n;case"left":return o;default:throw new Error("Unknown directionKey: '"+t+"'.")}},a=function(t,r,n,a,i,s){for(var p=e[t],u=o(p,n,a,i,s),c=0;c<r.length;c+=1)if(r[c][p]>=u)return c;return r.length},i=function(t,r,a,i,s,p){for(var u=e[t],c=o(e[n[t]],a,i,s,p),h=r.length-1;h>=0;h-=1)if(r[h][u]<=c)return h;return-1},s=function(){function t(t){if(!t)throw new Error("No settings given to AreaSpawnr.");if(!t.mapsCreatr)throw new Error("No mapsCreatr provided to AreaSpawnr.");if(!t.mapScreenr)throw new Error("No mapsCreatr provided to AreaSpawnr.");this.mapsCreator=t.mapsCreatr,this.mapScreenr=t.mapScreenr,this.onSpawn=t.onSpawn,this.onUnspawn=t.onUnspawn,this.screenAttributes=t.screenAttributes||[],this.stretchAdd=t.stretchAdd,this.afterAdd=t.afterAdd}return t.prototype.getScreenAttributes=function(){return this.screenAttributes},t.prototype.getMapName=function(){return this.mapName},t.prototype.getMap=function(t){return void 0===t?this.mapCurrent:this.mapsCreator.getMap(t)},t.prototype.getMaps=function(){return this.mapsCreator.getMaps()},t.prototype.getArea=function(){return this.areaCurrent},t.prototype.getAreaName=function(){return this.areaCurrent.name},t.prototype.getLocation=function(t){return this.areaCurrent.map.locations[t]},t.prototype.getLocationEntered=function(){return this.locationEntered},t.prototype.getPreThings=function(){return this.prethings},t.prototype.setMap=function(t,r){if(this.mapCurrent=this.getMap(t),!this.mapCurrent)throw new Error("Unknown Map in setMap: '"+t+"'.");return this.mapName=t,void 0!==r&&this.setLocation(r),this.mapCurrent},t.prototype.setLocation=function(t){var r=this.mapCurrent.locations[t];if(!r)throw new Error("Unknown location in setLocation: '"+t+"'.");this.locationEntered=r,this.areaCurrent=r.area,this.areaCurrent.boundaries={bottom:0,left:0,right:0,top:0};for(var e=0,n=this.screenAttributes;e<n.length;e++){var o=n[e];this.mapScreenr.variables[o]=this.areaCurrent[o]}return this.prethings=this.mapsCreator.getPreThings(r.area),this.areaCurrent.stretches&&this.setStretches(this.areaCurrent.stretches),this.areaCurrent.afters&&this.setAfters(this.areaCurrent.afters),r},t.prototype.setStretches=function(t){if(!this.stretchAdd)throw new Error("Cannot call setStretches without a stretchAdd.");for(var r=0;r<t.length;r+=1)this.stretchAdd(t[r],r,t)},t.prototype.setAfters=function(t){if(!this.afterAdd)throw new Error("Cannot call setAfters without an afterAdd.");for(var r=0;r<t.length;r+=1)this.afterAdd(t[r],r,t)},t.prototype.spawnArea=function(t,r,e,n,o){this.onSpawn&&this.applySpawnAction(this.onSpawn,!0,t,r,e,n,o)},t.prototype.unspawnArea=function(t,r,e,n,o){this.onUnspawn&&this.applySpawnAction(this.onUnspawn,!1,t,r,e,n,o)},t.prototype.applySpawnAction=function(t,r,e,n,o,s,p){for(var u in this.prethings)if(this.prethings.hasOwnProperty(u)){var c=this.prethings[u][e];if(0!==c.length)for(var h=a(e,c,n,o,s,p),f=i(e,c,n,o,s,p),d=h;d<=f;d+=1){var l=c[d];l.spawned!==r&&(l.spawned=r,t(l))}}},t}();r.AreaSpawnr=s}.apply(r,[e,r]))||(t.exports=n)}])}); |
@@ -11,29 +11,34 @@ { | ||
"dependencies": { | ||
"itemsholdr": "^0.7.0", | ||
"mapscreatr": "^0.7.1", | ||
"mapscreenr": "^0.7.0", | ||
"objectmakr": "^0.7.0" | ||
"mapscreatr": "^0.7.5", | ||
"mapscreenr": "^0.7.2" | ||
}, | ||
"description": "Loads GameStartr maps to spawn and unspawn areas on demand.", | ||
"devDependencies": { | ||
"@types/chai": "^4.0.4", | ||
"@types/lolex": "^1.5.32", | ||
"@types/mocha": "^2.2.44", | ||
"@types/sinon": "^4.0.0", | ||
"@types/sinon-chai": "^2.7.29", | ||
"chai": "^4.1.2", | ||
"glob": "^7.1.2", | ||
"lolex": "^2.3.0", | ||
"mocha": "^4.0.1", | ||
"mocha-headless-chrome": "^1.7.1", | ||
"requirejs": "^2.3.5", | ||
"@types/chai": "^4.1.7", | ||
"@types/lodash": "^4.14.123", | ||
"@types/lolex": "^3.1.1", | ||
"@types/mocha": "^5.2.6", | ||
"@types/sinon": "^7.0.11", | ||
"@types/sinon-chai": "^3.2.2", | ||
"chai": "^4.2.0", | ||
"concurrently": "^4.1.0", | ||
"glob": "^7.1.3", | ||
"istanbul": "^0.4.5", | ||
"lolex": "^3.1.0", | ||
"mkdirp": "^0.5.1", | ||
"mocha": "^6.1.3", | ||
"mocha-headless-chrome": "^2.0.2", | ||
"npm-check-updates": "^3.1.7", | ||
"requirejs": "^2.3.6", | ||
"run-for-every-file": "^1.1.0", | ||
"shenanigans-manager": "^0.2.5", | ||
"sinon": "^4.1.2", | ||
"sinon-chai": "^2.14.0", | ||
"tslint": "5.8.0", | ||
"tsutils": "^2.14.0", | ||
"typedoc": "^0.9.0", | ||
"typescript": "^2.6.2", | ||
"webpack": "^3.10.0" | ||
"shenanigans-manager": "^0.2.36", | ||
"sinon": "^7.3.1", | ||
"sinon-chai": "^3.3.0", | ||
"tslint": "5.15.0", | ||
"tsutils": "^3.10.0", | ||
"typedoc": "^0.14.2", | ||
"typescript": "^3.4.3", | ||
"watch": "^1.0.2", | ||
"webpack": "^4.30.0", | ||
"webpack-cli": "^3.3.0" | ||
}, | ||
@@ -52,5 +57,7 @@ "license": "MIT", | ||
"init": "npm install && npm run setup && npm run verify", | ||
"setup": "npm run setup:copy && npm run setup:package && npm run setup:readme", | ||
"ncu": "ncu -u", | ||
"setup": "npm run setup:dirs && npm run setup:copy && npm run setup:package && npm run setup:readme", | ||
"setup:copy": "npm run setup:copy:default", | ||
"setup:copy:default": "run-for-every-file --dot --src \"node_modules/shenanigans-manager/setup/default/\" --file \"**/*\" --run \"mustache package.json {{src-file}} {{file}}\" --dest \".\" --only-files", | ||
"setup:dirs": "shenanigans-manager ensure-dirs-exist", | ||
"setup:package": "shenanigans-manager hydrate-package-json", | ||
@@ -60,12 +67,20 @@ "setup:readme": "shenanigans-manager hydrate-readme", | ||
"src:tsc": "tsc -p .", | ||
"src:tslint": "tslint -c tslint.json -e ./node_modules/**/*.ts* -p tsconfig.json -t stylish", | ||
"src:tslint": "tslint -c tslint.json -p tsconfig.json -t stylish", | ||
"src:tslint:fix": "tslint -c tslint.json --fix -p tsconfig.json -t stylish", | ||
"test": "npm run test:setup && npm run test:run", | ||
"test:coverage": "npm run test:coverage:generate-html && npm run test:coverage:instrument && npm run test:coverage:run && npm run test:coverage:report", | ||
"test:coverage:generate-html": "shenanigans-manager generate-test-html --source instrumented", | ||
"test:coverage:instrument": "istanbul instrument src -o instrumented", | ||
"test:coverage:report": "istanbul report html", | ||
"test:coverage:run": "mocha-headless-chrome --coverage coverage.json --file test/index.instrumented.html", | ||
"test:run": "mocha-headless-chrome --file test/index.html", | ||
"test:setup": "npm run test:setup:copy && npm run test:setup:html && npm run test:setup:tsc", | ||
"test:setup": "npm run test:setup:dir && npm run test:setup:copy && npm run test:setup:html && npm run test:setup:tsc", | ||
"test:setup:copy": "npm run test:setup:copy:default", | ||
"test:setup:copy:default": "run-for-every-file --dot --src \"node_modules/shenanigans-manager/setup/test/\" --file \"**/*\" --run \"mustache package.json {{src-file}} ./test/{{file}}\" --dest \".\" --only-files", | ||
"test:setup:dir": "mkdirp test", | ||
"test:setup:html": "shenanigans-manager generate-test-html", | ||
"test:setup:tsc": "tsc -p test", | ||
"verify": "npm run src && npm run test && npm run dist && npm run docs", | ||
"watch": "tsc -p . -w" | ||
"verify": "npm run src && npm run test && npm run dist", | ||
"verify:coverage": "npm run src && npm run test:setup && npm run test:coverage && npm run dist", | ||
"watch": "concurrently \"tsc -p . -w\" --raw \"chokidar src/**/*.test.t* --command \"\"npm run test:setup:html\"\" --silent\" --raw" | ||
}, | ||
@@ -76,3 +91,3 @@ "shenanigans": { | ||
"types": "./src/index.d.ts", | ||
"version": "0.7.2" | ||
"version": "0.7.3" | ||
} |
@@ -1,3 +0,4 @@ | ||
<!-- {{Top}} --> | ||
<!-- Top --> | ||
# AreaSpawnr | ||
[![Greenkeeper badge](https://badges.greenkeeper.io/FullScreenShenanigans/AreaSpawnr.svg)](https://greenkeeper.io/) | ||
[![Build Status](https://travis-ci.org/FullScreenShenanigans/AreaSpawnr.svg?branch=master)](https://travis-ci.org/FullScreenShenanigans/AreaSpawnr) | ||
@@ -7,10 +8,13 @@ [![NPM version](https://badge.fury.io/js/areaspawnr.svg)](http://badge.fury.io/js/areaspawnr) | ||
Loads GameStartr maps to spawn and unspawn areas on demand. | ||
<!-- {{/Top}} --> | ||
<!-- /Top --> | ||
<!-- {{Development}} --> | ||
<!-- Development --> | ||
## Development | ||
After [forking the repo from GitHub](https://help.github.com/articles/fork-a-repo/): | ||
``` | ||
git clone https://github.com/FullScreenShenanigans/AreaSpawnr | ||
git clone https://github.com/<your-name-here>/AreaSpawnr | ||
cd AreaSpawnr | ||
npm install | ||
npm run setup | ||
@@ -33,3 +37,3 @@ npm run verify | ||
### Running Tests | ||
#### Running Tests | ||
@@ -40,6 +44,9 @@ ```shell | ||
Test files are alongside source files under `src/` and named `*.test.ts?`. | ||
Whenever you add, remove, or rename a `*.test.ts?` file under `src/`, re-run `npm run test:setup` to regenerate the list of static test files in `test/index.html`. | ||
Tests are written in [Mocha](https://github.com/mochajs/mocha) and [Chai](https://github.com/chaijs/chai). | ||
Their files are written using alongside source files under `src/` and named `*.test.ts?`. | ||
Whenever you add, remove, or rename a `*.test.t*` file under `src/`, `watch` will re-run `npm run test:setup` to regenerate the list of static test files in `test/index.html`. | ||
You can open that file in a browser to debug through the tests. | ||
`npm run test` will run that setup and execute tests using [Puppeteer](https://github.com/GoogleChrome/puppeteer). | ||
<!-- {{/Development}} --> | ||
<!-- Maps --> | ||
<!-- /Maps --> | ||
<!-- /Development --> |
@@ -188,3 +188,3 @@ import { IArea, ILocation, IMap, IPreThingsContainers, IPreThingSettings } from "mapscreatr"; | ||
*/ | ||
private applySpawnAction(callback, status, direction, top, right, bottom, left); | ||
private applySpawnAction; | ||
} |
@@ -8,6 +8,6 @@ define(["require", "exports"], function (require, exports) { | ||
var directionKeys = { | ||
xDec: "right", | ||
xInc: "left", | ||
xDec: "right", | ||
yDec: "bottom", | ||
yInc: "top", | ||
yDec: "bottom", | ||
}; | ||
@@ -18,6 +18,6 @@ /** | ||
var directionOpposites = { | ||
xDec: "xInc", | ||
xInc: "xDec", | ||
xDec: "xInc", | ||
yDec: "yInc", | ||
yInc: "yDec", | ||
yDec: "yInc", | ||
}; | ||
@@ -234,6 +234,6 @@ /** | ||
this.areaCurrent.boundaries = { | ||
top: 0, | ||
right: 0, | ||
bottom: 0, | ||
left: 0, | ||
right: 0, | ||
top: 0, | ||
}; | ||
@@ -240,0 +240,0 @@ // Copy all the settings from that area into the MapScreenr container |
@@ -5,12 +5,17 @@ { | ||
"experimentalDecorators": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"jsx": "react", | ||
"lib": ["dom", "es2015.collection", "es2015.promise", "es5"], | ||
"lib": ["dom", "es2015"], | ||
"module": "amd", | ||
"moduleResolution": "node", | ||
"noFallthroughCasesInSwitch": true, | ||
"noImplicitAny": true, | ||
"noImplicitReturns": true, | ||
"noImplicitThis": true, | ||
"noFallthroughCasesInSwitch": true, | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"pretty": true, | ||
"strictNullChecks": true, | ||
"strict": true, | ||
"strictFunctionTypes": false, | ||
"strictPropertyInitialization": false, | ||
"target": "es5" | ||
@@ -17,0 +22,0 @@ }, |
{ | ||
"extends": "./node_modules/shenanigans-manager/setup/tslint.json", | ||
"linterOptions": { | ||
"exclude": [ | ||
"./node_modules/**/*" | ||
] | ||
}, | ||
"rules": { | ||
@@ -4,0 +9,0 @@ "completed-docs": false, |
@@ -10,8 +10,4 @@ const glob = require("glob"); | ||
{ | ||
entry: `./src/${package.shenanigans.name}.js`, | ||
entry: `./src/index.js`, | ||
name: package.shenanigans.name, | ||
sources: [ | ||
"./**/*.js", | ||
"!./**/*.test.js", | ||
] | ||
} | ||
@@ -45,6 +41,6 @@ ] | ||
// multiple entries? | ||
module.exports = { | ||
entry, // IDictionary<string> | ||
entry, | ||
externals, | ||
mode: "production", | ||
output: { | ||
@@ -54,3 +50,6 @@ filename: "[name].js", | ||
path: path.join(__dirname, "dist"), | ||
}, | ||
performance: { | ||
hints: false | ||
} | ||
}; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 2 instances in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
2
2
50
1
51560
27
20
844
- Removeditemsholdr@^0.7.0
- Removedobjectmakr@^0.7.0
Updatedmapscreatr@^0.7.5
Updatedmapscreenr@^0.7.2