Skip to content

Commit

Permalink
praise be gutin for all my problems are fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Crystalzzzz committed Oct 23, 2023
1 parent 51fbbb0 commit 3b5d1c2
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 18 deletions.
4 changes: 2 additions & 2 deletions run/config/waterfall/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,16 @@ log_pings: true
connection_throttle_limit: 3
server_connect_timeout: 5000
timeout: 30000
stats: 797aab79-2230-4340-be83-926d44fb400c
player_limit: -1
prevent_proxy_connections: false
ip_forward: true
groups:
md_5:
- admin
remote_ping_timeout: 5000
connection_throttle: 4000
log_commands: false
stats: 797aab79-2230-4340-be83-926d44fb400c
prevent_proxy_connections: false
online_mode: true
forge_support: true
disabled_commands:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ data class BalancingConfiguration(
val quadTurret: StarshipWeapon = StarshipWeapon(
range = 500.0,
speed = 80.0,
shieldDamageMultiplier = 7,
shieldDamageMultiplier = 6,
thickness = 0.0,
particleThickness = 0.6,
explosionPower = 4.5f,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import net.horizonsend.ion.server.features.starship.subsystem.weapon.interfaces.
import net.horizonsend.ion.server.features.starship.subsystem.weapon.interfaces.ManualWeaponSubsystem
import net.horizonsend.ion.server.features.starship.subsystem.weapon.interfaces.StarshipCooldownSubsystem
import org.bukkit.util.Vector
import java.util.concurrent.ThreadLocalRandom


object StarshipWeapons {
interface QueuedShot {
Expand Down Expand Up @@ -56,14 +58,14 @@ object StarshipWeapons {
ship.debug("we have heavy weapons")

val heavyWeaponTypes =
queuedShots.filter { it.weapon is HeavyWeaponSubsystem }.map { it.weapon.name }.distinct()
queuedShots.filter { it.weapon is HeavyWeaponSubsystem }.map { it.weapon.name }.distinct()

ship.debug("heavyWeaponTypes = ${heavyWeaponTypes.joinToString(", ")}")

if (heavyWeaponTypes.count() > 1) {
ship.onlinePassengers.forEach { player ->
player.userErrorActionMessage(
"You can only fire one type of heavy weapon at a time!"
"You can only fire one type of heavy weapon at a time!"
)
}

Expand All @@ -74,16 +76,25 @@ object StarshipWeapons {
ship.debug("heavyWeaponType = $heavyWeaponType")

val newWarmup = queuedShots
.filter { it.weapon is HeavyWeaponSubsystem }
.maxOf { (it.weapon as HeavyWeaponSubsystem).boostChargeNanos }
.filter { it.weapon is HeavyWeaponSubsystem }
.maxOf { (it.weapon as HeavyWeaponSubsystem).boostChargeNanos }
ship.debug("newWarmup = $newWarmup")
val output = ship.reactor.heavyWeaponBooster.boost(heavyWeaponType, newWarmup)
ship.debug("output = $output")
boostPower.set(output)
}

val firedCounts = HashMultimap.create<String, WeaponSubsystem>()
for (shot in queuedShots.sortedBy { it.weapon.lastFire }) {

for (shot in queuedShots.shuffled(ThreadLocalRandom.current())) {
if (shot.weapon is StarshipCooldownSubsystem) {
val clazz = shot.weapon::class.java

for (subsystem in ship.subsystems.filterIsInstance(clazz)) {
subsystem.lastFire = System.nanoTime()
}
}

val weapon = shot.weapon

val maxPerShot = weapon.getMaxPerShot()
Expand All @@ -94,14 +105,6 @@ object StarshipWeapons {
if (maxPerShot != null && firedSet.size >= maxPerShot) {
ship.debug("we did, goodbye (${firedSet.size}, $maxPerShot)")

if (shot.weapon is StarshipCooldownSubsystem) {
val clazz = shot.weapon::class.java

for (subsystem in ship.subsystems.filterIsInstance(clazz)) {
subsystem.lastFire = System.nanoTime()
}
}

continue
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class LightTurretWeaponSubsystem(
target: Vector,
) {
if (starship.initialBlockCount > 12000) {
shooter.userError("You can't fire light turrets on a ship smaller than 12000 blocks!")
starship.userError("You can't fire light turrets on a ship larger than 12000 blocks!")
return
}
super.manualFire(shooter, dir, target)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class QuadTurretWeaponSubsystem(
target: Vector,
) {
if (starship.initialBlockCount < 16000) {
shooter.userError("You can't fire quad turrets on a ship smaller than 16000 blocks!")
starship.userError("You can't fire quad turrets on a ship smaller than 16000 blocks!")
return
}
super.manualFire(shooter, dir, target)
Expand Down

0 comments on commit 3b5d1c2

Please sign in to comment.