mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-03-13 02:11:08 -07:00
Steam kick bugfixes
This commit is contained in:
parent
d07706e039
commit
0daafc5ff3
4 changed files with 31 additions and 10 deletions
|
|
@ -230,8 +230,7 @@ public class Pathfinder implements Runnable{
|
|||
for(Flowfield path : mainList){
|
||||
if(path != null){
|
||||
synchronized(path.targets){
|
||||
path.targets.clear();
|
||||
path.getPositions(path.targets);
|
||||
path.updateTargetPositions();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -312,8 +311,7 @@ public class Pathfinder implements Runnable{
|
|||
synchronized(path.targets){
|
||||
//make sure the position actually changed
|
||||
if(!(path.targets.size == 1 && tmpArray.size == 1 && path.targets.first() == tmpArray.first())){
|
||||
path.targets.clear();
|
||||
path.getPositions(path.targets);
|
||||
path.updateTargetPositions();
|
||||
|
||||
//queue an update
|
||||
queue.post(() -> updateTargets(path));
|
||||
|
|
@ -367,8 +365,7 @@ public class Pathfinder implements Runnable{
|
|||
}
|
||||
|
||||
private void preloadPath(Flowfield path){
|
||||
path.targets.clear();
|
||||
path.getPositions(path.targets);
|
||||
path.updateTargetPositions();
|
||||
registerPath(path);
|
||||
updateFrontier(path, -1);
|
||||
}
|
||||
|
|
@ -493,10 +490,10 @@ public class Pathfinder implements Runnable{
|
|||
protected Team team = Team.derelict;
|
||||
/** Function for calculating path cost. Set before using. */
|
||||
protected PathCost cost = costTypes.get(costGround);
|
||||
/** If true, this flow field needs updating. This flag is only set to false once the flow field finishes and the weights are copied over. */
|
||||
protected boolean dirty = false;
|
||||
/** Whether there are valid weights in the complete array. */
|
||||
protected volatile boolean hasComplete;
|
||||
/** If true, this flow field needs updating. This flag is only set to false once the flow field finishes and the weights are copied over. */
|
||||
protected boolean dirty = false;
|
||||
|
||||
/** costs of getting to a specific tile */
|
||||
public int[] weights;
|
||||
|
|
@ -524,6 +521,11 @@ public class Pathfinder implements Runnable{
|
|||
this.initialized = true;
|
||||
}
|
||||
|
||||
public void updateTargetPositions(){
|
||||
targets.clear();
|
||||
getPositions(targets);
|
||||
}
|
||||
|
||||
protected boolean passable(int pos){
|
||||
return cost.getCost(team.id, pathfinder.tiles[pos]) != impassable;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,19 @@ public class InverseKinematics{
|
|||
return solve(lengthA, lengthB, end, at1, result);
|
||||
}
|
||||
|
||||
/**
|
||||
inputs:
|
||||
|
||||
@param lengthA first line segment length
|
||||
@param lengthB second line segment length
|
||||
@param end length of the endpoint you want to reach
|
||||
@param attractor direction you want the result to be closer to (since there are usually 2 solutions)
|
||||
|
||||
output:
|
||||
|
||||
@param result a point in-between (0, 0) and (end) such that (0, 0).dst(result) == lengthA and result.dst(end) == lengthB - or in basic terms, the position of a joint between (0, 0) and end where the two lengths of segments are lengthA and lengthB
|
||||
@return whether IK succeeded (this can fail if end is too far, for example)
|
||||
*/
|
||||
public static boolean solve(float lengthA, float lengthB, Vec2 end, Vec2 attractor, Vec2 result){
|
||||
Vec2 axis = mat2[0].set(end).nor();
|
||||
mat2[1].set(attractor).sub(temp2.set(axis).scl(attractor.dot(axis))).nor();
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ public class BeControl{
|
|||
Log.info("&lcAutosaved.");
|
||||
|
||||
netServer.kickAll(KickReason.serverRestarting);
|
||||
Threads.sleep(32);
|
||||
Threads.sleep(500);
|
||||
|
||||
Log.info("&lcVersion downloaded, exiting. Note that if you are not using a auto-restart script, the server will not restart automatically.");
|
||||
//replace old file with new
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package mindustry.net;
|
||||
|
||||
import arc.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import mindustry.entities.units.*;
|
||||
|
|
@ -76,7 +77,12 @@ public abstract class NetConnection{
|
|||
Call.kick(this, reason);
|
||||
}
|
||||
|
||||
close();
|
||||
if(uuid.startsWith("steam:")){
|
||||
//run with a 2-frame delay so there is time to send the kick packet, steam handles this weirdly
|
||||
Core.app.post(() -> Core.app.post(this::close));
|
||||
}else{
|
||||
close();
|
||||
}
|
||||
|
||||
netServer.admins.save();
|
||||
kicked = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue