From d9783854aa1015b247e486db192365dcca7b55b7 Mon Sep 17 00:00:00 2001 From: MasterGordon Date: Tue, 1 May 2018 22:16:37 +0200 Subject: [PATCH] Added Smith + Tele --- css/main.css | 2 +- images/items/pickaxe.png | Bin 0 -> 492 bytes images/tiles/smith10.png | Bin 0 -> 390 bytes images/tiles/smith11.png | Bin 0 -> 510 bytes images/tiles/smith12.png | Bin 0 -> 439 bytes js/game.js | 7 +- js/items.json | 4 + js/tiles.js | 196 ++++++++++++++++++++++++++++++++++++++- js/userinterface.js | 8 +- lang/en.json | 32 ++++++- 10 files changed, 234 insertions(+), 15 deletions(-) create mode 100644 images/items/pickaxe.png create mode 100644 images/tiles/smith10.png create mode 100644 images/tiles/smith11.png create mode 100644 images/tiles/smith12.png diff --git a/css/main.css b/css/main.css index 71297e2..08a5878 100644 --- a/css/main.css +++ b/css/main.css @@ -100,7 +100,7 @@ body { text-align: center; color: black; float: left; - font-size: 20px; + font-size: 18px; line-height: 43px; width: 100%; } diff --git a/images/items/pickaxe.png b/images/items/pickaxe.png new file mode 100644 index 0000000000000000000000000000000000000000..f39cb485c5314af0b3b99e2b769535c6e45790a2 GIT binary patch literal 492 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA1|-9oezpTC#^NA%Cx&(BWL^R}Ea{HEjtmSN z`?>!lvI6;>1s;*b3=DjSL74G){)!Z!pk#?_L`iUdT1k0gQ7S`0VrE{6US4X6f{C7i zo{`~4h0LiyQ)4_`978gk-(GR_V>aYzeRyx8?DH2=X9I66&Z|1uAU>_<=knxoISs0=Wr?&e0z&7Hlpi=^YUTZCrmcjPRMscEPb&_{RZTnjTZw14b4Tp0x>_sN zMXzM*Sf)CQrgQID{JZ9N!Z)+Bm0UZD7)47PZ6&lS81*M!4>bt+@c)li0fTdE=mHLB zR{aN`c5$_Ft#%M>~FS^+H!opciFpO=dAh%VEAFg>1?FJXlM_l!O3 znid|~uOSfs1k3`dYl^P{>-oa^===Zk+;{Tjmp^6Nvb_6Um!j;uC{~8MqRv)#o{E20 zf{D%A)o}i!(7&4(XLi{fPw;5B{xrwJ`dMsc-@yrdmdKI;Vst0FbWC=>Px# literal 0 HcmV?d00001 diff --git a/images/tiles/smith10.png b/images/tiles/smith10.png new file mode 100644 index 0000000000000000000000000000000000000000..d7f91c073895593e0ce22e6b3fe2caf476441273 GIT binary patch literal 390 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA1|-9oezpTC#^NA%Cx&(BWL^R}Ea{HEjtmSN z`?>!lvI6;>1s;*b3=DjSL74G){)!Z!pk#?_L`iUdT1k0gQ7S`0VrE{6US4X6f{C7i zo{`~4h0LiyMc+JK978gk-=23AYE}?n4SfHachB_a%14_-CWx`Ii=NTBr=)q{es^(R zmVN!3-|yU}z4xuV&?YTHn9&T+!eQS8DH;Ob#b?tf@^aWoZ8Mh<%-+1 z2nT+#1V%47p1_`S`&#UuI)8}=7duuzl~&Fx$3+DdU3Vmu=U6GiP+Trze*jU%XjrInxW7 zi+84G@hvb`z4hDlJ-@`=YNoUvj@|niPx#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D02y>eSaefwW^{L9 za%BK;VQFr3E^cLXAT%y8E;2FkAZe8V00C}EL_t(&L*>s)mV_V>MA6!>J8)mFk3Kob zK1e@H@`Iv1xPvMKi1?IJ9_`N`+qRXNwS9L#=)jEX&X<;7mIeR!*bSgSHYu;@yT@e% z>hhT*E*U`O73D3451`VD@>W9!P-#VZk6{C-w4%J%kO5R$Q9dGl0F_phk4hatr4{8f zqz$0bit<@f22kl1oy!m&KxL26`KZtUDyfdXw|7Lj2T(b6maD%% zQIuEKd@u6=;Vt7m_l;|S@Rq30dCs@o1BCbSc7XRD5gHJYHR84bB4fm@14N{}xP5@| zmKQi+UDtH={h4rppc13C9eNxNQ1s9!^!}OC0g4{XLhtqJ9-ydz7u|1V9-yeu5jvm6 zG=R$Wpu4jCp8-_Ng6_=FHGm3v(A`n*A3#L}WovXsP&UFffN~^qwwHMTWxk1?KlA

!lvI6;>1s;*b3=DjSL74G){)!Z!pk#?_L`iUdT1k0gQ7S`0VrE{6US4X6f{C7i zo{`~4h0LiyQ`J3P978gk-(EU6@vs7q!^M(qtUH;%KUFGAt4?xfPu=jD)9Dza4Bz_) zJqLb0wsGQcuKt;Ld)tN0kN53nx4N*n;`zgA;ky~6Bo6Xq`eJprCKb6bl?{`t%$3VduOhs9` zk00_)SidM0h zhzXiVFE(yUJ72(hLB_K9+A52Nw0oA-cF+GY?%nNwphIxicVmYO3H^`emNPc-eR;Cu f{kue)hadT;-uU9#XZ=0^7_JPSu6{1-oD!M= 1 && this.input.countOf(33) >= 1) { + if (this.currentwork == this.maxwork) { + this.input.take(2, 1, this.factory) + this.input.take(33, 1, this.factory) + var item = new Item(35, this.x * 48, this.y * 48) + this.factory.items.push(item) + item.setDFromDirection(this.direction) + this.currentwork = 0 + } else { + this.currentwork++ + } + } else { + this.currentwork = 0 + } + } +} + +class CrucibleFurnace extends Tile { + constructor(x, y, factory) { + super(x, y, factory) + this.maxwork = 96 * 10 + this.currentwork = 0 + this.name = "cruciblefurnace" + this.i = 18 + this.cost = [{ + "id": 0, + "count": 1000 + }, + { + "id": 3, + "count": 30 + } + ] + this.texture = { + "0": [], + "1": ["cruciblefurnace10", "cruciblefurnace11", "cruciblefurnace12", "cruciblefurnace11"] + } + this.loadImages() + } + + getImage(fulltime, layer) { + fulltime = Math.round(fulltime / 4) + if (this.images[layer].length == 0) + return "0" + return this.images[layer][(fulltime % this.images[layer].length)] + } + + work() { + //Items für ein Pank + var requieredCount = 10 + if (this.input.countOf(33) >= 35 && this.input.countOf(16) >= 5) { + if (this.currentwork == this.maxwork) { + this.input.take(2, requieredCount, this.factory) + for (var i = 0; i < 40; i++) { + var item = new Item(32, this.x * 48, this.y * 48) + this.factory.items.push(item) + item.setDFromDirection(this.direction) + } + this.currentwork = 0 + } else { + this.currentwork++ + } + } else { + this.currentwork = 0 + } + } +} + class AdvancedCharcoalmeiler extends Tile { constructor(x, y, factory) { super(x, y, factory) @@ -505,8 +604,8 @@ class BlastfurnaceLower extends Tile { 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) + for (var i = 0; i < 35; i++) { + var item = new Item(33, this.x * 48, this.y * 48) this.factory.items.push(item) item.setDFromDirection(this.direction) } @@ -525,6 +624,7 @@ class BlastfurnaceUpper extends Tile { this.name = "blastfurnaceupper" this.i = 17 this.dust = 0 + this.hasNoInventory = true this.cost = [{ "id": 0, "count": 60000 @@ -870,6 +970,94 @@ class Warehouse extends Tile { } } } + +class TeleporterInput extends Tile { + constructor(x, y, factory) { + super(x, y, factory) + this.name = "teleporterinput" + this.hasNoInventory = true + this.i = 20 + this.frequency = 0 + this.cost = [{ + "id": 0, + "count": 50 + }] + this.texture = { + "0": [], + "1": ["collector13"] + } + this.options = [{ + "type": "amount", + "var": "frequency" + }] + this.loadImages() + } + + work() { + if (teleporter[this.frequency] == undefined) { + teleporter[this.frequency] = new FactoryInventory + } + while (this.input.items.length > 0) { + var item = this.input.items.pop() + teleporter[this.frequency].addItem(item) + this.factory.deleteItem(item) + } + } + + 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 TeleporterOutput extends Tile { + constructor(x, y, factory) { + super(x, y, factory) + this.name = "teleporteroutput" + this.hasNoInventory = true + this.i = 21 + this.frequency = 0 + this.cost = [{ + "id": 0, + "count": 50 + }] + this.texture = { + "0": [], + "1": ["collector13"] + } + this.options = [{ + "type": "amount", + "var": "frequency" + }] + this.loadImages() + } + + work() { + if (teleporter[this.frequency] == undefined) { + teleporter[this.frequency] = new FactoryInventory + } + while (teleporter[this.frequency].items.length > 0) { + var c = teleporter[this.frequency].itemcount[0] + var id = teleporter[this.frequency].items[0] + teleporter[this.frequency].take(id, c) + for (var i = 0; i < c; i++) { + var item = new Item(id, 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)] + } +} + tileClasses.push(Conveyorbelt) //0 tileClasses.push(Treefarm) //1 tileClasses.push(Saw) //2 @@ -888,3 +1076,7 @@ tileClasses.push(Cokery) //14 tileClasses.push(MineralWasher) //15 tileClasses.push(BlastfurnaceLower) //16 tileClasses.push(BlastfurnaceUpper) //17 +tileClasses.push(CrucibleFurnace) //18 +tileClasses.push(Smith) //19 +tileClasses.push(TeleporterInput) //20 +tileClasses.push(TeleporterOutput) //21 diff --git a/js/userinterface.js b/js/userinterface.js index d6709d2..3391c6e 100644 --- a/js/userinterface.js +++ b/js/userinterface.js @@ -573,9 +573,7 @@ function drawInventory(inventory, title) { return true for (var y = 0; y < 3; y++) { for (var x = 0; x < 10; x++) { - var img = new Image - img.src = "images/items/" + items[itemId[currentIndex]].name + ".png" - inventoryCtx.drawImage(img, 12 + x * 72, 36 + y * 72, 48, 48) + inventoryCtx.drawImage(items[itemId[currentIndex]].img, 12 + x * 72, 36 + y * 72, 48, 48) var formattedCount = formatItemCount(itemCount[currentIndex]) inventoryCtx.strokeStyle = "black" @@ -611,12 +609,10 @@ function drawBigInventory(inventory) { var currentIndex = 0 while (currentIndex != itemId.length) { var itemCtx = $('#itemBig_' + currentIndex)[0].getContext("2d") - var img = new Image - img.src = "images/items/" + items[itemId[currentIndex]].name + ".png" itemCtx.clearRect(0, 0, innerWidth, innerHeight) itemCtx.font = "16px Electrolize" itemCtx.drawImage(itembg, 0, 0, 72, 72) - itemCtx.drawImage(img, 12, 12, 48, 48) + itemCtx.drawImage(items[itemId[currentIndex]].img, 12, 12, 48, 48) var formattedCount = formatItemCount(itemCount[currentIndex]) itemCtx.strokeStyle = "black" diff --git a/lang/en.json b/lang/en.json index 7631997..b4ab241 100644 --- a/lang/en.json +++ b/lang/en.json @@ -65,12 +65,20 @@ "description": "Gets some Minerals" }, "blastfurnacelower": { - "name": "Mineral Washer", - "description": "Gets some Minerals" + "name": "Blast Furnace (Lower Part)", + "description": "Melts 40 Iron Ore with 10 Coke to create 35 Raw Iron. Requieres a upper part to work." + }, + "smith": { + "name": "Smith", + "description": "Build a Pickaxe out of 1 Steel and 1 Plank" }, "blastfurnaceupper": { - "name": "Mineral Washer", - "description": "Gets some Minerals" + "name": "Blast Furnace (Upper Part)", + "description": "Is requiered to put on the lower Blast Furnace Part" + }, + "cruciblefurnace": { + "name": "Crucible Furnace", + "description": "Enriches 35 Rawiron with 5 Iron Ore into 40 Steel" }, "filterleft": { "name": "Item Filter (left)", @@ -79,6 +87,20 @@ "filter": "Filtered Item" } }, + "teleporterinput": { + "name": "teleporterinput", + "description": "Puts a selected Item to the left and all other straight.", + "options": { + "frequency": "Frequency" + } + }, + "teleporteroutput": { + "name": "teleporteroutput", + "description": "Puts a selected Item to the left and all other straight.", + "options": { + "frequency": "Frequency" + } + }, "filterright": { "name": "Item Filter (right)", "description": "Puts a selected Item to the right and all other straight.", @@ -120,7 +142,7 @@ "tin", "salt" ], - "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"], + "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","Pickaxe"], "more": "Show Inventory / Sell Items", "inventory": "Inventory", "player": "Player",