A LOT OF STUFF

This commit is contained in:
MasterGordon 2018-04-29 11:52:12 +02:00
parent 39bca73f1f
commit 9d9a70a12b
46 changed files with 565 additions and 41 deletions

BIN
images/fliesen - Kopie.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

BIN
images/items/bauxite.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

BIN
images/items/chromeore.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

BIN
images/items/cobaltore.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

BIN
images/items/copperore.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

10
images/items/index.php Normal file
View File

@ -0,0 +1,10 @@
<?php
$dir = new DirectoryIterator(dirname("images"));
foreach ($dir as $fileinfo) {
if (!$fileinfo->isDot()) {
$file = $fileinfo->getFilename();
echo '<img src='.$file.'>';
//echo '<img src="' . $file . '.png"</img>');
}
}
?>

BIN
images/items/ironore.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

BIN
images/items/leadore.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

BIN
images/items/lithiumore.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

BIN
images/items/nickelore.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

BIN
images/items/rawiron.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

BIN
images/items/silverore.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

BIN
images/items/slag.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
images/items/steel.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

BIN
images/items/tinore.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
images/items/uraniumore.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

BIN
images/items/zincore.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 427 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 438 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 470 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 507 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 528 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 587 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 626 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 658 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 427 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 652 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 700 B

10
images/tiles/index.php Normal file
View File

@ -0,0 +1,10 @@
<?php
$dir = new DirectoryIterator(dirname("images"));
foreach ($dir as $fileinfo) {
if (!$fileinfo->isDot()) {
$file = $fileinfo->getFilename();
echo '<img src='.$file.'>';
//echo '<img src="' . $file . '.png"</img>');
}
}
?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@ -141,6 +141,44 @@ class Inventory {
} }
} }
class FactoryInventory {
constructor() {
this.itemcount = []
this.items = []
}
countOf(id) {
var n = 0
for (var i = 0; i < this.items.length; i++) {
if (this.items[i].id == id)
n++
}
return n
}
addItem(item) {
if (item instanceof Item)
this.items.push(item)
}
take(id, count, factory) {
if (this.countOf(id) >= count) {
for (var j = 0; j < count; j++) {
for (var i = 0; i < this.items.length; i++) {
if (this.items[i].id == id) {
if (factory != null)
factory.deleteItem(this.items[i])
this.items.splice(i, 1)
break;
}
}
}
return true
}
return false
}
}
class Item { class Item {
constructor(id, x, y) { constructor(id, x, y) {
this.id = id this.id = id

View File

@ -141,7 +141,7 @@ function loadGameData() {
inventory.addItem(new Item(game.inventory[i])) inventory.addItem(new Item(game.inventory[i]))
} }
for (var i = 0; i < game.factorys.length; i++) { for (var i = 0; i < game.factorys.length; i++) {
factorys.push(new Factory) factorys.push(new Factory(game.factorys[i].tier))
for (var x = 0; x < 25; x++) { for (var x = 0; x < 25; x++) {
for (var y = 0; y < 12; y++) { for (var y = 0; y < 12; y++) {
if (game.factorys[i].tiles[x][y] != 0) { if (game.factorys[i].tiles[x][y] != 0) {
@ -168,6 +168,7 @@ function loadItems() {
itemRequest.send(null) itemRequest.send(null)
var json = JSON.parse(itemRequest.responseText) var json = JSON.parse(itemRequest.responseText)
items = json.items items = json.items
minerals = json.minerals
for (var i = 0; i < items.length; i++) { for (var i = 0; i < items.length; i++) {
var image = new Image var image = new Image
image.src = "images/items/" + items[i].name + ".png" image.src = "images/items/" + items[i].name + ".png"
@ -240,6 +241,9 @@ function gametick(timestep) {
} }
} }
var rotationOverlay = new Image
rotationOverlay.src = "images/ui/rotationOverlay.png"
function render() { function render() {
fulltime++ fulltime++
ctx.clearRect(0, 0, innerWidth, innerHeight) ctx.clearRect(0, 0, innerWidth, innerHeight)
@ -269,10 +273,8 @@ function render() {
drawRotatedImage(img, tile.x * 48 + 24, tile.y * 48 + 24, directions[tile.direction].degree) drawRotatedImage(img, tile.x * 48 + 24, tile.y * 48 + 24, directions[tile.direction].degree)
} }
if (mode == "rotate") { if (mode == "rotate") {
var img2 = new Image
img2.src = "images/ui/rotationOverlay.png"
ctx.globalAlpha = 0.4 ctx.globalAlpha = 0.4
drawRotatedImage(img2, tile.x * 48 + 24, tile.y * 48 + 24, directions[tile.direction].degree) drawRotatedImage(rotationOverlay, tile.x * 48 + 24, tile.y * 48 + 24, directions[tile.direction].degree)
ctx.globalAlpha = 1 ctx.globalAlpha = 1
} }
} }
@ -290,10 +292,8 @@ function render() {
if (img != "0") { if (img != "0") {
drawRotatedImage(img, cursorScreenX * 48 + 24, cursorScreenY * 48 + 24, directions[tile.direction].degree) drawRotatedImage(img, cursorScreenX * 48 + 24, cursorScreenY * 48 + 24, directions[tile.direction].degree)
} }
var img2 = new Image
img2.src = "images/ui/rotationOverlay.png"
ctx.globalAlpha = 0.2 ctx.globalAlpha = 0.2
drawRotatedImage(img2, cursorScreenX * 48 + 24, cursorScreenY * 48 + 24, directions[tile.direction].degree) drawRotatedImage(rotationOverlay, cursorScreenX * 48 + 24, cursorScreenY * 48 + 24, directions[tile.direction].degree)
ctx.globalAlpha = 1 ctx.globalAlpha = 1
} else { } else {
ctx.globalAlpha = 0.4 ctx.globalAlpha = 0.4
@ -444,9 +444,19 @@ function prepairRender() {
}) })
//End Sell/Select Items Menu //End Sell/Select Items Menu
$('#clickToSell').text(lang.clickToSell) $('#clickToSell').text(lang.clickToSell)
for (var i = 0; i < infoBarIcons.length; i++) {
if (infoBarIcons[i] != null) {
var img = new Image
img.src = "images/ui/" + infoBarIcons[i]
infoBarIconsImg.push(img)
} else {
infoBarIconsImg.push(null)
}
}
} }
var infoBarIcons = ["build.png", "move.png", "rotate.png", "delete.png", null, "upgrade.png", "info.png", null, "factorys.png"] var infoBarIcons = ["build.png", "move.png", "rotate.png", "delete.png", null, "upgrade.png", "info.png", null, "factorys.png"]
var infoBarIconsImg = []
var infoGlowOpacity = 0 var infoGlowOpacity = 0
var infoGlowOpacityD = 0.03 var infoGlowOpacityD = 0.03
@ -482,11 +492,9 @@ function drawInfoBar() {
infoGlowOpacity += infoGlowOpacityD infoGlowOpacity += infoGlowOpacityD
infoCtx.globalAlpha = 1 infoCtx.globalAlpha = 1
} }
for (var i = 0; i < infoBarIcons.length; i++) { for (var i = 0; i < infoBarIconsImg.length; i++) {
if (infoBarIcons[i] != null) { if (infoBarIconsImg[i] != null) {
var img = new Image; infoCtx.drawImage(infoBarIconsImg[i], i * 48, 0, 48, 48);
img.src = "images/ui/" + infoBarIcons[i];
infoCtx.drawImage(img, i * 48, 0, 48, 48);
} }
} }
if (toBuild != 0) { if (toBuild != 0) {

View File

@ -3,53 +3,293 @@
"id": 0, "id": 0,
"name": "none", "name": "none",
"value": 0 "value": 0
},{ }, {
"id": 1, "id": 1,
"name": "log", "name": "log",
"value": 4 "value": 4
},{ }, {
"id": 2, "id": 2,
"name": "planks", "name": "planks",
"value": 6 "value": 6
},{ }, {
"id": 3, "id": 3,
"name": "stone", "name": "stone",
"value": 2 "value": 2
},{ }, {
"id": 4, "id": 4,
"name": "charcoal", "name": "charcoal",
"value": 15 "value": 15
},{ }, {
"id": 5, "id": 5,
"name": "sawdust", "name": "sawdust",
"value": 1 "value": 1
},{ }, {
"id": 6, "id": 6,
"name": "charcoaldust", "name": "charcoaldust",
"value": 3 "value": 3
},{ }, {
"id": 7, "id": 7,
"name": "rawpaper", "name": "rawpaper",
"value": 100 "value": 100
},{ }, {
"id": 8, "id": 8,
"name": "paper", "name": "paper",
"value": 200 "value": 200
},{ }, {
"id": 9, "id": 9,
"name": "siev", "name": "siev",
"value": 33 "value": 33
},{ }, {
"id": 10, "id": 10,
"name": "paperfilter", "name": "paperfilter",
"value": 100 "value": 100
},{ }, {
"id": 11, "id": 11,
"name": "koks", "name": "koks",
"value": 20 "value": 20
},{ }, {
"id": 12, "id": 12,
"name": "briquettes", "name": "briquettes",
"value": 16 "value": 16
}] }, {
"id": 13,
"name": "bauxite",
"value": 10
}, {
"id": 14,
"name": "leadore",
"value": 10
}, {
"id": 15,
"name": "chromeore",
"value": 10
}, {
"id": 16,
"name": "ironore",
"value": 10
}, {
"id": 17,
"name": "cobaltore",
"value": 10
}, {
"id": 18,
"name": "copperore",
"value": 10
}, {
"id": 19,
"name": "lithiumore",
"value": 10
}, {
"id": 20,
"name": "magnesiumore",
"value": 10
}, {
"id": 21,
"name": "manganeseore",
"value": 10
}, {
"id": 22,
"name": "molybdenumore",
"value": 10
}, {
"id": 23,
"name": "nickelore",
"value": 10
}, {
"id": 24,
"name": "silverore",
"value": 10
}, {
"id": 25,
"name": "tantalumore",
"value": 10
}, {
"id": 26,
"name": "titaniumore",
"value": 10
}, {
"id": 27,
"name": "uraniumore",
"value": 10
}, {
"id": 28,
"name": "vanadiumore",
"value": 10
}, {
"id": 29,
"name": "tungstenore",
"value": 10
}, {
"id": 30,
"name": "zincore",
"value": 10
}, {
"id": 31,
"name": "tinore",
"value": 10
}, {
"id": 32,
"name": "steel",
"value": 300
}, {
"id": 33,
"name": "rawiron",
"value": 30
}, {
"id": 34,
"name": "slag",
"value": 5
}],
"minerals": {
"nameFromId": ["bauxite",
"beryllium",
"lead",
"chrome",
"diamonds",
"iron",
"naturalgas",
"oil",
"gold",
"kaolin",
"cobalt",
"coal",
"copper",
"lithium",
"magnesium",
"manganese",
"molybdenum",
"nickel",
"phosphate",
"platinum",
"potash",
"rubies",
"silver",
"soda",
"tantalum",
"titanium",
"uranium",
"vanadium",
"tungsten",
"zinc",
"tin",
"salt"],
"bauxite": {
"depth": 1,
"oreid": 13
},
"beryllium": {
"depth": 3
},
"lead": {
"depth": 4,
"oreid": 14
},
"chrome": {
"depth": 2,
"oreid": 15
},
"diamonds": {
"depth": 8
},
"iron": {
"depth": 1,
"oreid": 16
},
"naturalgas": {
"depth": 6,
"liquid": true
},
"oil": {
"depth": 6,
"liquid": true
},
"gold": {
"depth": 3
},
"kaolin": {
"depth": 1
},
"cobalt": {
"depth": 4,
"oreid": 17
},
"coal": {
"depth": 2
},
"copper": {
"depth": 2,
"oreid": 18
},
"lithium": {
"depth": 1,
"oreid": 19
},
"magnesium": {
"depth": 3,
"oreid": 20
},
"manganese": {
"depth": 2,
"oreid": 21
},
"molybdenum": {
"depth": 2,
"oreid": 22
},
"nickel": {
"depth": 1,
"oreid": 23
},
"phosphate": {
"depth": 1,
"oreid": 13
},
"platinum": {
"depth": 6
},
"potash": {
"depth": 1
},
"rubies": {
"depth": 9
},
"silver": {
"depth": 4,
"oreid": 24
},
"soda": {
"depth": 1
},
"tantalum": {
"depth": 4,
"oreid": 25
},
"titanium": {
"depth": 7,
"oreid": 26
},
"uranium": {
"depth": 4,
"oreid": 27
},
"vanadium": {
"depth": 3,
"oreid": 28
},
"tungsten": {
"depth": 3,
"oreid": 29
},
"zinc": {
"depth": 1,
"oreid": 30
},
"tin": {
"depth": 1,
"oreid": 30
},
"salt": {
"depth": 1
}
}
} }

32
js/minerals.json Normal file
View File

@ -0,0 +1,32 @@
"bauxite"
"beryllium"
"lead"
"chrome"
"diamonds"
"iron"
"naturalgas"
"oil"
"gold"
"kaolin"
"cobalt"
"coal"
"copper"
"lithium"
"magnesium"
"manganese"
"molybdenum"
"nickel"
"phosphate"
"platinum"
"potash"
"rubies"
"silver"
"soda"
"tantalum"
"titanium"
"uranium"
"vanadium"
"tungsten"
"zinc"
"tin"
"salt"

View File

@ -435,6 +435,126 @@ class Cokery extends Tile {
} }
} }
class BlastfurnaceLower extends Tile {
constructor(x, y, factory) {
super(x, y, factory)
this.maxwork = 96 * 10
this.currentwork = 0
this.name = "blastfurnacelower"
this.i = 16
this.dust = 0
this.cost = [{
"id": 0,
"count": 60000
},
{
"id": 3,
"count": 1400
},
{
"id": 6,
"count": 20
}
]
this.texture = {
"0": [],
"1": ["blastfurnacelower10"]
}
this.loadImages()
}
getImage(fulltime, layer) {
fulltime = Math.round(fulltime / 6)
if (this.images[layer].length == 0)
return "0"
return this.images[layer][(fulltime % this.images[layer].length)]
}
isUpperPartAttached() {
switch (this.direction) {
case "up":
if (this.factory.tiles[this.x - 1][this.y] != undefined && this.factory.tiles[this.x - 1][this.y] != 0)
if (this.factory.tiles[this.x - 1][this.y].i == 17)
return true;
break;
case "right":
if (this.factory.tiles[this.x][this.y - 1] != undefined && this.factory.tiles[this.x][this.y - 1] != 0)
if (this.factory.tiles[this.x][this.y - 1].i == 17)
return true;
break;
case "down":
if (this.factory.tiles[this.x + 1][this.y] != undefined && this.factory.tiles[this.x + 1][this.y] != 0)
if (this.factory.tiles[this.x + 1][this.y].i = 17)
return true;
break;
case "left":
if (this.factory.tiles[this.x][this.y + 1] != undefined && this.factory.tiles[this.x][this.y + 1] != 0)
if (this.factory.tiles[this.x][this.y + 1].i == 17)
return true;
break;
default:
}
}
work() {
if (this.isUpperPartAttached()) {
if (this.input.countOf(16) >= 40 && this.input.countOf(11) >= 10) {
if (this.currentwork == this.maxwork) {
this.currentwork = 0
this.input.take(16, 40, this.factory)
this.input.take(11, 10, this.factory)
for (var i = 0; i < 15; i++) {
var item = new Item(11, this.x * 48, this.y * 48)
this.factory.items.push(item)
item.setDFromDirection(this.direction)
}
} else
this.currentwork++
}
}
}
}
class BlastfurnaceUpper extends Tile {
constructor(x, y, factory) {
super(x, y, factory)
this.maxwork = 96 * 10
this.currentwork = 0
this.name = "blastfurnaceupper"
this.i = 17
this.dust = 0
this.cost = [{
"id": 0,
"count": 60000
},
{
"id": 3,
"count": 1400
},
{
"id": 6,
"count": 20
}
]
this.texture = {
"0": [],
"1": ["blastfurnaceupper10", "blastfurnaceupper11", "blastfurnaceupper12", "blastfurnaceupper13", "blastfurnaceupper14", "blastfurnaceupper15", "blastfurnaceupper16"]
}
this.loadImages()
}
getImage(fulltime, layer) {
fulltime = Math.round(fulltime / 6)
if (this.images[layer].length == 0)
return "0"
return this.images[layer][(fulltime % this.images[layer].length)]
}
work() {}
}
class Quarry extends Tile { class Quarry extends Tile {
constructor(x, y, factory) { constructor(x, y, factory) {
super(x, y, factory) super(x, y, factory)
@ -467,6 +587,57 @@ class Quarry extends Tile {
} }
} }
class MineralWasher extends Tile {
constructor(x, y, factory) {
super(x, y, factory)
this.maxwork = 48 * 45
this.i = 15
this.currentwork = 0
this.name = "mineralwasher"
this.hasNoInventory = true
this.lastore = 0
this.cost = [{
"id": 0,
"count": 50000
}, {
"id": 9,
"count": 500
}]
this.texture = {
"0": [],
"1": ["mineralwasher10", "mineralwasher11", "mineralwasher12", "mineralwasher11"]
}
this.loadImages()
}
work() {
this.currentwork = ((this.currentwork + 1) % this.maxwork)
if (this.currentwork == 0) {
var goodores = [];
for (var i = 0; i < 4; i++) {
if (minerals[minerals.nameFromId[this.factory.ores[i]]].depth <= 1) {
if (minerals[minerals.nameFromId[this.factory.ores[i]]].oreid != undefined) {
goodores.push(minerals[minerals.nameFromId[this.factory.ores[i]]].oreid)
}
}
}
if (goodores.length >= 1) {
this.lastore = ((this.lastore + 1) % goodores.length)
var item = new Item(goodores[this.lastore], this.x * 48, this.y * 48)
this.factory.items.push(item)
item.setDFromDirection(this.direction)
}
}
}
getImage(fulltime, layer) {
fulltime = Math.round(fulltime / 6)
if (this.images[layer].length == 0)
return "0"
return this.images[layer][(fulltime % this.images[layer].length)]
}
}
class Collector extends Tile { class Collector extends Tile {
constructor(x, y, factory) { constructor(x, y, factory) {
super(x, y, factory) super(x, y, factory)
@ -699,18 +870,21 @@ class Warehouse extends Tile {
} }
} }
} }
tileClasses.push(Conveyorbelt) tileClasses.push(Conveyorbelt) //0
tileClasses.push(Treefarm) tileClasses.push(Treefarm) //1
tileClasses.push(Saw) tileClasses.push(Saw) //2
tileClasses.push(Charcoalmeiler) tileClasses.push(Charcoalmeiler) //3
tileClasses.push(Quarry) tileClasses.push(Quarry) //4
tileClasses.push(Collector) tileClasses.push(Collector) //5
tileClasses.push(Spliter) tileClasses.push(Spliter) //6
tileClasses.push(Warehouse) tileClasses.push(Warehouse) //7
tileClasses.push(FilterLeft) tileClasses.push(FilterLeft) //8
tileClasses.push(FilterRight) tileClasses.push(FilterRight) //9
tileClasses.push(Weaver) tileClasses.push(Weaver) //10
tileClasses.push(Papermanufactory) tileClasses.push(Papermanufactory) //11
tileClasses.push(AdvancedCharcoalmeiler) tileClasses.push(AdvancedCharcoalmeiler) //12
tileClasses.push(Briquettepress) tileClasses.push(Briquettepress) //13
tileClasses.push(Cokery) tileClasses.push(Cokery) //14
tileClasses.push(MineralWasher) //15
tileClasses.push(BlastfurnaceLower) //16
tileClasses.push(BlastfurnaceUpper) //17

View File

@ -60,6 +60,18 @@
"name": "Weaver", "name": "Weaver",
"description": "Makes a Siev out of 5 Planks. Puts together Sievs and Paper/Rawpaper to make filter" "description": "Makes a Siev out of 5 Planks. Puts together Sievs and Paper/Rawpaper to make filter"
}, },
"mineralwasher": {
"name": "Mineral Washer",
"description": "Gets some Minerals"
},
"blastfurnacelower": {
"name": "Mineral Washer",
"description": "Gets some Minerals"
},
"blastfurnaceupper": {
"name": "Mineral Washer",
"description": "Gets some Minerals"
},
"filterleft": { "filterleft": {
"name": "Item Filter (left)", "name": "Item Filter (left)",
"description": "Puts a selected Item to the left and all other straight.", "description": "Puts a selected Item to the left and all other straight.",
@ -108,7 +120,7 @@
"tin", "tin",
"salt" "salt"
], ],
"items": ["None", "Log", "Planks", "Stone", "Charcoal", "Sawdust", "Charcoal Dust", "Raw Paper", "Paper", "Siev", "Filter", "Coke", "Briquettes"], "items": ["None", "Log", "Planks", "Stone", "Charcoal", "Sawdust", "Charcoal Dust", "Raw Paper", "Paper", "Siev", "Filter", "Coke", "Briquettes","Bauxite","Lead Ore","Chrome Ore","Iron Ore","Cobalt Ore","Copper Ore","Lithium Ore","Magnesium Ore","Manganese Ore","Molybdenum Ore","Nickel Ore","Silver Ore","Tantalum Ore","Titanium Ore","Uranium Ore","Vanadium Ore","Tungesten Ore","Zinc Ore","Tin Ore","Steel","Raw Iron","Slag"],
"more": "Show Inventory / Sell Items", "more": "Show Inventory / Sell Items",
"inventory": "Inventory", "inventory": "Inventory",
"player": "Player", "player": "Player",