Created
March 20, 2018 20:28
-
-
Save IntelOrca/11011d0e4b3f6bf0e06d8349938571ed to your computer and use it in GitHub Desktop.
Script demonstrating random feature requests.
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
/// <reference path="/home/ted/Documents/openrct2/distribution/openrct2.d.ts" /> | |
// Script demonstrating random feature requests. | |
// Make vandalism #3526 | |
// random.destroyAllFootpathItems() | |
var destroyAllFootpathItems = function() { | |
for (var y = 0; y < map.size.y; y++) { | |
for (var x = 0; x < map.size.x; x++) { | |
var tile = map.getTile(x, y); | |
for (var i = 0; i < tile.numElements; i++) { | |
var element = tile.getElement(i); | |
if (element.type === 'footpath') { | |
element.broken = true; | |
} | |
} | |
} | |
} | |
} | |
// Feature request: change guest's clothes colours #5827 | |
var setGuestClothing = function(tshirtColour, trousersColour) { | |
for (var i = 0; i < map.things; i++) { | |
var thing = map.getThing(i); | |
if (thing && thing.type === 'peep') { | |
thing.tshirtColour = tshirtColour; | |
thing.trousersColour = trousersColour; | |
} | |
} | |
} | |
var main = function() { | |
// Make our functions global under namespace `random` | |
random = { | |
destroyAllFootpathItems: destroyAllFootpathItems, | |
setGuestClothing: setGuestClothing | |
}; | |
context.registerIntent({ | |
key: 'random.destoryallfootpathitems', | |
title: 'Destory all footpaths', | |
shortcut: 'CTRL+SHIFT+D', | |
action: destroyAllFootpathItems | |
}); | |
context.registerIntent({ | |
key: 'random.setguestclothing', | |
title: 'Set guest clothes', | |
action: function() { | |
setGuestClothing(14, 17); | |
} | |
}); | |
}; | |
return { | |
name: 'Random stuff', | |
version: '1.0', | |
authors: ['Ted John'], | |
type: 'default', | |
main: main | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment