generated from Anuken/MindustryJavaModTemplate
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
=
committed
Feb 15, 2024
1 parent
5844bac
commit 7eb1062
Showing
42 changed files
with
383 additions
and
173 deletions.
There are no files selected for viewing
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,29 @@ | ||
package sw.ai; | ||
|
||
import arc.math.*; | ||
import arc.util.*; | ||
import mindustry.entities.part.*; | ||
import mindustry.entities.units.*; | ||
import sw.gen.*; | ||
import sw.type.*; | ||
|
||
public class ShieldAI extends AIController { | ||
public float getRotation() { | ||
if (!(unit instanceof TetherUnitc u) || !(u.tetherUnit() instanceof Shieldedc b) || !(b.type() instanceof SWUnitType type)) return 0f; | ||
if (b.mounts().length > 0) { | ||
WeaponMount first = b.mounts()[0]; | ||
DrawPart.params.set(first.warmup, first.reload / b.type().weapons.first().reload, first.smoothReload, first.heat, first.recoil, first.charge, u.x(), u.y(), u.rotation()); | ||
} else { | ||
DrawPart.params.set(0, 0, 0, 0, 0, 0, u.x(), u.y(), u.rotation()); | ||
} | ||
return Mathf.lerp( | ||
type.shieldStartAng + (b.rotation() - 90 + type.shieldEndAng /(type.shields - 1f) * b.units().indexOf(unit)), | ||
type.shieldShootingStartAng + (b.rotation() - 90 + type.shieldShootingEndAng /(type.shields - 1f) * b.units().indexOf(unit)), | ||
type.shieldProgress.get(DrawPart.params) | ||
); | ||
} | ||
|
||
@Override | ||
public void updateMovement() { | ||
if (unit instanceof TetherUnitc u && u.tetherUnit() != null && u.tetherUnit().type() instanceof SWUnitType type) { | ||
Tmp.v1.trns(getRotation(), type.shieldSeparateRadius); | ||
u.set(Tmp.v1.add(u.tetherUnit())); | ||
u.rotation(u.angleTo(u.tetherUnit()) + 180f); | ||
} | ||
} | ||
// public float getRotation() { | ||
// if (!(unit instanceof TetherUnitc u) || !(u.tetherUnit() instanceof Shieldedc b) || !(b.type() instanceof SWUnitType type)) return 0f; | ||
// if (b.mounts().length > 0) { | ||
// WeaponMount first = b.mounts()[0]; | ||
// DrawPart.params.set(first.warmup, first.reload / b.type().weapons.first().reload, first.smoothReload, first.heat, first.recoil, first.charge, u.x(), u.y(), u.rotation()); | ||
// } else { | ||
// DrawPart.params.set(0, 0, 0, 0, 0, 0, u.x(), u.y(), u.rotation()); | ||
// } | ||
// return Mathf.lerp( | ||
// type.shieldStartAng + (b.rotation() - 90 + type.shieldEndAng /(type.shields - 1f) * b.units().indexOf(unit)), | ||
// type.shieldShootingStartAng + (b.rotation() - 90 + type.shieldShootingEndAng /(type.shields - 1f) * b.units().indexOf(unit)), | ||
// type.shieldProgress.get(DrawPart.params) | ||
// ); | ||
// } | ||
// | ||
// @Override | ||
// public void updateMovement() { | ||
// if (unit instanceof TetherUnitc u && u.tetherUnit() != null && u.tetherUnit().type() instanceof SWUnitType type) { | ||
// Tmp.v1.trns(getRotation(), type.shieldSeparateRadius); | ||
// u.set(Tmp.v1.add(u.tetherUnit())); | ||
// u.rotation(u.angleTo(u.tetherUnit()) + 180f); | ||
// } | ||
// } | ||
} |
Oops, something went wrong.