Skip to content
Draft
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

root = true

[*]
end_of_line = lf
insert_final_newline = true

[*.{js,hjson}]
charset = utf-8
indent_style = space
indent_size = 4
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ marked with a ⬆, that is used for jumping.

*The following things can crash your game.*

- Toggling parkour mode in a flying unit

- Falling into the void / outside the map

<br>
Expand Down
30 changes: 21 additions & 9 deletions mod.hjson
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
name: "parkour-mod"
displayName: "[orange]Parkour[] mod"
author: "Benry/Deftry"
description: "This mod adds some new movement mechanics, gravity and jump to player. WIP, report all bugs to Benry#5935"
version: "2.5"
minGameVersion: "136"
dependencies: []
repo: "Def-Try/parkour-mod"
hidden: true
{
displayName : "[orange]Parkour[] mod"
author : Benry/Deftry
repo : Def-Try/parkour-mod
name : parkour-mod


description:
'''

This mod adds some new movement mechanics, gravity and jump to player.

WIP, report all bugs to Benry#5935

'''

minGameVersion : 136
version : 2.5

hidden : true
}
36 changes: 36 additions & 0 deletions scripts/Gravity.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@

module.exports = (() => {

const global = this;


if(global.Gravity)
return global.Gravity;


/*
* 0 : Right
* 1 : Up
* 2 : Left
* 3 : Down
*/

let direction = 3;


let strength = .5;


const Gravity = {};


Gravity.__defineGetter__('direction',() => direction);
Gravity.__defineGetter__('strength',() => strength);

Gravity.__defineSetter__('direction',(value) => direction = value);
Gravity.__defineSetter__('strength',(value) => strength = value);


return global.Gravity = Gravity;

})();
56 changes: 56 additions & 0 deletions scripts/Logger.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@


function logError(error){
Log.err(
'[ Parkour Mod ]\n\n' +
error.message +
'\n\n' +
error.stack +
'\n'
);
}


function info(values){
Log.info(values.join('\n'));
}



function valueToString(key,value,depth){

switch(typeof value){
default:
return 'Unknown Type : ' + typeof value;
case 'undefined':
case 'string':
case 'number':
return key + ' : ' + value;
case 'object':
return layer(value,depth - 1);
case 'array':
return value.join(' : ');
case 'function':
return key + '()';
}
}

function layer(object,depth,string){

string = string || '';

if(depth > 0)
for(let key in object.prototype)
string += '\n' + valueToString(key,object[key],depth);

return string;
}

function object(object,depth){
return layer(object,depth || 1);
}


exports.logError = logError;
exports.object = object;
exports.info = info;
23 changes: 23 additions & 0 deletions scripts/Tile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@



function tileAt(x,y){
return Vars.world.tile(x,y) || false;
}

function blockAt(x,y){

const block = tileAt(x,y);

return (block && block.type != Blocks.air)
? block : false ;
}

function tileIs(x,y,type){
return tileAt(x,y) == type;
}


exports.blockAt = blockAt;
exports.tileAt = tileAt;
exports.tileIs = tileIs;
Loading