mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-26 08:33:12 +09:00
remoteMap draw better trees
This commit is contained in:
1 parent
50d14394a6
commit
26483d63d3
3 files changed
+41
-8
No files matched your search
@@ -13,8 +13,8 @@ class remoteMap {
|
|||||||
// initialize chunk database
|
// initialize chunk database
|
||||||
this.chunkMap = new chunkStore(this.config.unique, 64, "./database/chunkStore/");
|
this.chunkMap = new chunkStore(this.config.unique, 64, "./database/chunkStore/");
|
||||||
this.chunkMap.onEntityChange(entity => {
|
this.chunkMap.onEntityChange(entity => {
|
||||||
this.messageInterface("Entity changed: ")
|
// this.messageInterface("Entity changed: ")
|
||||||
this.messageInterface(entity);
|
// this.messageInterface(entity);
|
||||||
// check valid coordinates (dunno what could go wrong, but can never be too sure)
|
// check valid coordinates (dunno what could go wrong, but can never be too sure)
|
||||||
if(entity && entity.x !== undefined && !isNaN(Number(entity.x)) && entity.y !== undefined && !isNaN(Number(entity.y))){
|
if(entity && entity.x !== undefined && !isNaN(Number(entity.x)) && entity.y !== undefined && !isNaN(Number(entity.y))){
|
||||||
this.socket.emit("sendEntity", entity);
|
this.socket.emit("sendEntity", entity);
|
||||||
@@ -57,6 +57,7 @@ class remoteMap {
|
|||||||
this.messageInterface("placing "+JSON.stringify(req));
|
this.messageInterface("placing "+JSON.stringify(req));
|
||||||
if(req.name && typeof req.name == "string" && req.position && !isNaN(Number(req.position.x)) && !isNaN(Number(req.position.y))){
|
if(req.name && typeof req.name == "string" && req.position && !isNaN(Number(req.position.x)) && !isNaN(Number(req.position.y))){
|
||||||
if(req.name == "deleted"){ // {{'+req.position.x+','+req.position.y+'},{'+req.position.x+','+req.position.y+'}}
|
if(req.name == "deleted"){ // {{'+req.position.x+','+req.position.y+'},{'+req.position.x+','+req.position.y+'}}
|
||||||
|
// delete entity from game world using LUA command
|
||||||
this.messageInterface('/silent-command local toDelete = game.surfaces[1].find_entities({{'+req.position.x+','+req.position.y+'},{'+(req.position.x+1)+','+(req.position.y+1)+'}}) for i, entity in pairs(toDelete) do entity.die() end');
|
this.messageInterface('/silent-command local toDelete = game.surfaces[1].find_entities({{'+req.position.x+','+req.position.y+'},{'+(req.position.x+1)+','+(req.position.y+1)+'}}) for i, entity in pairs(toDelete) do entity.die() end');
|
||||||
// this position is now empty, delete whatever was there from DB
|
// this position is now empty, delete whatever was there from DB
|
||||||
this.deleteEntity(req.position.x, req.position.y);
|
this.deleteEntity(req.position.x, req.position.y);
|
||||||
@@ -87,7 +88,7 @@ class remoteMap {
|
|||||||
deleteEntity(x,y){ // remove entity from database
|
deleteEntity(x,y){ // remove entity from database
|
||||||
// this position is now empty, delete whatever was there from DB
|
// this position is now empty, delete whatever was there from DB
|
||||||
this.chunkMap.setEntity(x, y, "delete this entity").then(() => {
|
this.chunkMap.setEntity(x, y, "delete this entity").then(() => {
|
||||||
this.messageInterface("Deleted data "+x+", "+y);
|
this.messageInterface("Deleted entity at "+x+", "+y);
|
||||||
}).catch((err)=>this.messageInterface(err));
|
}).catch((err)=>this.messageInterface(err));
|
||||||
}
|
}
|
||||||
scriptOutput(data){
|
scriptOutput(data){
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ export var entityDrawRules = {
|
|||||||
x:-1,
|
x:-1,
|
||||||
y:-1,
|
y:-1,
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
let template3x3entity = {
|
let template3x3entity = {
|
||||||
sizeInTiles: {
|
sizeInTiles: {
|
||||||
@@ -332,4 +332,24 @@ entityDrawRules["oil-refinery"].spritesheet.forEach(object => {
|
|||||||
y:-2.7,
|
y:-2.7,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
// tree sizes
|
||||||
|
["tree-02",
|
||||||
|
"tree-02-red",
|
||||||
|
"tree-03",
|
||||||
|
"tree-04",
|
||||||
|
"tree-05",
|
||||||
|
"tree-07",
|
||||||
|
"tree-09",
|
||||||
|
"tree-09-brown",
|
||||||
|
"tree-09-red"].forEach(tree => {
|
||||||
|
entityDrawRules[tree] = {
|
||||||
|
sizeInTiles: {
|
||||||
|
x: 3,
|
||||||
|
y: 4,
|
||||||
|
},
|
||||||
|
positionOffset: {
|
||||||
|
x: -0.6,
|
||||||
|
y: -2.6,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
+15
-3
@@ -169,7 +169,7 @@ $.getJSON("/api/getFactorioLocale", (locale) => {
|
|||||||
// image data
|
// image data
|
||||||
// key is the name of the item in the database, value is the name of the image on wiki.factorio.com/images/*
|
// key is the name of the item in the database, value is the name of the image on wiki.factorio.com/images/*
|
||||||
// this list has to include all entities that doesn't just follow the simple capitalize first letter convention
|
// this list has to include all entities that doesn't just follow the simple capitalize first letter convention
|
||||||
/* Notice: All icon images hosted on this Wiki have been renamed to use their in-game names, with underscores. If your external tool references these icons, please correct your links. */
|
/* Notice from bilka: All icon images hosted on this Wiki have been renamed to use their in-game names, with underscores. If your external tool references these icons, please correct your links. */
|
||||||
var imagedata = {
|
var imagedata = {
|
||||||
"put-combinator": "Decider_combinator",
|
"put-combinator": "Decider_combinator",
|
||||||
"smart-train-stop": "Train_stop",
|
"smart-train-stop": "Train_stop",
|
||||||
@@ -177,6 +177,19 @@ var imagedata = {
|
|||||||
"solar-panel-equipment": "Portable_solar_panel",
|
"solar-panel-equipment": "Portable_solar_panel",
|
||||||
"diesel-locomotive": "Locomotive", // pre 0.15 loco name
|
"diesel-locomotive": "Locomotive", // pre 0.15 loco name
|
||||||
"small-lamp": "Lamp",
|
"small-lamp": "Lamp",
|
||||||
|
"tree-02": "Green_tree",
|
||||||
|
"tree-02-red": "Green_tree",
|
||||||
|
"tree-03": "Green_tree",
|
||||||
|
"tree-04": "Green_tree",
|
||||||
|
"tree-05": "Green_tree",
|
||||||
|
"tree-07": "Green_tree",
|
||||||
|
"tree-09": "Green_tree",
|
||||||
|
"tree-09-brown": "Green_tree",
|
||||||
|
"tree-09-red": "Green_tree",
|
||||||
|
"dead-tree-desert": "Dead_tree_desert",
|
||||||
|
"sand-rock-big": "Rock_big",
|
||||||
|
// "biter-spawner" missing, but can't find png for it on wiki
|
||||||
|
// "spitter-spawner"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -199,6 +212,5 @@ var imagelinks = {
|
|||||||
"piercing-shotgun-shell": "/pictures/piercing_shotgun_shells.png",
|
"piercing-shotgun-shell": "/pictures/piercing_shotgun_shells.png",
|
||||||
"energy-shield-mk2-equipment": "/pictures/Energy_shield_MK2.png",
|
"energy-shield-mk2-equipment": "/pictures/Energy_shield_MK2.png",
|
||||||
"battery-mk2-equipment": "/pictures/Battery_MK2.png",
|
"battery-mk2-equipment": "/pictures/Battery_MK2.png",
|
||||||
"personal-roboport-mk2-equipment": "/pictures/Personal_roboport_MK2.png"
|
"personal-roboport-mk2-equipment": "/pictures/Personal_roboport_MK2.png",
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user