itemTransferRange proper usage
This commit is contained in:
@@ -984,6 +984,7 @@ keybind.move_y.name = Move Y
|
|||||||
keybind.mouse_move.name = Follow Mouse
|
keybind.mouse_move.name = Follow Mouse
|
||||||
keybind.pan.name = Pan View
|
keybind.pan.name = Pan View
|
||||||
keybind.boost.name = Boost
|
keybind.boost.name = Boost
|
||||||
|
keybind.command_mode.name = Command Mode
|
||||||
keybind.schematic_select.name = Select Region
|
keybind.schematic_select.name = Select Region
|
||||||
keybind.schematic_menu.name = Schematic Menu
|
keybind.schematic_menu.name = Schematic Menu
|
||||||
keybind.schematic_flip_x.name = Flip Schematic X
|
keybind.schematic_flip_x.name = Flip Schematic X
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ public class Vars implements Loadable{
|
|||||||
public static final float itemSize = 5f;
|
public static final float itemSize = 5f;
|
||||||
/** units outside this bound will die instantly */
|
/** units outside this bound will die instantly */
|
||||||
public static final float finalWorldBounds = 250;
|
public static final float finalWorldBounds = 250;
|
||||||
/** range for building */
|
/** default range for building */
|
||||||
public static final float buildingRange = 220f;
|
public static final float buildingRange = 220f;
|
||||||
/** range for moving items */
|
/** range for moving items */
|
||||||
public static final float itemTransferRange = 220f;
|
public static final float itemTransferRange = 220f;
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ public class BuilderAI extends AIController{
|
|||||||
|
|
||||||
if(valid){
|
if(valid){
|
||||||
//move toward the plan
|
//move toward the plan
|
||||||
moveTo(req.tile(), buildingRange - 20f);
|
moveTo(req.tile(), unit.type.buildRange - 20f);
|
||||||
}else{
|
}else{
|
||||||
//discard invalid plan
|
//discard invalid plan
|
||||||
unit.plans.removeFirst();
|
unit.plans.removeFirst();
|
||||||
@@ -120,7 +120,7 @@ public class BuilderAI extends AIController{
|
|||||||
|
|
||||||
Building build = world.build(plan.x, plan.y);
|
Building build = world.build(plan.x, plan.y);
|
||||||
if(build instanceof ConstructBuild cons){
|
if(build instanceof ConstructBuild cons){
|
||||||
float dist = Math.min(cons.dst(unit) - buildingRange, 0);
|
float dist = Math.min(cons.dst(unit) - unit.type.buildRange, 0);
|
||||||
|
|
||||||
//make sure you can reach the plan in time
|
//make sure you can reach the plan in time
|
||||||
if(dist / unit.speed() < cons.buildCost * 0.9f){
|
if(dist / unit.speed() < cons.buildCost * 0.9f){
|
||||||
|
|||||||
@@ -1467,7 +1467,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when another tile is tapped while this block is selected.
|
* Called when another tile is tapped while this building is selected.
|
||||||
* @return whether this block should be deselected.
|
* @return whether this block should be deselected.
|
||||||
*/
|
*/
|
||||||
public boolean onConfigureBuildTapped(Building other){
|
public boolean onConfigureBuildTapped(Building other){
|
||||||
@@ -1483,7 +1483,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a position is tapped when this building is selected.
|
* Called when a position is tapped while this building is selected.
|
||||||
*
|
*
|
||||||
* @return whether the tap event is consumed - if true, the player will not start shooting or interact with things under the cursor.
|
* @return whether the tap event is consumed - if true, the player will not start shooting or interact with things under the cursor.
|
||||||
* */
|
* */
|
||||||
@@ -1492,7 +1492,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when this block's config menu is closed
|
* Called when this block's config menu is closed.
|
||||||
*/
|
*/
|
||||||
public void onConfigureClosed(){}
|
public void onConfigureClosed(){}
|
||||||
|
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
|
|||||||
@Replace
|
@Replace
|
||||||
public float clipSize(){
|
public float clipSize(){
|
||||||
if(isBuilding()){
|
if(isBuilding()){
|
||||||
return state.rules.infiniteResources ? Float.MAX_VALUE : Math.max(type.clipSize, type.region.width) + buildingRange + tilesize*4f;
|
return state.rules.infiniteResources ? Float.MAX_VALUE : Math.max(type.clipSize, type.region.width) + type.buildRange + tilesize*4f;
|
||||||
}
|
}
|
||||||
if(mining()){
|
if(mining()){
|
||||||
return type.clipSize + type.miningRange;
|
return type.clipSize + type.miningRange;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ public enum Binding implements KeyBind{
|
|||||||
pan(KeyCode.mouseForward),
|
pan(KeyCode.mouseForward),
|
||||||
|
|
||||||
boost(KeyCode.shiftLeft),
|
boost(KeyCode.shiftLeft),
|
||||||
commandMode(KeyCode.shiftLeft),
|
command_mode(KeyCode.shiftLeft),
|
||||||
control(KeyCode.controlLeft),
|
control(KeyCode.controlLeft),
|
||||||
respawn(KeyCode.v),
|
respawn(KeyCode.v),
|
||||||
select(KeyCode.mouseLeft),
|
select(KeyCode.mouseLeft),
|
||||||
|
|||||||
@@ -296,8 +296,8 @@ public class DesktopInput extends InputHandler{
|
|||||||
|
|
||||||
if(!locked && block == null && !scene.hasField() &&
|
if(!locked && block == null && !scene.hasField() &&
|
||||||
//disable command mode when player unit can boost and command mode binding is the same
|
//disable command mode when player unit can boost and command mode binding is the same
|
||||||
!(!player.dead() && player.unit().type.canBoost && keybinds.get(Binding.commandMode).key == keybinds.get(Binding.boost).key)){
|
!(!player.dead() && player.unit().type.canBoost && keybinds.get(Binding.command_mode).key == keybinds.get(Binding.boost).key)){
|
||||||
commandMode = input.keyDown(Binding.commandMode);
|
commandMode = input.keyDown(Binding.command_mode);
|
||||||
}else{
|
}else{
|
||||||
commandMode = false;
|
commandMode = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -254,7 +254,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||||||
|
|
||||||
@Remote(called = Loc.server, targets = Loc.both, forward = true)
|
@Remote(called = Loc.server, targets = Loc.both, forward = true)
|
||||||
public static void requestItem(Player player, Building build, Item item, int amount){
|
public static void requestItem(Player player, Building build, Item item, int amount){
|
||||||
if(player == null || build == null || !build.interactable(player.team()) || !player.within(build, buildingRange) || player.dead()) return;
|
if(player == null || build == null || !build.interactable(player.team()) || !player.within(build, itemTransferRange) || player.dead()) return;
|
||||||
|
|
||||||
if(net.server() && (!Units.canInteract(player, build) ||
|
if(net.server() && (!Units.canInteract(player, build) ||
|
||||||
!netServer.admins.allowAction(player, ActionType.withdrawItem, build.tile(), action -> {
|
!netServer.admins.allowAction(player, ActionType.withdrawItem, build.tile(), action -> {
|
||||||
@@ -270,7 +270,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||||||
|
|
||||||
@Remote(targets = Loc.both, forward = true, called = Loc.server)
|
@Remote(targets = Loc.both, forward = true, called = Loc.server)
|
||||||
public static void transferInventory(Player player, Building build){
|
public static void transferInventory(Player player, Building build){
|
||||||
if(player == null || build == null || !player.within(build, buildingRange) || build.items == null || player.dead()) return;
|
if(player == null || build == null || !player.within(build, itemTransferRange) || build.items == null || player.dead()) return;
|
||||||
|
|
||||||
if(net.server() && (player.unit().stack.amount <= 0 || !Units.canInteract(player, build) ||
|
if(net.server() && (player.unit().stack.amount <= 0 || !Units.canInteract(player, build) ||
|
||||||
!netServer.admins.allowAction(player, ActionType.depositItem, build.tile, action -> {
|
!netServer.admins.allowAction(player, ActionType.depositItem, build.tile, action -> {
|
||||||
|
|||||||
@@ -483,7 +483,7 @@ public class LExecutor{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
case getBlock -> {
|
case getBlock -> {
|
||||||
float range = Math.max(unit.range(), buildingRange);
|
float range = Math.max(unit.range(), unit.type.buildRange);
|
||||||
if(!unit.within(x1, y1, range)){
|
if(!unit.within(x1, y1, range)){
|
||||||
exec.setobj(p3, null);
|
exec.setobj(p3, null);
|
||||||
exec.setobj(p4, null);
|
exec.setobj(p4, null);
|
||||||
|
|||||||
Reference in New Issue
Block a user