Skip to content

Commit ed439cb

Browse files
Merge pull request #357 from millennIumAMbiguity/1.18.x/main
changed mass scaling (0.5x) and added config.
2 parents a64783d + 500194d commit ed439cb

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

common/src/main/kotlin/org/valkyrienskies/eureka/EurekaConfig.kt

+3
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ object EurekaConfig {
6767
@JsonSchema(description = "The maximum amount extra each floater will multiply the buoyant force by, irrespective of mass")
6868
var maxFloaterBuoyantFactor = 1.0
6969

70+
@JsonSchema(description = "how much the mass decreases the speed.")
71+
var speedMassScale = 5.0
72+
7073
// The velocity any ship at least can move at.
7174
@JsonSchema(description = "The speed a ship with no engines can move at")
7275
var baseSpeed = 3.0

common/src/main/kotlin/org/valkyrienskies/eureka/ship/EurekaShipControl.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ class EurekaShipControl : ShipForcesInducer, ServerTickListener {
289289
// Player controlled forward and backward thrust
290290
private fun getPlayerForwardVel(control: ControlData, physShip: PhysShipImpl): Vector3d {
291291

292-
val mass10 = physShip.inertia.shipMass * 10
292+
val scaledMass = physShip.inertia.shipMass * EurekaConfig.SERVER.speedMassScale
293293
val vel: Vector3dc = physShip.poseVel.vel
294294

295295
// region Player controlled forward and backward thrust
@@ -311,7 +311,7 @@ class EurekaShipControl : ShipForcesInducer, ServerTickListener {
311311

312312
// This is the speed that the ship is always allowed to go out, without engines
313313
val baseForwardVel = Vector3d(forwardVector).mul(EurekaConfig.SERVER.baseSpeed)
314-
val forwardForce = Vector3d(baseForwardVel).sub(velOrthogonalToPlayerUp).mul(mass10)
314+
val forwardForce = Vector3d(baseForwardVel).sub(velOrthogonalToPlayerUp).mul(scaledMass)
315315

316316
if (extraForceLinear != 0.0) {
317317
// engine boost
@@ -320,7 +320,7 @@ class EurekaShipControl : ShipForcesInducer, ServerTickListener {
320320

321321
// This is the maximum speed we want to go in any scenario (when not sprinting)
322322
val idealForwardVel = Vector3d(forwardVector).mul(EurekaConfig.SERVER.maxCasualSpeed)
323-
val idealForwardForce = Vector3d(idealForwardVel).sub(velOrthogonalToPlayerUp).mul(mass10)
323+
val idealForwardForce = Vector3d(idealForwardVel).sub(velOrthogonalToPlayerUp).mul(scaledMass)
324324

325325
val extraForceNeeded = Vector3d(idealForwardForce).sub(forwardForce)
326326
forwardForce.fma(min(extraForceLinear / extraForceNeeded.length(), 1.0), extraForceNeeded)

0 commit comments

Comments
 (0)