Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
W
Wayfarers Rest Server
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Security & Compliance
Security & Compliance
Dependency List
Packages
Packages
List
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Zak Stephens
Wayfarers Rest Server
Commits
1e58fa28
Commit
1e58fa28
authored
Apr 19, 2019
by
Zak Stephens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix placement of Tiled objects.
parent
562c2b44
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
20 additions
and
13 deletions
+20
-13
config/local.json
config/local.json
+3
-3
index.js
index.js
+0
-2
load-map.js
load-map.js
+4
-4
maps/basement.json
maps/basement.json
+2
-2
maps/basement.tmx
maps/basement.tmx
+2
-2
routes/players.js
routes/players.js
+9
-0
No files found.
config/local.json
View file @
1e58fa28
{
"playerDefaults"
:
{
"location"
:
{
"x"
:
11
,
"y"
:
11
,
"x"
:
2
,
"y"
:
4
,
"map"
:
"./maps/basement.json"
}
},
"tickrate"
:
33
,
"playerInactivityDespawnTime"
:
30
,
"playerInactivityDespawnTime"
:
30
0
,
"tileSize"
:
32
,
...
...
index.js
View file @
1e58fa28
...
...
@@ -43,8 +43,6 @@ const util = require('util');
loadMap
(
'
./maps/basement.json
'
,
gameState
);
console
.
log
(
gameState
.
maps
[
'
./maps/basement.json
'
].
teleporters
);
const
app
=
express
();
app
.
use
(
cors
({
credentials
:
true
,
origin
:
true
}));
// Free love.
app
.
use
(
'
/api/v1/microtransactions
'
,
require
(
'
./routes/microtransactions
'
));
...
...
load-map.js
View file @
1e58fa28
...
...
@@ -67,7 +67,7 @@ function getObjectsOfType(tiledExport, type) {
.
map
(
tiledObject
=>
{
const
object
=
{
x
:
tiledObject
.
x
/
tileSize
,
y
:
tiledObject
.
y
/
tileSize
,
y
:
(
tiledObject
.
y
-
tileSize
)
/
tileSize
,
customProperties
:
{}
};
...
...
@@ -90,9 +90,9 @@ function getTeleporters(tiledExport) {
getObjectsOfType
(
tiledExport
,
'
Teleporter
'
)
.
forEach
(
object
=>
{
assert
(
object
.
customProperties
.
x
);
assert
(
object
.
customProperties
.
y
);
assert
(
object
.
customProperties
.
map
);
assert
(
object
.
customProperties
.
x
!=
null
);
assert
(
object
.
customProperties
.
y
!=
null
);
assert
(
object
.
customProperties
.
map
!=
null
);
teleporters
[
object
.
y
][
object
.
x
]
=
{
x
:
object
.
customProperties
.
x
,
...
...
maps/basement.json
View file @
1e58fa28
...
...
@@ -68,12 +68,12 @@
{
"name"
:
"x"
,
"type"
:
"int"
,
"value"
:
11
"value"
:
0
},
{
"name"
:
"y"
,
"type"
:
"int"
,
"value"
:
11
"value"
:
0
}],
"rotation"
:
0
,
"type"
:
"Teleporter"
,
...
...
maps/basement.tmx
View file @
1e58fa28
...
...
@@ -58,8 +58,8 @@
<object
id=
"38"
name=
"Basement"
type=
"Teleporter"
gid=
"353"
x=
"64"
y=
"128"
width=
"32"
height=
"32"
>
<properties>
<property
name=
"map"
value=
"./maps/basement.json"
/>
<property
name=
"x"
type=
"int"
value=
"
11
"
/>
<property
name=
"y"
type=
"int"
value=
"
11
"
/>
<property
name=
"x"
type=
"int"
value=
"
0
"
/>
<property
name=
"y"
type=
"int"
value=
"
0
"
/>
</properties>
</object>
</objectgroup>
...
...
routes/players.js
View file @
1e58fa28
...
...
@@ -60,6 +60,15 @@ module.exports = (gameState, playerRepository) => {
return
res
.
sendStatus
(
409
);
}
const
teleporter
=
gameState
.
maps
[
map
].
teleporters
[
y
][
x
];
if
(
teleporter
!=
null
)
{
player
.
location
.
map
=
teleporter
.
map
;
player
.
location
.
x
=
teleporter
.
x
;
player
.
location
.
y
=
teleporter
.
y
;
return
res
.
sendStatus
(
204
);
}
player
.
location
.
x
=
x
;
player
.
location
.
y
=
y
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment