forked from screepers/simpleAllies
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
2,286 additions
and
16,163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1 @@ | ||
# Folders | ||
/node_modules | ||
/docs | ||
/dist | ||
/coverage | ||
/server | ||
|
||
# File types | ||
**/*.json | ||
**/*.md | ||
**/*.yml | ||
dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,15 @@ | ||
{ | ||
"env": { | ||
"browser": false, | ||
"es2021": true, | ||
"screeps/screeps": true, | ||
"jest": true | ||
}, | ||
"extends": [ | ||
"airbnb-base", | ||
"plugin:import/typescript", | ||
"plugin:prettier/recommended", | ||
// "plugin:jsdoc/recommended", | ||
"plugin:jest/recommended", | ||
"plugin:@typescript-eslint/recommended" | ||
], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": 12, | ||
"sourceType": "module" | ||
}, | ||
"plugins": [ | ||
"@typescript-eslint", | ||
"screeps", | ||
"import", | ||
"prettier", | ||
"jsdoc", | ||
"jest" | ||
"plugins": ["@typescript-eslint", "prettier"], | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"prettier" | ||
], | ||
"rules": { | ||
"@typescript-eslint/no-empty-interface": 0, | ||
"no-shadow": "off", | ||
"@typescript-eslint/no-shadow": ["error"], | ||
"default-case": ["error", { "commentPattern": "^skip\\sdefault" }], | ||
"no-param-reassign": 0, | ||
"no-underscore-dangle": 0, | ||
"no-unused-vars": 0, | ||
"no-console": 0, | ||
"prefer-spread": 0, | ||
"import/no-cycle": 0, | ||
"import/extensions": [ | ||
"error", | ||
"ignorePackages", | ||
{ | ||
"js": "never", | ||
"mjs": "never", | ||
"jsx": "never", | ||
"ts": "never", | ||
"tsx": "never" | ||
} | ||
], | ||
"prettier/prettier": "error", | ||
"arrow-body-style": "off", | ||
"prefer-arrow-callback": "off" | ||
}, | ||
"settings": { | ||
"prettier/prettier": "warn", | ||
"@typescript-eslint/no-unused-vars": "warn", | ||
"@typescript-eslint/no-namespace": "off", | ||
"@typescript-eslint/no-explicit-any": "warn" | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
node_modules | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,8 @@ | ||
{ | ||
"editor.formatOnSave": true, | ||
"semi": false, | ||
"tabWidth": 4, | ||
"semi": true, | ||
"printWidth": 100, | ||
"singleQuote": true, | ||
"trailingComma": "all", | ||
"arrowParens": "avoid", | ||
"trailingComma": "es5", | ||
"endOfLine": "auto" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,20 @@ | ||
# Simple Allies | ||
Allows for simple communication between allies using a public segment | ||
|
||
## Usage | ||
Simple Allies is a tool for Screeps that simplifies ally communication. It provides a data model for segment communication, facilitating requests for resources, defense, attacks, hostility, work, funneling, and scouting. This is designed to enhance alliance cooperation and strategic gameplay. | ||
|
||
Plug this into your screeps bot and begin communicating with allies! | ||
### Usage | ||
|
||
- priority values should be from 0-1, where 1 is most preferred and 0 is least preferred | ||
- avoid sending verbose data! The more data you send, the more expensive it is for your allies to parse and read it. | ||
To integrate Simple Allies into your Screeps bot, import the necessary components from the project and incorporate them into your code. | ||
|
||
### Code | ||
|
||
For more details, refer to the source code: | ||
|
||
- TypeScript source code: [src/](./src/) | ||
- Built JavaScript code: [dist/](./dist/) | ||
|
||
Please note that the JavaScript code is generated from the TypeScript source code and should be functionally identical. | ||
|
||
### Contributing | ||
|
||
Contributions are welcome! Feel free to submit a pull request. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
'use strict'; | ||
|
||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
|
||
var simpleAllies = require('./simpleAllies.js'); | ||
|
||
/** | ||
* Example bot loop | ||
*/ | ||
function loop() { | ||
// Read next an ally segment | ||
simpleAllies.simpleAllies.initRun(); | ||
// Respond to ally requests | ||
respondToAllyDefenseRequests(); | ||
respondToAllyResourceRequests(); | ||
// Request support from allies | ||
requestAllyResources(); | ||
requestAllyDefense(); | ||
// Update ally segment | ||
simpleAllies.simpleAllies.endRun(); | ||
} | ||
/** | ||
* Example of responding to ally defense requests | ||
*/ | ||
function respondToAllyDefenseRequests() { | ||
if (!simpleAllies.simpleAllies.allySegmentData) | ||
return; | ||
// Send creeps to defend rooms | ||
for (const request of simpleAllies.simpleAllies.allySegmentData.requests.defense) { | ||
console.log('[simpleAllies] Respond to defense request', JSON.stringify(request)); | ||
// ... | ||
} | ||
} | ||
/** | ||
* Example of responding to ally resource requests | ||
*/ | ||
function respondToAllyResourceRequests() { | ||
if (!simpleAllies.simpleAllies.allySegmentData) | ||
return; | ||
// Send resources to rooms | ||
for (const request of simpleAllies.simpleAllies.allySegmentData.requests.resource) { | ||
console.log('[simpleAllies] Respond to resource request', JSON.stringify(request)); | ||
// ... | ||
} | ||
} | ||
/** | ||
* Example of requesting ally resources | ||
*/ | ||
function requestAllyResources() { | ||
// Add resource request | ||
simpleAllies.simpleAllies.requestResource({ | ||
priority: 1, | ||
roomName: 'W1N1', | ||
resourceType: RESOURCE_ENERGY, | ||
amount: 1000, | ||
}); | ||
} | ||
/** | ||
* Example of requesting ally defense | ||
*/ | ||
function requestAllyDefense() { | ||
// Add defense request | ||
simpleAllies.simpleAllies.requestDefense({ | ||
priority: 1, | ||
roomName: 'W1N1', | ||
}); | ||
} | ||
|
||
exports.loop = loop; |
Oops, something went wrong.