This commit is contained in:
Anuken 2024-08-30 14:22:33 -04:00
parent 5f164b6270
commit 46cc0d4cc1
2 changed files with 23 additions and 6 deletions

View File

@ -457,7 +457,7 @@ public class DesktopInput extends InputHandler{
cursorType = cursor.build.getCursor();
}
if(cursor.build != null && player.team() != Team.derelict && cursor.build.team == Team.derelict && Build.validPlace(cursor.block(), player.team(), cursor.build.tileX(), cursor.build.tileY(), cursor.build.rotation)){
if(cursor.build != null && player.team() != Team.derelict && cursor.build.team == Team.derelict && cursor.build.block.unlockedNow() && Build.validPlace(cursor.block(), player.team(), cursor.build.tileX(), cursor.build.tileY(), cursor.build.rotation)){
cursorType = ui.repairCursor;
}

View File

@ -380,13 +380,20 @@ public class Conveyor extends Block implements Autotiler{
}
}
@Override
public byte version(){
return 1;
}
@Override
public void write(Writes write){
super.write(write);
write.i(len);
for(int i = 0; i < len; i++){
write.i(Pack.intBytes((byte)ids[i].id, (byte)(xs[i] * 127), (byte)(ys[i] * 255 - 128), (byte)0));
write.s(ids[i].id);
write.b((byte)(xs[i] * 127));
write.b((byte)(ys[i] * 255 - 128));
}
}
@ -397,10 +404,20 @@ public class Conveyor extends Block implements Autotiler{
len = Math.min(amount, capacity);
for(int i = 0; i < amount; i++){
int val = read.i();
short id = (short)(((byte)(val >> 24)) & 0xff);
float x = (float)((byte)(val >> 16)) / 127f;
float y = ((float)((byte)(val >> 8)) + 128f) / 255f;
short id;
float x, y;
if(revision == 0){
int val = read.i();
id = (short)(((byte)(val >> 24)) & 0xff);
x = (float)((byte)(val >> 16)) / 127f;
y = ((float)((byte)(val >> 8)) + 128f) / 255f;
}else{
id = read.s();
x = (float)read.b() / 127f;
y = ((float)read.b() + 128f) / 255f;
}
if(i < capacity){
ids[i] = content.item(id);
xs[i] = x;