mirror of
https://github.com/yawaflua/Informatis.git
synced 2025-12-10 12:09:27 +02:00
fixed bug
This commit is contained in:
@@ -54,8 +54,8 @@ setting.softRangeOpacity.name = Soft Range Opacity
|
||||
setting.softRangeOpacity.description = use the slider to set opacity of soft range.
|
||||
setting.rangeRadius.name = Near Range Margin
|
||||
setting.rangeRadius.description = set additional distances to show range.
|
||||
setting.allTeamRange.name = Display Team Range
|
||||
setting.allTeamRange.description = toggle to display all teams' range.
|
||||
setting.allTeamRange.name = Display Player Team Range
|
||||
setting.allTeamRange.description = toggle to display player team's range.
|
||||
setting.allTargetRange.name = Display All Target Range
|
||||
setting.allTargetRange.description = toggle to display all range whatever airTarget or groundTarget etc.
|
||||
|
||||
@@ -70,7 +70,8 @@ setting.shar1.name = Change Bar Style [lightgray](made by shar)[]
|
||||
setting.shar2.name = Change Bar Style [lightgray](made by shar)[]
|
||||
setting.shar3.name = Change Bar Style [lightgray](made by shar)[]
|
||||
setting.gaycursor.name = Enable Mouse Trail Effect [lightgray](only for desktop)[]
|
||||
setting.allTeam.name = Display all teams' item
|
||||
setting.allTeam.name = Display all teams' info on item tap
|
||||
setting.deadTarget.name = save locked target even if it's dead
|
||||
|
||||
#Dialog
|
||||
editmaxwave = Edit Waves(int)
|
||||
|
||||
@@ -48,8 +48,8 @@ setting.softRangeOpacity.name = 부드러운 사거리 투명도
|
||||
setting.softRangeOpacity.description = 슬라이더로 부드러운 사거리 투명도를 조절합니다.
|
||||
setting.rangeRadius.name = 사거리 접근 거리
|
||||
setting.rangeRadius.description = 사거리를 표시할 추가 거리를 설정합니다.
|
||||
setting.allTeamRange.name = 팀 사거리 표시
|
||||
setting.allTeamRange.description = 모든 팀의 사거리를 표시합니다.
|
||||
setting.allTeamRange.name = 플레이어 팀 사거리 표시
|
||||
setting.allTeamRange.description = 플레이어 팀의 사거리를 표시합니다.
|
||||
setting.allTargetRange.name = 모든 목표물 사거리 표시
|
||||
setting.allTargetRange.description = 지상 공중 상관없이 모든 사거리를 표시합니다.
|
||||
|
||||
@@ -72,7 +72,8 @@ setting.shar1.name = 바 스타일 변경 [lightgray](shar 만듬)[]
|
||||
setting.shar2.name = 바 스타일 변경 [lightgray](shar 만듬)[]
|
||||
setting.shar3.name = 바 스타일 변경 [lightgray](shar 만듬)[]
|
||||
setting.gaycursor.name = 마우스 꼬리효과 [lightgray](PC 전용)[]
|
||||
setting.allTeam.name = 모든 팀 자원 표시
|
||||
setting.allTeam.name = 자원 탭에 모든 팀 표시
|
||||
setting.deadTarget.name = 고정 목표물이 죽더라도 계속 고정하기
|
||||
|
||||
#Dialog
|
||||
editmaxwave = 최대 단계 수정하기(정수)
|
||||
|
||||
@@ -75,28 +75,30 @@ public class HudUi {
|
||||
|
||||
@Nullable Teamc target;
|
||||
|
||||
public Seq<MassDriver.MassDriverBuild> linkedMasses = new Seq<>();
|
||||
public Seq<Building> linkedNodes = new Seq<>();
|
||||
Seq<MassDriver.MassDriverBuild> linkedMasses = new Seq<>();
|
||||
Seq<Building> linkedNodes = new Seq<>();
|
||||
|
||||
boolean remoteChanged = false;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T extends Teamc> T getTarget(){
|
||||
if(locked &&
|
||||
(lockedTarget instanceof Unit u && u.dead) ||
|
||||
(lockedTarget instanceof Building b && b.dead)) {
|
||||
if(locked && lockedTarget != null) {
|
||||
if(settings.getBool("deadTarget") && !Groups.all.contains(e -> e == lockedTarget)) {
|
||||
lockedTarget = null;
|
||||
locked = false;
|
||||
}
|
||||
if(locked && lockedTarget != null)
|
||||
return (T) lockedTarget; //if there is locked target, return it first.
|
||||
else return (T) lockedTarget; //if there is locked target, return it first.
|
||||
}
|
||||
|
||||
Seq<Unit> units = Groups.unit.intersect(Core.input.mouseWorldX(), Core.input.mouseWorldY(), 4, 4); // well, 0.5tile is enough to search them........ maybe?
|
||||
|
||||
Seq<Unit> units = Groups.unit.intersect(Core.input.mouseWorldX(), Core.input.mouseWorldY(), 4, 4); // well, 0.5tile is enough to search them
|
||||
if(units.size > 0)
|
||||
return (T) units.peek(); //if there is unit, return it.
|
||||
else if(getTile() != null && getTile().build != null)
|
||||
return (T) getTile().build; //if there isn't unit but there is build, return it.
|
||||
else if(player.unit() instanceof BlockUnitUnit b && b.tile() != null)
|
||||
return (T)b.tile();
|
||||
return (T) player.unit(); //if there are not unit and not build, return player.
|
||||
return (T) player.unit(); //if there aren't unit and not build, return player.
|
||||
}
|
||||
|
||||
public @Nullable Tile getTile(){
|
||||
@@ -176,6 +178,11 @@ public class HudUi {
|
||||
}
|
||||
public void setEvent(){
|
||||
Events.run(EventType.Trigger.draw, () -> {
|
||||
if(locked && lockedTarget instanceof Healthc u && u.dead()) {
|
||||
lockedTarget = null;
|
||||
locked = false;
|
||||
}
|
||||
|
||||
if(getTarget() instanceof MassDriver.MassDriverBuild mass){
|
||||
linkedMasses.clear();
|
||||
drawMassLink(mass);
|
||||
@@ -185,81 +192,126 @@ public class HudUi {
|
||||
drawNodeLink(node);
|
||||
}
|
||||
|
||||
if(getTarget() == null || !Core.settings.getBool("select")) return;
|
||||
|
||||
if(getTarget() != null && Core.settings.getBool("select")) {
|
||||
Posc entity = getTarget();
|
||||
for(int i = 0; i < 4; i++){
|
||||
float rot = i * 90f + 45f + (-Time.time) % 360f;
|
||||
float length = (entity instanceof Unit ? ((Unit)entity).hitSize : entity instanceof Building ? ((Building)entity).block.size * tilesize : 0) * 1.5f + 2.5f;
|
||||
Draw.color(Tmp.c1.set(locked ? Color.orange : Color.darkGray).lerp(locked ? Color.scarlet : Color.gray, Mathf.absin(Time.time, 2f, 1f)).a(settings.getInt("selectopacity") / 100f));
|
||||
Draw.rect("select-arrow", entity.x() + Angles.trnsx(rot, length), entity.y() + Angles.trnsy(rot, length), length / 1.9f, length / 1.9f, rot - 135f);
|
||||
Draw.reset();
|
||||
}
|
||||
if(player.unit() != null && getTarget() != player.unit()) {
|
||||
Teamc from = player.unit();
|
||||
Teamc to = getTarget();
|
||||
float sin = Mathf.absin(Time.time, 6f, 1f);
|
||||
if(player.unit() instanceof BlockUnitUnit bu) Tmp.v1.set(bu.x() + bu.tile().block.offset, bu.y() + bu.tile().block.offset).sub(to.x(), to.y()).limit(bu.tile().block.size * tilesize + sin + 0.5f);
|
||||
else Tmp.v1.set(from.x(), from.y()).sub(to.x(), to.y()).limit(player.unit().hitSize / tilesize + sin + 0.5f);
|
||||
|
||||
float x2 = from.x() - Tmp.v1.x, y2 = from.y() - Tmp.v1.y,
|
||||
x1 = to.x() + Tmp.v1.x, y1 = to.y() + Tmp.v1.y;
|
||||
int segs = (int) (to.dst(from.x(), from.y()) / tilesize);
|
||||
|
||||
Lines.stroke(4f, Pal.gray);
|
||||
Lines.dashLine(x1, y1, x2, y2, segs);
|
||||
Lines.stroke(2f, Pal.placing);
|
||||
Lines.dashLine(x1, y1, x2, y2, segs);
|
||||
Lines.stroke(1f, Pal.accent);
|
||||
}
|
||||
};
|
||||
|
||||
Draw.reset();
|
||||
});
|
||||
|
||||
Events.on(EventType.ResetEvent.class, e -> {
|
||||
if(settings.getBool("allTeam")) coreItems.teams = Team.all;
|
||||
else coreItems.teams = Team.baseTeams;
|
||||
coreItems.resetUsed();
|
||||
coreItems.tables.each(Group::clear);
|
||||
});
|
||||
|
||||
Events.run(EventType.Trigger.update, ()->{
|
||||
if((Core.input.keyDown(KeyCode.shiftRight) || Core.input.keyDown(KeyCode.shiftLeft)) && Core.input.keyTap(KeyCode.r)){
|
||||
lockButton.change();
|
||||
if((input.keyDown(KeyCode.shiftRight) || input.keyDown(KeyCode.shiftLeft))){
|
||||
if(input.keyTap(KeyCode.r)) lockButton.change();
|
||||
else if(input.keyTap(KeyCode.num1)) {
|
||||
remoteChanged = true;
|
||||
uiIndex = 0;
|
||||
}
|
||||
if(!settings.getBool("autoShooting")) return;
|
||||
else if(input.keyTap(KeyCode.num2)) {
|
||||
remoteChanged = true;
|
||||
uiIndex = 1;
|
||||
}
|
||||
else if(input.keyTap(KeyCode.num3)) {
|
||||
remoteChanged = true;
|
||||
uiIndex = 2;
|
||||
}
|
||||
else if(input.keyTap(KeyCode.num4)) {
|
||||
remoteChanged = true;
|
||||
uiIndex = 3;
|
||||
}
|
||||
else if(input.keyTap(KeyCode.num5)) {
|
||||
remoteChanged = true;
|
||||
uiIndex = 4;
|
||||
}
|
||||
else if(input.keyTap(KeyCode.num6)) {
|
||||
remoteChanged = true;
|
||||
uiIndex = 5;
|
||||
}
|
||||
}
|
||||
|
||||
if(settings.getBool("autoShooting")) {
|
||||
Unit unit = player.unit();
|
||||
if(unit.type == null) return;
|
||||
if (unit.type == null) return;
|
||||
boolean omni = unit.type.omniMovement;
|
||||
boolean validHealTarget = unit.type.canHeal && target instanceof Building && ((Building)target).isValid() && target.team() == unit.team && ((Building)target).damaged() && target.within(unit, unit.type.range);
|
||||
boolean validHealTarget = unit.type.canHeal && target instanceof Building && ((Building) target).isValid() && target.team() == unit.team && ((Building) target).damaged() && target.within(unit, unit.type.range);
|
||||
boolean boosted = (unit instanceof Mechc && unit.isFlying());
|
||||
if((unit.type != null && Units.invalidateTarget(target, unit, unit.type.range) && !validHealTarget) || state.isEditor()){
|
||||
if ((unit.type != null && Units.invalidateTarget(target, unit, unit.type.range) && !validHealTarget) || state.isEditor()) {
|
||||
target = null;
|
||||
}
|
||||
|
||||
|
||||
float mouseAngle = unit.angleTo(unit.aimX(), unit.aimY());
|
||||
boolean aimCursor = omni && player.shooting && unit.type.hasWeapons() && unit.type.faceTarget && !boosted && unit.type.rotateShooting;
|
||||
if(aimCursor){
|
||||
if (aimCursor) {
|
||||
unit.lookAt(mouseAngle);
|
||||
}else{
|
||||
} else {
|
||||
unit.lookAt(unit.prefRotation());
|
||||
}
|
||||
|
||||
//update shooting if not building + not mining
|
||||
if(!player.unit().activelyBuilding() && player.unit().mineTile == null){
|
||||
if (!player.unit().activelyBuilding() && player.unit().mineTile == null) {
|
||||
//autofire targeting
|
||||
if(input.keyDown(KeyCode.mouseLeft)) {
|
||||
if (input.keyDown(KeyCode.mouseLeft)) {
|
||||
player.shooting = !boosted;
|
||||
unit.aim(player.mouseX = Core.input.mouseWorldX(), player.mouseY = Core.input.mouseWorldY());
|
||||
} else if(target == null){
|
||||
} else if (target == null) {
|
||||
player.shooting = false;
|
||||
if(unit instanceof BlockUnitUnit b){
|
||||
if(b.tile() instanceof ControlBlock c && !c.shouldAutoTarget()){
|
||||
if (unit instanceof BlockUnitUnit b) {
|
||||
if (b.tile() instanceof ControlBlock c && !c.shouldAutoTarget()) {
|
||||
Building build = b.tile();
|
||||
float range = build instanceof Ranged ? ((Ranged)build).range() : 0f;
|
||||
float range = build instanceof Ranged ? ((Ranged) build).range() : 0f;
|
||||
boolean targetGround = build instanceof Turret.TurretBuild && ((Turret) build.block).targetAir;
|
||||
boolean targetAir = build instanceof Turret.TurretBuild && ((Turret) build.block).targetGround;
|
||||
target = Units.closestTarget(build.team, build.x, build.y, range, u -> u.checkTarget(targetAir, targetGround), u -> targetGround);
|
||||
}
|
||||
else target = null;
|
||||
} else if(unit.type != null){
|
||||
} else target = null;
|
||||
} else if (unit.type != null) {
|
||||
float range = unit.hasWeapons() ? unit.range() : 0f;
|
||||
target = Units.closestTarget(unit.team, unit.x, unit.y, range, u -> u.checkTarget(unit.type.targetAir, unit.type.targetGround), u -> unit.type.targetGround);
|
||||
|
||||
if(unit.type.canHeal && target == null){
|
||||
if (unit.type.canHeal && target == null) {
|
||||
target = Geometry.findClosest(unit.x, unit.y, indexer.getDamaged(Team.sharded));
|
||||
if(target != null && !unit.within(target, range)){
|
||||
if (target != null && !unit.within(target, range)) {
|
||||
target = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
player.shooting = !boosted;
|
||||
unit.rotation(Angles.angle(unit.x, unit.y, target.x(), target.y()));
|
||||
unit.aim(target.x(), target.y());
|
||||
}
|
||||
}
|
||||
unit.controlWeapons(player.shooting && !boosted);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -302,6 +354,10 @@ public class HudUi {
|
||||
Seq<Button> buttons = Seq.with(null, null, null, null, null, null);
|
||||
Seq<String> strs = Seq.with("hud.unit", "hud.wave", "hud.core", "hud.tile", "hud.item", "hud.cancel");
|
||||
Seq<TextureRegionDrawable> icons = Seq.with(Icon.units, Icon.fileText, Icon.commandRally, Icon.grid, Icon.copy, Icon.cancel);
|
||||
if(remoteChanged){
|
||||
reset(uiIndex, buttons, label, table, labelTable, strs.get(uiIndex));
|
||||
remoteChanged = false;
|
||||
}
|
||||
for(int i = 0; i < buttons.size; i++){
|
||||
int finalI = i;
|
||||
buttons.set(i, t.button(icons.get(i), Styles.clearToggleTransi, () -> {
|
||||
|
||||
@@ -97,7 +97,7 @@ public class Main extends Mod {
|
||||
Team team = player.team();
|
||||
Unit unit = player.unit();
|
||||
Groups.build.each(e -> {
|
||||
if(e.team == team) return; // Don't draw own turrets
|
||||
if(!settings.getBool("allTeamRange") && e.team == team) return; // Don't draw own turrets
|
||||
if(!(e instanceof BaseTurret.BaseTurretBuild)) return; // Not a turret
|
||||
if((e instanceof Turret.TurretBuild t && !t.hasAmmo()) || !e.cons.valid()) return; // No ammo
|
||||
|
||||
@@ -120,12 +120,13 @@ public class Main extends Mod {
|
||||
|
||||
// Unit Ranges (Only works when turret ranges are enabled)
|
||||
if(settings.getBool("unitRange")) {
|
||||
Groups.unit.each(u -> u.team == team, u -> { // Don't draw own units
|
||||
Groups.unit.each(u -> {
|
||||
if(!settings.getBool("allTeamRange") && u.team == team) return; // Don't draw own units
|
||||
boolean canHit = unit.isFlying() ? u.type.targetAir : u.type.targetGround;
|
||||
float range = u.range();
|
||||
float max = range + settings.getInt("rangeRadius") * tilesize;
|
||||
|
||||
if(Vars.player.dst(u) <= range + settings.getInt("rangeRadius") * tilesize) { // TODO: Store value of rangeRadius as an int, should increase performance
|
||||
if(Vars.player.dst(u) <= max) { // TODO: Store value of rangeRadius as an int, should increase performance
|
||||
if (canHit || settings.getBool("allTargetRange")) // Same as above
|
||||
if(settings.getBool("softRangeDrawing")){
|
||||
Lines.stroke(1, Tmp.c1.set(canHit ? u.team.color : Team.derelict.color).a(0.5f));
|
||||
|
||||
@@ -293,14 +293,14 @@ public class SettingS {
|
||||
addGraphicCheckSetting("emptywave", true);
|
||||
addGraphicCheckSetting("scan", false);
|
||||
addGraphicSlideSetting("rangemax", 10, 0, 100, 1, s -> s + "tiles");
|
||||
addGraphicCheckSetting("coreRange", true);
|
||||
addGraphicCheckSetting("coreRange", false);
|
||||
addGraphicCheckSetting("rangeNearby", true);
|
||||
addGraphicCheckSetting("allTeamRange", false);
|
||||
addGraphicCheckSetting("allTargetRange", false);
|
||||
addGraphicCheckSetting("unitRange", false);
|
||||
addGraphicCheckSetting("softRangeDrawing", false);
|
||||
addGraphicCheckSetting("softRangeDrawing", true);
|
||||
addGraphicSlideSetting("softRangeOpacity", 10, 0, 25, 1, s -> s + "%");
|
||||
addGraphicSlideSetting("rangeRadius", 5, 0, 20, 1, s -> s + "tiles");
|
||||
addGraphicSlideSetting("rangeRadius", 15, 0, 20, 1, s -> s + "tiles");
|
||||
addGraphicSlideSetting("selectopacity", 50, 0, 100, 5, s -> s + "%");
|
||||
addGraphicSlideSetting("baropacity", 50, 0, 100, 5, s -> s + "%");
|
||||
addGraphicSlideSetting("uiopacity", 50, 0, 100, 5, s -> s + "%");
|
||||
@@ -317,5 +317,6 @@ public class SettingS {
|
||||
addGraphicCheckSetting("shar3", false);
|
||||
addGraphicCheckSetting("gaycursor", false);
|
||||
addGraphicCheckSetting("allTeam", false);
|
||||
addGraphicCheckSetting("deadTarget", false);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user