Skip to content

Commit f00de52

Browse files
committed
randomNickGenerator
1 parent a8e0303 commit f00de52

File tree

8 files changed

+80
-42
lines changed

8 files changed

+80
-42
lines changed

build/coffee/bundle.coffee

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,22 @@ import {Players} from './module/Players.js'
1313
scene=null;materials=null;parameters=null;canvas=null;renderer=null;camera=null;terrain=null;cursor=null;FPC=null;socket=null;stats=null;worker=null;playerObject=null;inv_bar=null
1414

1515
getNick=->
16-
return document.location.search.substring(1,document.location.search.length)
16+
nameList = ['Time','Past','Future','Dev','Fly','Flying','Soar','Soaring','Power','Falling','Fall','Jump','Cliff','Mountain','Rend','Red','Blue','Green','Yellow','Gold','Demon','Demonic','Panda','Cat','Kitty','Kitten','Zero','Memory','Trooper','XX','Bandit','Fear','Light','Glow','Tread','Deep','Deeper','Deepest','Mine','Your','Worst','Enemy','Hostile','Force','Video','Game','Donkey','Mule','Colt','Cult','Cultist','Magnum','Gun','Assault','Recon','Trap','Trapper','Redeem','Code','Script','Writer','Near','Close','Open','Cube','Circle','Geo','Genome','Germ','Spaz','Shot','Echo','Beta','Alpha','Gamma','Omega','Seal','Squid','Money','Cash','Lord','King','Duke','Rest','Fire','Flame','Morrow','Break','Breaker','Numb','Ice','Cold','Rotten','Sick','Sickly','Janitor','Camel','Rooster','Sand','Desert','Dessert','Hurdle','Racer','Eraser','Erase','Big','Small','Short','Tall','Sith','Bounty','Hunter','Cracked','Broken','Sad','Happy','Joy','Joyful','Crimson','Destiny','Deceit','Lies','Lie','Honest','Destined','Bloxxer','Hawk','Eagle','Hawker','Walker','Zombie','Sarge','Capt','Captain','Punch','One','Two','Uno','Slice','Slash','Melt','Melted','Melting','Fell','Wolf','Hound','Legacy','Sharp','Dead','Mew','Chuckle','Bubba','Bubble','Sandwich','Smasher','Extreme','Multi','Universe','Ultimate','Death','Ready','Monkey','Elevator','Wrench','Grease','Head','Theme','Grand','Cool','Kid','Boy','Girl','Vortex','Paradox']
17+
18+
finalName = ""
19+
20+
randName=()->
21+
finalName = nameList[Math.floor( Math.random() * nameList.length )]
22+
finalName += nameList[Math.floor( Math.random() * nameList.length )]
23+
if Math.random() > 0.5
24+
finalName += nameList[Math.floor( Math.random() * nameList.length )]
25+
return finalName
26+
nick=document.location.hash.substring(1,document.location.hash.length)
27+
if nick is ""
28+
# nick="WebmcPlayer#{Math.floor(10000+Math.random()*10000)}"
29+
nick=randName()
30+
document.location.href="\##{nick}"
31+
return nick
1732
class TerrainWorker
1833
constructor: (options)->
1934
@worker=new Worker "workers/terrain.js", {type:'module'}
@@ -103,8 +118,10 @@ init = ()->
103118
socket.on "connect",()->
104119
console.log "Połączono z serverem!"
105120
$('.loadingText').text "Wczytywanie terenu..."
121+
nick=getNick()
122+
console.log "User nick: #{nick}"
106123
socket.emit "initClient", {
107-
nick:getNick()
124+
nick
108125
}
109126
return
110127
socket.on "blockUpdate",(block)->

client/assets/images/ribbon.png

7.61 KB
Loading

client/bundle.js

Lines changed: 22 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/cdn/css/main.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,7 @@ canvas {
6262
border:1px solid black;
6363
width:60px;
6464
height:60px;
65+
}
66+
.githubRibbon{
67+
position: absolute; top: 0; right: 0; border: 0;
6568
}

client/index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
<meta charset="utf-8">
99

1010
<!-- ICON -->
11-
<link rel="icon" href="/game/assets/images/grass_block.png">
11+
<link rel="icon" href="assets/images/grass_block.png">
1212

1313
<!-- CSS -->
1414
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.2/css/all.css">
1515
<link rel="stylesheet" href="/cdn/css/googleapis.css">
1616
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.0/css/bootstrap.min.css">
1717
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/mdbootstrap/4.19.0/css/mdb.min.css">
1818
<link rel="stylesheet" href="/cdn/css/main.css">
19-
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/github-fork-ribbon-css/0.2.3/gh-fork-ribbon.min.css" />
19+
2020

2121
<!-- JS -->
2222
<script type="text/javascript" src="/cdn/js/jq.js?1234"></script>
@@ -98,7 +98,7 @@ <h3>Gra zatrzymana</h3>
9898
</div>
9999

100100
<!-- GITHUB RIBBON -->
101-
<a href="https://github.com/michaljaz/web-minecraft"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub"></a>
101+
<a href="https://github.com/michaljaz/web-minecraft"><img class="githubRibbon" src="assets/images/ribbon.png" alt="Fork me on GitHub"></a>
102102

103103
<!-- GAME BUNDLE -->
104104
<script type="module" src="bundle.js"></script>

server/express.js

Lines changed: 0 additions & 20 deletions
This file was deleted.

server/savedWorld.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

server/start.js

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,38 @@ var server = http.createServer();
55
var io = require("socket.io")(server);
66

77
function exec(cmd) {
8-
const exec = require('child_process').exec;
9-
return new Promise((resolve, reject) => {
10-
exec(cmd, (error, stdout, stderr) => {
11-
if (error) {
12-
console.warn(error);
13-
}
14-
resolve(stdout? stdout : stderr);
15-
});
16-
});
8+
const exec = require('child_process').exec;
9+
return new Promise((resolve, reject) => {
10+
exec(cmd, (error, stdout, stderr) => {
11+
if (error) {
12+
console.warn(error);
13+
}
14+
resolve(stdout? stdout : stderr);
15+
});
16+
});
1717
}
1818

1919
var config = JSON.parse(fs.readFileSync(__dirname+'/config.json'))
2020

21-
require("./express.js")(config)
21+
//Express
22+
var port=config["express-port"]
23+
const express = require('express');
24+
const app = express();
25+
26+
app.use(express.static(__dirname + "/../client/"));
27+
app.use((req, res, next) => {
28+
res.set('Cache-Control', 'no-store')
29+
next()
30+
})
31+
app.get("/websocket/",function (req,res){
32+
res.send(String(config["websocket-port"]))
33+
})
34+
app.get("/host/",function (req,res){
35+
res.send(String(config["host"]))
36+
})
37+
app.listen(port, () => {
38+
// console.log(`Running: \x1b[35m\x1b[4mhttp://${config["host"]}:${port}\x1b[0m`);
39+
});
2240

2341
//WebSocket
2442
var world={};
@@ -138,6 +156,8 @@ info\t- wypisuje informacje o serwerze
138156
)
139157
}
140158
term.on( 'key' , function( name , matches , data ) {
141-
if ( name === 'CTRL_C' ) { stop() }
142-
} ) ;
159+
if (name==='CTRL_C') {
160+
stop()
161+
}
162+
});
143163

0 commit comments

Comments
 (0)