mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-13 23:14:53 +09:00
remoteMap animated radar
This commit is contained in:
1 parent
fb3d27abef
commit
47637f5511
2 files changed
+9
-3
No files matched your search
@@ -147,7 +147,7 @@ for(let i = 1; i <= 3; i++){
|
||||
// template3x3entity;
|
||||
};
|
||||
entityDrawRules["radar"] = {
|
||||
spritesheet: spritesheetJson.frames["images/factorio/entity/radar/radar.png.22"],
|
||||
spritesheet: [],
|
||||
sizeInTiles: {
|
||||
x:4,
|
||||
y:4,
|
||||
@@ -159,6 +159,7 @@ entityDrawRules["radar"] = {
|
||||
}
|
||||
for(let i = 0; i < 64; i++){
|
||||
// animate the radar
|
||||
entityDrawRules.radar.spritesheet.push({spritesheet: spritesheetJson.frames["images/factorio/entity/radar/radar.png."+i]});
|
||||
}
|
||||
["beacon", "electric-furnace"].forEach(name => {
|
||||
entityDrawRules[name] = template3x3entity;
|
||||
|
||||
+7
-2
@@ -494,9 +494,14 @@ function drawEntity(entity, dontCache){
|
||||
};
|
||||
}
|
||||
} else {
|
||||
// correct for whether we have 4 or 8 directions
|
||||
// correct for whether we have 1, 4 or 8 directions
|
||||
let spriteSheetRotIndex = dir / (8 / rules.spritesheet.length);
|
||||
if(rules.spritesheet[spriteSheetRotIndex].spritesheet.length){
|
||||
if(rules.spritesheet.length > 8) {
|
||||
// apparently this entity has more than 8 directions. That isn't supported.
|
||||
// therefore we can conclude that they are instead intended as animation frames.
|
||||
// That is why we treat them as animation frames.
|
||||
spriteSheetRotIndex = Math.floor(Date.now()/32) % rules.spritesheet.length;
|
||||
} else if(rules.spritesheet[spriteSheetRotIndex].spritesheet.length){
|
||||
var animationStage = Math.floor(Date.now()/16) % rules.spritesheet[spriteSheetRotIndex].spritesheet.length;
|
||||
var usesAnimation = true;
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user