Skip to content

Commit ebaf88e

Browse files
committed
Fixed logic IDs not loading / Accelerator animation tweaks
1 parent f8b6600 commit ebaf88e

File tree

3 files changed

+21
-6
lines changed

3 files changed

+21
-6
lines changed

core/src/mindustry/logic/GlobalVars.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
public class GlobalVars{
2424
public static final int ctrlProcessor = 1, ctrlPlayer = 2, ctrlCommand = 3;
2525
public static final ContentType[] lookableContent = {ContentType.block, ContentType.unit, ContentType.item, ContentType.liquid, ContentType.team};
26+
public static final ContentType[] writableLookableContent = {ContentType.block, ContentType.unit, ContentType.item, ContentType.liquid};
2627
/** Global random state. */
2728
public static final Rand rand = new Rand();
2829

@@ -155,7 +156,7 @@ public void init(){
155156
if(ids.exists()){
156157
//read logic ID mapping data (generated in ImagePacker)
157158
try(DataInputStream in = new DataInputStream(ids.readByteStream())){
158-
for(ContentType ctype : lookableContent){
159+
for(ContentType ctype : writableLookableContent){
159160
short amount = in.readShort();
160161
logicIdToContent[ctype.ordinal()] = new UnlockableContent[amount];
161162
contentIdToLogicId[ctype.ordinal()] = new int[Vars.content.getBy(ctype).size];

core/src/mindustry/world/blocks/campaign/Accelerator.java

+16-2
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ public class AcceleratorBuild extends Building implements LaunchAnimator{
111111
public float progress;
112112
public float time, launchHeat;
113113
public boolean launching;
114+
public float launchTime;
114115

115116
protected float cloudSeed;
116117

@@ -156,7 +157,18 @@ public void draw(){
156157
{
157158
if(launching){
158159
Draw.reset();
160+
161+
Draw.blend(Blending.additive);
162+
Fill.light(x, y, 15, launchBlock.size * tilesize * 1f, Tmp.c2.set(Pal.accent).a(launchTime / chargeDuration), Tmp.c1.set(Pal.accent).a(0f));
163+
Draw.blend();
164+
165+
Draw.rect(launchBlock.fullIcon, x, y);
166+
167+
Draw.z(Layer.bullet);
168+
Draw.mixcol(Pal.accent, Mathf.clamp(launchTime / chargeDuration));
169+
Draw.color(1f, 1f, 1f, Interp.pow2In.apply(Mathf.clamp(launchTime / chargeDuration * 0.7f)));
159170
Draw.rect(launchBlock.fullIcon, x, y);
171+
Draw.reset();
160172
}else{
161173
Drawf.shadow(x, y, launchBlock.size * tilesize * 2f, progress);
162174
Draw.draw(Layer.blockBuilding, () -> {
@@ -175,7 +187,6 @@ public void draw(){
175187
});
176188
}
177189

178-
179190
Draw.reset();
180191
}
181192

@@ -366,13 +377,15 @@ public void beginLaunch(boolean launching){
366377
@Override
367378
public void endLaunch(){
368379
launching = false;
380+
launchTime = 0f;
369381
}
370382

371383
@Override
372384
public float zoomLaunch(){
373385
float rawTime = launchDuration() - renderer.getLandTime();
386+
float shake = rawTime < chargeDuration ? Interp.pow10In.apply(Mathf.clamp(rawTime/chargeDuration)) : 0f;
374387

375-
Core.camera.position.set(this);
388+
Core.camera.position.set(x, y).add(Tmp.v1.setToRandomDirection().scl(shake * 2f));
376389

377390
if(rawTime < chargeDuration){
378391
float fin = rawTime / chargeDuration;
@@ -389,6 +402,7 @@ public float zoomLaunch(){
389402
@Override
390403
public void updateLaunch(){
391404
float in = renderer.getLandTimeIn() * launchDuration();
405+
launchTime = launchDuration() - in;
392406
float tsize = Mathf.sample(CoreBlock.thrusterSizes, (in + 35f) / launchDuration());
393407

394408
float rawFin = renderer.getLandTimeIn();

tools/src/mindustry/tools/ImagePacker.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ public boolean has(String s){
140140

141141
Seq<UnlockableContent> lookupCont = new Seq<>();
142142

143-
for(ContentType t : GlobalVars.lookableContent){
143+
for(ContentType t : GlobalVars.writableLookableContent){
144144
lookupCont.addAll(Vars.content.<UnlockableContent>getBy(t).select(UnlockableContent::logicVisible));
145145
}
146146

@@ -154,7 +154,7 @@ public boolean has(String s){
154154

155155
if(logicidfile.exists()){
156156
try(DataInputStream in = new DataInputStream(logicidfile.readByteStream())){
157-
for(ContentType ctype : GlobalVars.lookableContent){
157+
for(ContentType ctype : GlobalVars.writableLookableContent){
158158
short amount = in.readShort();
159159
for(int i = 0; i < amount; i++){
160160
String name = in.readUTF();
@@ -189,7 +189,7 @@ public boolean has(String s){
189189

190190
//write the resulting IDs
191191
try(DataOutputStream out = new DataOutputStream(logicidfile.write(false, 2048))){
192-
for(ContentType t : GlobalVars.lookableContent){
192+
for(ContentType t : GlobalVars.writableLookableContent){
193193
Seq<UnlockableContent> all = idToContent[t.ordinal()].values().toArray().sort(u -> registered[t.ordinal()].get(u));
194194
out.writeShort(all.size);
195195
for(UnlockableContent u : all){

0 commit comments

Comments
 (0)