recieve -> receive

This commit is contained in:
Anuken
2020-07-14 11:16:32 -04:00
parent da577a0db2
commit f9b6b8e5b7
17 changed files with 47 additions and 47 deletions

View File

@@ -103,16 +103,16 @@ public class Logic implements ApplicationListener{
if(state.rules.sector.save != null && core != null){ if(state.rules.sector.save != null && core != null){
//add produced items //add produced items
//TODO move to recieved items //TODO move to received items
state.rules.sector.save.meta.secinfo.production.each((item, stat) -> { state.rules.sector.save.meta.secinfo.production.each((item, stat) -> {
core.items.add(item, (int)(stat.mean * seconds)); core.items.add(item, (int)(stat.mean * seconds));
}); });
//add recieved items //add received items
state.rules.sector.getRecievedItems().each(stack -> core.items.add(stack.item, stack.amount)); state.rules.sector.getReceivedItems().each(stack -> core.items.add(stack.item, stack.amount));
//clear recieved items //clear received items
state.rules.sector.setRecievedItems(new Seq<>()); state.rules.sector.setReceivedItems(new Seq<>());
//validation //validation
for(Item item : content.items()){ for(Item item : content.items()){
@@ -274,15 +274,15 @@ public class Logic implements ApplicationListener{
Time.runTask(30f, () -> { Time.runTask(30f, () -> {
Sector origin = sector.save.meta.secinfo.origin; Sector origin = sector.save.meta.secinfo.origin;
if(origin != null){ if(origin != null){
Seq<ItemStack> stacks = origin.getRecievedItems(); Seq<ItemStack> stacks = origin.getReceivedItems();
//add up all items into list //add up all items into list
for(Building entity : state.teams.playerCores()){ for(Building entity : state.teams.playerCores()){
entity.items.each((item, amount) -> ItemStack.insert(stacks, item, amount)); entity.items.each((item, amount) -> ItemStack.insert(stacks, item, amount));
} }
//save recieved items //save received items
origin.setRecievedItems(stacks); origin.setReceivedItems(stacks);
} }
//remove all the cores //remove all the cores

View File

@@ -118,7 +118,7 @@ public class NetClient implements ApplicationListener{
}); });
net.handleClient(WorldStream.class, data -> { net.handleClient(WorldStream.class, data -> {
Log.info("Recieved world data: @ bytes.", data.stream.available()); Log.info("Received world data: @ bytes.", data.stream.available());
NetworkIO.loadWorld(new InflaterInputStream(data.stream)); NetworkIO.loadWorld(new InflaterInputStream(data.stream));
finishConnecting(); finishConnecting();
@@ -172,7 +172,7 @@ public class NetClient implements ApplicationListener{
} }
} }
//called when a server recieves a chat message from a player //called when a server receives a chat message from a player
@Remote(called = Loc.server, targets = Loc.client) @Remote(called = Loc.server, targets = Loc.client)
public static void sendChatMessage(Player player, String message){ public static void sendChatMessage(Player player, String message){
if(message.length() > maxTextLength){ if(message.length() > maxTextLength){

View File

@@ -540,11 +540,11 @@ public class NetServer implements ApplicationListener{
float viewX, float viewY, float viewWidth, float viewHeight float viewX, float viewY, float viewWidth, float viewHeight
){ ){
NetConnection con = player.con; NetConnection con = player.con;
if(con == null || snapshotID < con.lastRecievedClientSnapshot) return; if(con == null || snapshotID < con.lastReceivedClientSnapshot) return;
boolean verifyPosition = !player.dead() && netServer.admins.getStrict() && headless; boolean verifyPosition = !player.dead() && netServer.admins.getStrict() && headless;
if(con.lastRecievedClientTime == 0) con.lastRecievedClientTime = Time.millis() - 16; if(con.lastReceivedClientTime == 0) con.lastReceivedClientTime = Time.millis() - 16;
con.viewX = viewX; con.viewX = viewX;
con.viewY = viewY; con.viewY = viewY;
@@ -606,7 +606,7 @@ public class NetServer implements ApplicationListener{
Unit unit = player.unit(); Unit unit = player.unit();
unit.vel.set(xVelocity, yVelocity).limit(unit.type().speed); unit.vel.set(xVelocity, yVelocity).limit(unit.type().speed);
long elapsed = Time.timeSinceMillis(con.lastRecievedClientTime); long elapsed = Time.timeSinceMillis(con.lastReceivedClientTime);
float maxSpeed = player.unit().type().speed; float maxSpeed = player.unit().type().speed;
float maxMove = elapsed / 1000f * 60f * maxSpeed * 1.1f; float maxMove = elapsed / 1000f * 60f * maxSpeed * 1.1f;
@@ -663,8 +663,8 @@ public class NetServer implements ApplicationListener{
player.y = y; player.y = y;
} }
con.lastRecievedClientSnapshot = snapshotID; con.lastReceivedClientSnapshot = snapshotID;
con.lastRecievedClientTime = Time.millis(); con.lastReceivedClientTime = Time.millis();
} }
@Remote(targets = Loc.client, called = Loc.server) @Remote(targets = Loc.client, called = Loc.server)

View File

@@ -73,7 +73,7 @@ public class MassDriverBolt extends BulletType{
//if on course and it's in range of the target //if on course and it's in range of the target
if(Math.abs(dst1 + dst2 - baseDst) < 4f && dst2 <= hitDst){ if(Math.abs(dst1 + dst2 - baseDst) < 4f && dst2 <= hitDst){
intersect = true; intersect = true;
} //else, bullet has gone off course, does not get recieved. } //else, bullet has gone off course, does not get received.
if(intersect){ if(intersect){
data.to.handlePayload(b, data); data.to.handlePayload(b, data);

View File

@@ -48,9 +48,9 @@ public class EventType{
public static class TurnEvent{} public static class TurnEvent{}
/** Called when the player places a line, mobile or desktop.*/ /** Called when the player places a line, mobile or desktop.*/
public static class LineConfirmEvent{} public static class LineConfirmEvent{}
/** Called when a turret recieves ammo, but only when the tutorial is active! */ /** Called when a turret receives ammo, but only when the tutorial is active! */
public static class TurretAmmoDeliverEvent{} public static class TurretAmmoDeliverEvent{}
/** Called when a core recieves ammo, but only when the tutorial is active! */ /** Called when a core receives ammo, but only when the tutorial is active! */
public static class CoreItemDeliverEvent{} public static class CoreItemDeliverEvent{}
/** Called when the player opens info for a specific block.*/ /** Called when the player opens info for a specific block.*/
public static class BlockInfoEvent{} public static class BlockInfoEvent{}
@@ -307,7 +307,7 @@ public class EventType{
} }
} }
/** Called after connecting; when a player recieves world data and is ready to play.*/ /** Called after connecting; when a player receives world data and is ready to play.*/
public static class PlayerJoin{ public static class PlayerJoin{
public final Player player; public final Player player;

View File

@@ -140,14 +140,14 @@ public class SectorInfo{
} }
} }
/** @return the items in this sector now, taking into account production and items recieved. */ /** @return the items in this sector now, taking into account production and items received. */
public ObjectIntMap<Item> getCurrentItems(Sector sector){ public ObjectIntMap<Item> getCurrentItems(Sector sector){
ObjectIntMap<Item> map = new ObjectIntMap<>(); ObjectIntMap<Item> map = new ObjectIntMap<>();
map.putAll(coreItems); map.putAll(coreItems);
long seconds = sector.getSecondsPassed(); long seconds = sector.getSecondsPassed();
production.each((item, stat) -> map.increment(item, (int)(stat.mean * seconds))); production.each((item, stat) -> map.increment(item, (int)(stat.mean * seconds)));
//increment based on recieved items //increment based on received items
sector.getRecievedItems().each(stack -> map.increment(stack.item, stack.amount)); sector.getReceivedItems().each(stack -> map.increment(stack.item, stack.amount));
return map; return map;
} }

View File

@@ -85,7 +85,7 @@ public class ArcNetProvider implements NetProvider{
Connect c = new Connect(); Connect c = new Connect();
c.addressTCP = ip; c.addressTCP = ip;
Log.debug("&bRecieved connection: @", c.addressTCP); Log.debug("&bReceived connection: @", c.addressTCP);
connections.add(kn); connections.add(kn);
Core.app.post(() -> net.handleServerReceived(kn, c)); Core.app.post(() -> net.handleServerReceived(kn, c));

View File

@@ -85,7 +85,7 @@ public class Net{
} }
/** /**
* Sets the client loaded status, or whether it will recieve normal packets from the server. * Sets the client loaded status, or whether it will receive normal packets from the server.
*/ */
public void setClientLoaded(boolean loaded){ public void setClientLoaded(boolean loaded){
clientLoaded = loaded; clientLoaded = loaded;
@@ -205,21 +205,21 @@ public class Net{
} }
/** /**
* Registers a client listener for when an object is recieved. * Registers a client listener for when an object is received.
*/ */
public <T> void handleClient(Class<T> type, Cons<T> listener){ public <T> void handleClient(Class<T> type, Cons<T> listener){
clientListeners.put(type, listener); clientListeners.put(type, listener);
} }
/** /**
* Registers a server listener for when an object is recieved. * Registers a server listener for when an object is received.
*/ */
public <T> void handleServer(Class<T> type, Cons2<NetConnection, T> listener){ public <T> void handleServer(Class<T> type, Cons2<NetConnection, T> listener){
serverListeners.put(type, (Cons2<NetConnection, Object>)listener); serverListeners.put(type, (Cons2<NetConnection, Object>)listener);
} }
/** /**
* Call to handle a packet being recieved for the client. * Call to handle a packet being received for the client.
*/ */
public void handleClientReceived(Object object){ public void handleClientReceived(Object object){
@@ -231,7 +231,7 @@ public class Net{
StreamChunk c = (StreamChunk)object; StreamChunk c = (StreamChunk)object;
StreamBuilder builder = streams.get(c.id); StreamBuilder builder = streams.get(c.id);
if(builder == null){ if(builder == null){
throw new RuntimeException("Recieved stream chunk without a StreamBegin beforehand!"); throw new RuntimeException("Received stream chunk without a StreamBegin beforehand!");
} }
builder.add(c.data); builder.add(c.data);
if(builder.isDone()){ if(builder.isDone()){
@@ -256,7 +256,7 @@ public class Net{
} }
/** /**
* Call to handle a packet being recieved for the server. * Call to handle a packet being received for the server.
*/ */
public void handleServerReceived(NetConnection connection, Object object){ public void handleServerReceived(NetConnection connection, Object object){

View File

@@ -22,10 +22,10 @@ public abstract class NetConnection{
public @Nullable Unitc lastUnit; public @Nullable Unitc lastUnit;
public Vec2 lastPosition = new Vec2(); public Vec2 lastPosition = new Vec2();
/** ID of last recieved client snapshot. */ /** ID of last received client snapshot. */
public int lastRecievedClientSnapshot = -1; public int lastReceivedClientSnapshot = -1;
/** Timestamp of last recieved snapshot. */ /** Timestamp of last received snapshot. */
public long lastRecievedClientTime; public long lastReceivedClientTime;
/** Build requests that have been recently rejected. This is cleared every snapshot. */ /** Build requests that have been recently rejected. This is cleared every snapshot. */
public Seq<BuildPlan> rejectedRequests = new Seq<>(); public Seq<BuildPlan> rejectedRequests = new Seq<>();

View File

@@ -148,12 +148,12 @@ public class Sector{
} }
//TODO this should be stored in a more efficient structure, and be updated each turn //TODO this should be stored in a more efficient structure, and be updated each turn
public Seq<ItemStack> getRecievedItems(){ public Seq<ItemStack> getReceivedItems(){
return Core.settings.getJson(key("recieved-items"), Seq.class, ItemStack.class, Seq::new); return Core.settings.getJson(key("received-items"), Seq.class, ItemStack.class, Seq::new);
} }
public void setRecievedItems(Seq<ItemStack> stacks){ public void setReceivedItems(Seq<ItemStack> stacks){
Core.settings.putJson(key("recieved-items"), ItemStack.class, stacks); Core.settings.putJson(key("received-items"), ItemStack.class, stacks);
} }
//TODO these methods should maybe move somewhere else and/or be contained in a data object //TODO these methods should maybe move somewhere else and/or be contained in a data object

View File

@@ -177,7 +177,7 @@ public class LaunchPad extends Block{
//actually launch the items upon removal //actually launch the items upon removal
if(team() == state.rules.defaultTeam && state.secinfo.origin != null){ if(team() == state.rules.defaultTeam && state.secinfo.origin != null){
Seq<ItemStack> dest = state.secinfo.origin.getRecievedItems(); Seq<ItemStack> dest = state.secinfo.origin.getReceivedItems();
for(ItemStack stack : stacks){ for(ItemStack stack : stacks){
ItemStack sto = dest.find(i -> i.item == stack.item); ItemStack sto = dest.find(i -> i.item == stack.item);
@@ -192,7 +192,7 @@ public class LaunchPad extends Block{
Events.fire(new LaunchItemEvent(stack)); Events.fire(new LaunchItemEvent(stack));
} }
state.secinfo.origin.setRecievedItems(dest); state.secinfo.origin.setReceivedItems(dest);
} }
} }
} }

View File

@@ -29,7 +29,7 @@ public class MassDriver extends Block{
public float bulletLifetime = 200f; public float bulletLifetime = 200f;
public Effect shootEffect = Fx.shootBig2; public Effect shootEffect = Fx.shootBig2;
public Effect smokeEffect = Fx.shootBigSmoke2; public Effect smokeEffect = Fx.shootBigSmoke2;
public Effect recieveEffect = Fx.mineBig; public Effect receiveEffect = Fx.mineBig;
public float shake = 3f; public float shake = 3f;
public @Load("@-base") TextureRegion baseRegion; public @Load("@-base") TextureRegion baseRegion;
@@ -281,7 +281,7 @@ public class MassDriver extends Block{
} }
Effects.shake(shake, shake, this); Effects.shake(shake, shake, this);
recieveEffect.at(bullet); receiveEffect.at(bullet);
reload = 1f; reload = 1f;
bullet.remove(); bullet.remove();

View File

@@ -51,7 +51,7 @@ public class LiquidModule extends BlockModule{
return total; return total;
} }
/** Last recieved or loaded liquid. Only valid for liquid modules with 1 type of liquid. */ /** Last received or loaded liquid. Only valid for liquid modules with 1 type of liquid. */
public Liquid current(){ public Liquid current(){
return current; return current;
} }

View File

@@ -67,7 +67,7 @@ public class SNet implements SteamNetworkingCallback, SteamMatchmakingCallback,
Connect c = new Connect(); Connect c = new Connect();
c.addressTCP = "steam:" + from.getAccountID(); c.addressTCP = "steam:" + from.getAccountID();
Log.info("&bRecieved STEAM connection: @", c.addressTCP); Log.info("&bReceived STEAM connection: @", c.addressTCP);
steamConnections.put(from.getAccountID(), con); steamConnections.put(from.getAccountID(), con);
connections.add(con); connections.add(con);

View File

@@ -283,9 +283,9 @@ public class SStats implements SteamUserStatsCallback{
registerEvents(); registerEvents();
if(result != SteamResult.OK){ if(result != SteamResult.OK){
Log.err("Failed to recieve steam stats: @", result); Log.err("Failed to receive steam stats: @", result);
}else{ }else{
Log.info("Recieved steam stats."); Log.info("Received steam stats.");
} }
} }

View File

@@ -1,3 +1,3 @@
org.gradle.daemon=true org.gradle.daemon=true
org.gradle.jvmargs=-Xms256m -Xmx1024m org.gradle.jvmargs=-Xms256m -Xmx1024m
archash=1fa9e78b9a7a83090ec942fbc3c3ff6d8a25ebcf archash=16be283e409ce6ddcc96f20b57c67ced35d418d4

View File

@@ -989,7 +989,7 @@ public class ServerControl implements ApplicationListener{
serverSocket.bind(new InetSocketAddress(Config.socketInputAddress.string(), Config.socketInputPort.num())); serverSocket.bind(new InetSocketAddress(Config.socketInputAddress.string(), Config.socketInputPort.num()));
while(true){ while(true){
Socket client = serverSocket.accept(); Socket client = serverSocket.accept();
info("&lmRecieved command socket connection: &lb@", serverSocket.getLocalSocketAddress()); info("&lmReceived command socket connection: &lb@", serverSocket.getLocalSocketAddress());
BufferedReader in = new BufferedReader(new InputStreamReader(client.getInputStream())); BufferedReader in = new BufferedReader(new InputStreamReader(client.getInputStream()));
socketOutput = new PrintWriter(client.getOutputStream(), true); socketOutput = new PrintWriter(client.getOutputStream(), true);
String line; String line;