Starbound
Drop Further Before Damage
Accomplishing this without replacing player_primary.lua
1. Patch a script into /statusControllerSettings/primaryScriptSources/
Something like this

[
{
"op" : "add",
"path" : "/statusControllerSettings/primaryScriptSources/-",
"value" : "/scripts/soopytwist/soopytwist_dropFurther.lua"
}
]

(edited)

2. The script looks something like this

soopytwist_dropFurther = {} soopytwist_dropFurther.applyDamageRequest = applyDamageRequest applyDamageRequest = function(damageRequest) if damageRequest.damageSourceKind == "falling" then local minimumFallDistance = 24 --default was 14 local fallDistanceDamageFactor = 3 local minimumFallVel = 40 local baseGravity = 80 local gravityDiffFactor = 1 / 30.0 local curYPosition = mcontroller.yPosition() local yPosChange = curYPosition - (self.lastYPosition or curYPosition) if self.fallDistance > minimumFallDistance and -self.lastYVelocity > minimumFallVel and mcontroller.onGround() then local damage = (self.fallDistance - minimumFallDistance) * fallDistanceDamageFactor damage = damage * (1.0 + (world.gravity(mcontroller.position()) - baseGravity) * gravityDiffFactor) damage = damage * status.stat("fallDamageMultiplier") damageRequest.damage = damage end end return soopytwist_dropFurther.applyDamageRequest(damageRequest) end

Thus you are compatible with other mods that hook into the player environment. Most likely you would be compatible with future SB updates, otherwise needing only minor changes.
Legutóbb szerkesztette: bk3000; 2017. febr. 24., 11:57
< >
114/14 megjegyzés mutatása
If by chance you have questions about how that works, let me know.
soopytwist  [Fejlesztő] 2017. febr. 24., 8:31 
@bk3000 Woops! I had no idea this was here. When you said you posted in the discusions I thought you were talking about the forum or something. The mod worked, I moved onto other things and figured I'd come back to it when it broke. Well it's broke. Don't understand your instructions though.

You say Patch a script into /statusControllerSettings/primaryScriptSources/ - what directory is this?

I've never used script hooking before, no idea what to do.
Legutóbb szerkesztette: soopytwist; 2017. febr. 24., 8:43
The mentionned patch is supposed to be for the
/player.config
file, the path
/statusControllerSettings/primaryScriptSources/-
is an array of scripts that'll be loaded with the character
soopytwist  [Fejlesztő] 2017. febr. 24., 9:03 
😺 eredeti hozzászólása:
The mentionned patch is supposed to be for the
/player.config
file, the path
/statusControllerSettings/primaryScriptSources/-
is an array of scripts that'll be loaded with the character
Oh, I see. I must be doing something wrong though. The game crashes before the main menu appears.

EDIT

To clarify. I've got player.config.patch in the mod folder. In that is:

{
"op" : "add",
"path" : "/statusControllerSettings/primaryScriptSources/",
"value" : "/scripts/soopytwist/soopytwist_dropFurther.lua"
}

Also in the mod folder is scripts\soopytwist\soopytwist_dropFurther.lua.

In that I have the bk3000's script above.

The game just updated twice, not sure if it's one of my other mods that's broke or what.

Legutóbb szerkesztette: soopytwist; 2017. febr. 24., 9:19
I think you forgot the square brackets in player.config.patch. It should be:

[ { "op" : "add", "path" : "/statusControllerSettings/primaryScriptSources/-", "value" : "/scripts/soopytwist/soopytwist_dropFurther.lua" } ]

Should work by then.
True I didn't add the brackets. I was incorrectly thinking they already has a player.config.patch to add this too but probably was thinking of another mod. oops.

I don't remember if I tested that code or not, but let me know if it has any issues(probably a misCapitalization) then I'll fix them.
Legutóbb szerkesztette: bk3000; 2017. febr. 24., 11:41
soopytwist  [Fejlesztő] 2017. febr. 24., 11:47 
bk3000 eredeti hozzászólása:
True I didn't add the brackets. I was incorrectly thinking they already has a player.config.patch to add this too but probably was thinking of another mod. oops.

I don't remember if I tested that code or not, but let me know if it has any issues(probably a misCapitalization) then I'll fix them.
Ah, yes of course. Okay the game isn't crashing now so it's running the fall damage script but I'm still losing health when dropping from the E.A.S.E.L platform. The game got patched twice earlier - not sure if this has broken something.
Legutóbb szerkesztette: soopytwist; 2017. febr. 24., 11:48
Oh I noticed something "wonderful". If you copy/paste from this page, it all gets messed up!
I'll pastebin it.
I also need to do the latest update, and unpack to make sure.
After actually trying out my code on the (almost latest) nightly, it is close. I take 7 damage(very little) jumping from the easle area. So maybe just some minor math adjustment.
Wait there really is something wrong with that. I wasn't thinking clearly LOL.

This only gets called on damage. So it won't be able to compare from previous positions!
My bad. Have to think up something better.

Probably something involving mcontroller.velocity

Probably you'll need to do it the old way for now.
Legutóbb szerkesztette: bk3000; 2017. febr. 24., 12:13
soopytwist  [Fejlesztő] 2017. febr. 24., 12:17 
Okay, I can't be doing with this jumping back and fourth from the comments to the discussion. Lets just stick to the discussion. See my comments for an update - think I made it worse.
soopytwist  [Fejlesztő] 2017. febr. 24., 12:19 
The game got two updates today (for me anyway) yet the packed.pak is still dated 18th Jan which I already have unpacked.
I think I figured out a clean way. I'll hook the tail end of update.
Store those values under the storage table
Then I can access them in applyDamageRequest

Then it should work.

I'll let you know when I have TESTED that it does, and pastebin the script.
Legutóbb szerkesztette: bk3000; 2017. febr. 24., 12:27
< >
114/14 megjegyzés mutatása
Laponként: 1530 50