Wayward

Wayward

Wayward Mods
Make a new creature! Make a new item! Make a troposphere! Your imagination is the only limit with Wayward Mods on Steam Workshop.
Learn More
RawCode 1 2 Sep, 2017 @ 10:30pm
Internals\implementation access (without RE ofc)
well, trying to change max weight without changing max HP is tricky thing and field holding maxweight is not visible via API.

how to play around it without actually performing RE over game?
< >
Showing 1-7 of 7 comments
Drathy  [developer] 10 2 Sep, 2017 @ 10:45pm 
Not quite sure what you after, but you can modify weight using the onUpdateWeight hook: https://waywardgame.github.io/classes/mod.html#onupdateweight

There's a mod that uses it here to increase the player's weight limit: https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=863290994
RawCode 1 2 Sep, 2017 @ 11:40pm 
provided hook and provided modification play around CURRENT weight

onUpdateWeight(newWeight) {
if (this.data.playerWeight && this.data.playerWeight !== 100) {
return Math.ceil(newWeight / (this.data.playerWeight / 100));
}
}

current weight exposed via API and there is no real need of this hook, you can alter weight before\after turn complete

i want access to max weight and information about exact implementation \ formula.

in addition looks like there is no way to disable or alter overweight damage calculation or overweight slowdown directly, there are no events and no flags.
Amax 16 3 Sep, 2017 @ 12:30am 
What's RE?

Reverse engineering?

There is a playerWeightBonus but I'm not sure how to use it, or if it's exactly what you want.
RawCode 1 3 Sep, 2017 @ 1:01am 
playerWeightBonus is external constant, it will be inlined at runtime and cannot be changed.

developer reply my review with command, that obviously utilize nonpublic part of API, i want that nonpublic part.
Drathy  [developer] 10 3 Sep, 2017 @ 1:56am 
Ah, gotcha. Looks like there was some recent changes that switched this a bit. I'll revert them so it's easy to access again, but for now, onUpdateWeight, modifying item weights, or doing localPlayer.weight modifications on turn passes would be the way to go. You can technically still access and modify it, but it probably would be a headache since it's in a define().
RawCode 1 3 Sep, 2017 @ 2:12am 
sadly, lp.weight provide access to current weight, not maxweight and almost useless for my task, i want to provide "unlimited" inventory and still show player, weight of his inventory.
with different kind of drawbacks on getting too much items.

probably using negative weight is only way around hardcoded slowdown on overweight, can't see other way to still display weight.
Drathy  [developer] 10 3 Sep, 2017 @ 2:26am 
I just pushed a developer branch update that adds back the
localPlayer.weightBonus
functionality from before. Info on how to switch to the developer branch here:

https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=721479594
As for the other hooks you might be after, I'll add a todo for adding all the weight hooks. We typically add hooks as modders/players request them as the codebase changes so rapidly, it costs quite a bit of time maintaining and testing them.

Luckily, even though the weight checks are hardcoded at the moment, they can be modified easily via console/modding and just redefine them to your liking. Here's likely the functions you are after (all accessed via localPlayer.):

// Check the players weight and slow them down and reduce stamina if over burdened public checkWeight() { const movementPenalty = this.getWeightPenalty(); const weightStatus = this.getWeightStatus(); // Overweight if (weightStatus === WeightStatus.Overweight) { ui.displayHint(this, HintType.Encumberance); ui.displayMessage(this, Message.CarryingTooMuchWeight, MessageType.Bad); this.stats.stamina.value -= Math.round((this.weight - this.strength) / 2); this.shakeStat(StatType.Stamina); multiplayer.addSyncCheck(MultiplayerSyncCheck.StaminaChanges, this.stats.stamina.value); } else if (weightStatus === WeightStatus.Encumbered) { // Encumbered ui.displayHint(this, HintType.Encumberance); } if (movementPenalty >= 1) { this.addDelay(movementPenalty); } } public getWeightStatus(): WeightStatus { let weightStatus = WeightStatus.None; if (this.weight > this.strength + this.weightBonus) { weightStatus = WeightStatus.Overweight; } else if (this.weight > (this.strength + this.weightBonus) * 0.9) { weightStatus = WeightStatus.Encumbered; } return weightStatus; } public getWeightPenalty(): number { const weightStatus = this.getWeightStatus(); let movementPenalty: number = 0; // Overweight if (weightStatus === WeightStatus.Overweight || weightStatus === WeightStatus.Encumbered) { movementPenalty = Math.min(Math.ceil((this.weight - (this.strength + this.weightBonus) * 0.9) / 2) + movementPenalty, Delay.LongPause); } return movementPenalty; }
Last edited by Drathy; 3 Sep, 2017 @ 2:29am
< >
Showing 1-7 of 7 comments
Per page: 1530 50