[1.3] [KV] Change Dresser [ModSync RW]

Started by Kiame, May 14, 2018, 01:52:16 AM

Previous topic - Next topic

Kiame

I know that bug existed at an earlier point. Are you using the latest version of the mod and if on B18 the BETA version?

Ncates1234

Huh... I thought I had the latest version, apparently not. Works fine now. Sorry for the trouble.

Canute

Damn Kiame made so much work with Modsync lately and then people don't use it ! :-(

Kiame

Quote from: Ncates1234 on July 03, 2018, 11:48:07 AM
Huh... I thought I had the latest version, apparently not. Works fine now. Sorry for the trouble.

No worries. Sorry for the trouble with that bug  :(

Kiame

Quote from: Canute on July 03, 2018, 12:03:59 PM
Damn Kiame made so much work with Modsync lately and then people don't use it ! :-(

To be fair the original ModSync didnt catch on. Hopefully over time the new on will  :)

Syrchalis

Okay, this is going to be nitpicky as hell but... the mending "ticks" very very rarely (once an hour?) and the variable you gave us (me =P) multiplies the mending % each tick. So if I say 5x mending speed it still ticks every hour, but for 5% instead of 1%.

Not sure if possible, but could you rather divide the interval by the mending speed from the config than multiply the %? Would make it go smoother and e.g. a 99% clothing would be done a lot faster. In other words, it mends 1% regardless of config, but if it's x5 then it just mends 5x as often.

If there is any reasons to not do this (CPU, bad interactions etc.) it's fine, I'm just being nitpicky. Either way your thread is on the frontpage again, so at least you get something out of my nitpickyness
For mod support visit the steam pages of my mods, Github or if necessary, write me a PM on Discord. Usually you will find the best help in #troubleshooting in the RimWorld discord.

Kiame

#51
It's mainly how the base game's timing works and concern with cpu usage. Balance is also a concern.

It was way too fast with the other timing options and it was just easier to do the longer ticks. It can also be expensive to find the next apparel to mend depending on how many apparel are stored. It is a linear expense so i am probably worrying too much.

A way to imagine it would be "the attachment is a black box. It takes an hour to do anything"

I can take a second look at it though

Syrchalis

Oh how I imagine it is no issue. I play with dev mode on, so my immersion must be pretty strong anyway haha. (Doesn't mean I use it to cheat... more like to fix bugs which happen a lot due to mods just being updated and Rimworld itself being rather unstable).

It's more about efficiency and not having to wait like an hour or two for the 99% weapon/gear to get 1% and then wait another hour until the next starts mending.
For mod support visit the steam pages of my mods, Github or if necessary, write me a PM on Discord. Usually you will find the best help in #troubleshooting in the RimWorld discord.

Kiame

#53
Update: Added a new setting "Seconds Between Ticks" to go along with the renamed setting "HP Per Tick"

Example:
"Seconds Between Ticks" = 5.5
"HP Per Tick" = 2
Means: Every five and a half seconds, mend apparel two HP

In-depth dive into how this works
After some more trial an error these are the bounds i have to work with in regards to base game tick/update intervals:

  • Normal (1/60 of a second (every frame) between updates)
  • Rare (~4 sec between updates)
  • Long (~30 sec between updates)

Previous I was using Long for update intervals.

In this update I now use Normal. This allows a much larger range of update intervals - i've set a min/max of 0.25/120. I'm not worried about any logic in this part of the code being too expensive.

The part I am concerned about is when apparel is searched for to be repaired/mended as it will search through all stored apparel in the attached dresser which can become expensive especially when it's done 60 times a second. To this end i added another tracker which will only allow a search for apparel/weapons to be mended/repaired to every 30 seconds.

sudo code:

Apparel being mended
...
...
Apparel done, store apparel
<if apparel hasn't been searched for in the last 30 seconds>
    Search for next apparel
    <if found>
        apparel being mended (go to top)
<if `hasn't been 30 seconds` or `no apparel found`>
    wait the remainder of the 30 seconds then search again for apparel to mend


Note: All references to Weapons refer to another mod of mine called Weapon Storage

Syrchalis

My nitpickyness has been satisfied, thanks.

And maybe it actually improves you mod more than one might think. When I started using your mod a year ago or so I always hated the mending attachment because it was so slow, power hungry and you just couldn't see any effect, only after checking after a few minutes.

With this maybe others will feel that it's actually pretty decent at repairing stuff if you choose fair values (not too high lol).
For mod support visit the steam pages of my mods, Github or if necessary, write me a PM on Discord. Usually you will find the best help in #troubleshooting in the RimWorld discord.

Syrchalis

Okay, there is another issue I have. As you know, I use Orassans and change dresser supports changing alien skin color, however you cannot access the body attributes menu anymore, where you change body shape, head shape and age etc.

Normal pawns can use it normally, but Orassans can only access apparel, hair and alien skin color.
For mod support visit the steam pages of my mods, Github or if necessary, write me a PM on Discord. Usually you will find the best help in #troubleshooting in the RimWorld discord.

Kiame


Kiame

just thought about it and i think orassians only have 1 body and head type so those selections are disabled. Age might be the same thing. I'll double check

Syrchalis

New update, error, blah, the usual. Should be an easy fix.

Could not execute post-long-event action. Exception: System.TypeInitializationException: An exception was thrown by the type initializer for MendingChangeDresserPatch.HarmonyPatches ---> System.ArgumentException: No target method specified for class MendingChangeDresserPatch.Patch_WorkGiver_DoBill_TryFindBestBillIngredients
  at Harmony.PatchProcessor.PrepareType () [0x00000] in <filename unknown>:0
  at Harmony.PatchProcessor..ctor (Harmony.HarmonyInstance instance, System.Type type, Harmony.HarmonyMethod attributes) [0x00000] in <filename unknown>:0
  at Harmony.HarmonyInstance.<PatchAll>b__7_0 (System.Type type) [0x00000] in <filename unknown>:0
  at Harmony.CollectionExtensions.Do[Type] (IEnumerable`1 sequence, System.Action`1 action) [0x00000] in <filename unknown>:0
  at Harmony.HarmonyInstance.PatchAll (System.Reflection.Assembly assembly) [0x00000] in <filename unknown>:0
  at MendingChangeDresserPatch.HarmonyPatches..cctor () [0x00000] in <filename unknown>:0
  --- End of inner exception stack trace ---
  at (wrapper managed-to-native) System.Runtime.CompilerServices.RuntimeHelpers:RunClassConstructor (intptr)
  at System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor (RuntimeTypeHandle type) [0x00026] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Runtime.CompilerServices/RuntimeHelpers.cs:101
  at Verse.StaticConstructorOnStartupUtility.CallAll () [0x00022] in C:\Dev\RimWorld\Assets\Scripts\Verse\Utility\StaticConstructorOnStartup.cs:26
  at Verse.PlayDataLoader.<DoPlayLoad>m__2 () [0x00001] in C:\Dev\RimWorld\Assets\Scripts\Verse\Defs\Databases\PlayDataLoader.cs:279
  at Verse.LongEventHandler.ExecuteToExecuteWhenFinished () [0x00036] in C:\Dev\RimWorld\Assets\Scripts\Verse\Global\LongEventHandler.cs:489
Verse.Log:Error(String, Boolean) (at C:\Dev\RimWorld\Assets\Scripts\Verse\Utility\Debug\Log\Log.cs:78)
Verse.LongEventHandler:ExecuteToExecuteWhenFinished() (at C:\Dev\RimWorld\Assets\Scripts\Verse\Global\LongEventHandler.cs:493)
Verse.LongEventHandler:UpdateCurrentAsynchronousEvent() (at C:\Dev\RimWorld\Assets\Scripts\Verse\Global\LongEventHandler.cs:402)
Verse.LongEventHandler:LongEventsUpdate(Boolean&) (at C:\Dev\RimWorld\Assets\Scripts\Verse\Global\LongEventHandler.cs:257)
Verse.Root:Update_Patch1(Object)
Verse.Root_Entry:Update() (at C:\Dev\RimWorld\Assets\Scripts\Verse\Global\Root\Root_Entry.cs:38)
For mod support visit the steam pages of my mods, Github or if necessary, write me a PM on Discord. Usually you will find the best help in #troubleshooting in the RimWorld discord.

Kiame

hmm strange. So that's actually a cross-mod comparability error. A quick fix is to go into the ChangeDresser mod's Assembly directory and delete the mending dll.

I will upload a newly compiled version of  ChangeDresser shortly