Ludeon Forums

RimWorld => Mods => Releases => Topic started by: Uuugggg on February 22, 2018, 02:29:07 PM

Title: [1.0] Smart Medicine
Post by: Uuugggg on February 22, 2018, 02:29:07 PM
(https://steamuserimages-a.akamaihd.net/ugc/922547897928143756/03CBA71AE94EE206B6052795FC0ED81149D16E50/?interpolation=lanczos-none&output-format=jpeg&output-quality=95&fit=inside%7C637%3A358&composite-to=*,*%7C637%3A358&background-color=black)

Smart Medicine

Description:
(this will be outdated ; check steam (https://steamcommunity.com/sharedfiles/filedetails/?id=1309994319) for updates)
Inventory Medicine
Doctors now use medicine from their inventory. This is very useful when your caravan attacks a base, or every day if you use the next feature, Stock Up On Medicine. It will even have a pack animal drop medicine if you need it.

Stock Up On Medicine
Doctors can carry a set amount of medicine with them at all times. You can change the options to set how many and which medicines are stocked up.

Minimal Medicine for non-Urgent Care
Stab wounds and infectious diseases need good treatment - but bruises don't benefit greatly from better medicine. You can choose to use only the cheapest medicine for these treatments (or none at all, though it is slower)

Field Tending
Doctors can treat patients in the field. Settings for "always", or "only if there are no beds available". Patients that can still walk will lie down in place with no beds available, or you can draft them to stand in place to receive treatment.

Download
Steam: https://steamcommunity.com/sharedfiles/filedetails/?id=1309994319
GitHub release: https://github.com/alextd/Rimworld-SmartMedicine/releases
Title: Re: [B18] Inventory Medicine
Post by: Harry_Dicks on February 22, 2018, 03:05:41 PM
This looks pretty interesting. Thank you!
Title: Re: [B18] Inventory Medicine
Post by: Mehni on February 22, 2018, 04:43:21 PM
Huh. Very nice.

Looks like it's completely compatible with Pick Up and Haul (https://ludeon.com/forums/index.php?topic=35832.0) too, which lets you tell pawns to pick up things and keep them in their inventory.

I like it, good job.
Title: Re: [B18] Inventory Medicine
Post by: Uuugggg on February 22, 2018, 04:54:16 PM
Literally developed with Pick Up and Haul, yup!
Title: Re: [B18] Inventory Medicine
Post by: Harry_Dicks on February 22, 2018, 05:16:49 PM
So will this stack with dubs Rimkits?
Title: Re: [B18] Inventory Medicine
Post by: Uuugggg on February 22, 2018, 06:20:36 PM
Looks like dubs Rimkits does a different thing and has no conflicts. It is a tad redundant, but Rimkits does allow healing without a bed (which is a thing I would add to this)
Title: Re: [B18] Inventory Medicine
Post by: Harry_Dicks on February 22, 2018, 06:57:31 PM
Thanks for investigating it for me :)

I'll admit I was lazy and could have tried myself, but my plan worked! Bwahaha  ;D
Title: Re: [B18] Inventory Medicine
Post by: Ser Kitteh on February 23, 2018, 06:34:23 AM
Dude.

Dude.

You are a goddamn hero.

Bless you. This should be vanilla, without a doubt.
Title: Re: [B18] Smart Medicine
Post by: Cal1sto on February 27, 2018, 02:49:48 PM
Can you please help me, I get this when starting Rimworld
Mod Rimworld-SmartMedicine-master has incorrectly formatted target version 'Unknown'. For the current version, write: <targetVersion>0.18.1722</targetVersion>
Title: Re: [B18] Smart Medicine
Post by: Kori on February 27, 2018, 03:05:01 PM
Quote from: Cal1sto on February 27, 2018, 02:49:48 PM
Can you please help me, I get this when starting Rimworld
Mod Rimworld-SmartMedicine-master has incorrectly formatted target version 'Unknown'. For the current version, write: <targetVersion>0.18.1722</targetVersion>

Check your folder structure, it should be Rimworld\Mods\SmartMedicine-master\About
You probably have too many subfolders from extracting the file.
Title: Re: [B18] Smart Medicine
Post by: Harry_Dicks on February 27, 2018, 03:24:56 PM
I had an issue too I think where I downloaded from the master branch or something. Made it so there were 2 about files.
Title: Re: [B18] Smart Medicine
Post by: Cal1sto on February 27, 2018, 03:57:43 PM
Yea like Harry said there are two about files About-Debug and About-Release
Title: Re: [B18] Smart Medicine
Post by: Canute on February 27, 2018, 04:22:28 PM
Delete the debug one and rename the other into About.xml
Title: Re: [B18] Smart Medicine
Post by: Cal1sto on February 27, 2018, 04:48:00 PM
Tnx it worked
Title: Re: [B18] Smart Medicine
Post by: Uuugggg on March 01, 2018, 06:41:11 PM
Hey lol the github is not for release, its for source.

Hmm. Perhaps I'll handle that.

EDIT: SO IT WAS SAID AND NOW IT IS DONE

GitHub releases are actually a piece of cake. There you go.
Title: Re: [B18] Smart Medicine
Post by: Canute on March 02, 2018, 03:20:57 AM
Quote from: Uuugggg on March 01, 2018, 06:41:11 PM
Hey lol the github is not for release, its for source.
But you posted it here at the forum for non-steam people, so the only download was github.
But thanks for the final github release ! :-)
Title: Re: [B18] Smart Medicine
Post by: Harry_Dicks on March 02, 2018, 12:10:48 PM
Quote from: Canute on March 02, 2018, 03:20:57 AM
Quote from: Uuugggg on March 01, 2018, 06:41:11 PM
Hey lol the github is not for release, its for source.
But you posted it here at the forum for non-steam people, so the only download was github.
But thanks for the final github release ! :-)

This. Plus, many of us will play with/test unstable releases and/or pre-release builds. I do, at least!
Title: Re: [B18] Smart Medicine
Post by: Harry_Dicks on March 02, 2018, 08:29:41 PM
Wow. I just looked at the mod options for this. Holy shit. I had no idea HOW FREAKING AWESOME YOU ARE!!!

You essentially let me have "walk off bruises" from the not-officially-updated QOLTweaksPacks (that PeteTimesSix has ignored my question if he will update it or not...). This is so freaking great. Thank you! ;D

Could you please explain what the final slider is for, "...include medicine that is good enough 0-100%" I don't understand this. Is that mean that the doctor should include medicine that is equivalent to 50% or whatever you set it to? Sorry, but I need this explained in better "dummy terms" for myself, if you don't mind :)
Title: Re: [B18] Smart Medicine
Post by: Uuugggg on March 03, 2018, 02:51:25 AM
> equivalent to 50%

Yea, that's the deal. Phrasing can change there.

I expect it to be set to like 90% - so if the herbal medicine+doctor quality is 0.9, well the maximum is 1.0 so 0.9 is good enough.

That may be better than using normal medicine which does get 1.0, but is worth 1.5, a waste of 0.5.
Title: Re: [B18] Smart Medicine
Post by: Harry_Dicks on March 03, 2018, 02:39:28 PM
How much more awesome can this mod be?! It seems like everyday you've got something even more great for us. And I really do appreciate it, honestly. :)
Title: Re: [B18] Smart Medicine
Post by: Crow_T on March 03, 2018, 02:45:33 PM
Yet another QoL must have, thanks!
Title: Re: [B18] Smart Medicine
Post by: Fatsack on March 03, 2018, 05:36:13 PM
Hey I was getting a bug with this mod, where I couldn't give any right-click commands to my Pawns.  when I checked the trace log it mentioned this mod, and when I removed it, the bug went away, thought you might want to know.
Title: Re: [B18] Smart Medicine
Post by: Uuugggg on March 04, 2018, 10:42:03 AM
^^ said rightclicking is fixed

I didn't get the problem to show up myself :/ But there was only one thing that could be the issue
Title: Re: [B18] Smart Medicine
Post by: Harry_Dicks on March 04, 2018, 02:15:02 PM
Wow! Alex, man, you are SERIOUSLY on a ROLL with this mod! Holy crap, it just keep getting more and more amazing! Things I didn't even know I wanted this badly! ;D

I must applaud you. I love how you've taken this one idea, of how the vanilla game crappily dealt with how doctors had to go get medicine to treat people, after said person might have been required to be hauled to a (possibly non-existent!) open/available bed. Now with your one mod, you've completely expanded upon so many different options that you've given to the player for how they would like to deal with this problem.

Every update, which has been pretty much everyday, you bring us some other new, fantastic option. I'm curious, do you have anymore plans for the mod that you have yet to implement? How much further could you take it? Either way, you've done one hell of a great job. Thank you. :)
Title: Re: [B18] Smart Medicine
Post by: Uuugggg on March 04, 2018, 02:21:38 PM
> I'm curious, do you have anymore plans for the mod that you have yet to implement?

... Nope.

The only addition right now is having settings per-map, and stock up per-pawn. That requires UI work for only a little benefit. I'll see if I want it badly enough after actually playing the game again a bit.
Title: Re: [B18] Smart Medicine
Post by: Harry_Dicks on March 04, 2018, 03:34:30 PM
Wow that does sound incredibly awesome if you were to ever implement it. Yes, I can see it now: designate this head doctor guy to carry around his nice glitterworld medicine, and you can have some of your "combat mules" or whatever carrying around a few herbal medicines each! Holy crap, this sounds AMAZING if we could set this up on a per pawn basis!

I have a dream actually of a mod that allows the player to turn on/off inventory "slots" for pawns. For example, a medicine slot, weapon/sidearm slow, drug slot, food slot, 1 or 2 bonus slots, etc. The idea being that the pawn can only carry one (or up to one stack?) of whatever in each slot.

You've kinda already gotten that going, and virtually perfected it, with the medicine slot. Is this something you would ever be interested in making, something similar to what you have, but for the other slots too? Maybe allow the player to control the food and drug slots of inventory, if anything?

Either way, you've still done an amazing job. Just wanting to throw some suggestions out there. I did post this once on a thread in the suggestions board, and it received positive responses. I'm especially keen on the idea of letting the player decide what "slots" they want to allow on pawns. Maybe some players only want a medicine, drug, and food slot. Maybe others want to have a few "anything slots" to further use stuff like Pick Up and Haul. Anyway it is fun to think about, but I am not versed in C# so I can only suggest things for the time being :P
Title: Re: [B18] Smart Medicine
Post by: Harry_Dicks on March 05, 2018, 07:52:45 AM
Just started a new little test game. One of my pawns started with asthma, so one of the docs was following them around trying to treat it. I had the game on speedx3, and thought there was some sort of bug going on, where it was causing one of my pawns to get stuck to another one. Turns out, it was the doc constantly trying to treat the other pawn's asthma, with no medicine (because of mod options), however the patient would never stay still long enough (wandering around, because new game with no jobs started yet) for the doc to finish the action bar. I'll post a pic of my mod options. Also, I double checked and the doc hadn't even had a chance to pick up any of the starting medicine yet. Right after drop pods landed, they started trying to heal the patient right away (which is awesome).

(https://i.imgur.com/tZeIWr9.png)
Title: Re: [B18] Smart Medicine
Post by: Harry_Dicks on March 05, 2018, 09:39:10 PM
Sorry, one more thing. In the options, I have the doctors set to carry around 5 medicine, and the only types disallowed are glitterworld medicine. However, this means they are now carrying around 5 each of herbal and regular medicine.

I know you mentioned you had considered it before, but now I think that it would be even more awesome if this were fully implemented: where you could set each individual pawns options, how much of what kind of medicine they should carry. This way, I could only let me best doctors carry around glitter medicine (once I have some), and let my nurses carry around regular medicine, field medices herbal or regular, whatever.

Damn, this could be so awesome! Not that it isn't already mind-blowingly awesome, but it could be even more mind-blowingly awesomer ::)

BTW, I can put a snake puzzle cube together faster than you :P
Title: Re: [B18] Smart Medicine
Post by: CEPMatos on March 06, 2018, 12:06:43 PM
Awesome, thanks!
Title: Re: [B18] Smart Medicine
Post by: Harry_Dicks on March 06, 2018, 04:40:06 PM
It's me... again...

I was resetting a lot of my mod settings, including this one. Once I had done that, I was back in the mod options, going in to setup the options for this mod the way I would like them. However, as I was going down the list, I got to the part where I could enable the option for "enable doctors to stock up on medicine in their inventory", and as I pressed that, I received this error, about RW having trouble changing the window when I had selected this option. But, if I just pressed escape and went back to the mod options screen, and then back to this mod's mod options, then everything was now working as it should be. I now had the different medicine icons near the lower part of the screen, that I could enable/disable a doctor from carrying (which was not there before I had enabled this option, the one that brought the error). Not sure if it's a big deal or not, as I could still use the mod by backing out, but still figured it might be worth your attention :)

[HugsLib][ERR] Exception during DoWindowContents: System.NullReferenceException: Object reference not set to an instance of an object
  at SmartMedicine.Settings.DoWindowContents (Rect wrect) [0x00000] in <filename unknown>:0
  at SmartMedicine.Mod.DoSettingsWindowContents (Rect inRect) [0x00000] in <filename unknown>:0
  at RimWorld.Dialog_VanillaModSettings.DoWindowContents (Rect inRect) [0x00000] in <filename unknown>:0
Verse.Log:Error(String)
HugsLib.Utils.ModLogger:ReportException(Exception, String, Boolean, String)
RimWorld.Dialog_VanillaModSettings:DoWindowContents(Rect)
Verse.<WindowOnGUI>c__AnonStorey0:<>m__0(Int32)
UnityEngine.GUI:CallWindowDelegate(WindowFunction, Int32, Int32, GUISkin, Int32, Single, Single, GUIStyle)
Title: Re: [B18] Smart Medicine
Post by: Uuugggg on March 06, 2018, 04:48:35 PM
Yeh, I've had enough of dealing with the settings code there, it's always nulling my arrays

considering it makes no sense that it would work the second time and not the first.
Title: Re: [B18] Smart Medicine
Post by: Harry_Dicks on March 06, 2018, 05:51:55 PM
Quote from: Uuugggg on March 06, 2018, 04:48:35 PM
considering it makes no sense that it would work the second time and not the first.
I know it sounds crazy, but I promise this is what's happening. I even went back in with a new, fresh copy of your mod, turning everything else off except for HugsLib, ModSwitch, JecsTools, and your mod. And it happened again still, and the same result was that after the error pops, when I went back to the mod options menu, the new icons are now located down below for me to interact with.

Also, since I've had my settings configured in such a way, I've been getting this error now. Is there a setting that I can change to remove this error, or will this be anything to worry about? I'm not really sure how it will affect my game :-[ Or could this be related to the display error I had pop earlier? This error is popping up at the game's launch, just going into the main menu.

SaveableFromNode exception: System.InvalidCastException: Cannot cast from source type to destination type.
  at (wrapper managed-to-native) object:__icall_wrapper_mono_object_castclass (object,intptr)
  at Verse.ScribeExtractor.SaveableFromNode[Settings] (System.Xml.XmlNode subNode, System.Object[] ctorArgs) [0x00000] in <filename unknown>:0
Subnode:
<ModSettings Class="SmartMedicine.Settings"><distanceToUseFromOther>6</distanceToUseFromOther><minimalMedicineForNonUrgent>False</minimalMedicineForNonUrgent><noMedicineForNonUrgent>True</noMedicineForNonUrgent><goodEnoughDowngradeFactor>0.6521739</goodEnoughDowngradeFactor><stockUpOnMedicine>True</stockUpOnMedicine><stockUpCapacity>5</stockUpCapacity><stockUpList><li>3</li><li>2</li><li>1</li></stockUpList><fieldTendingAlways>True</fieldTendingAlways></ModSettings>
Verse.Log:Error(String)
Verse.ScribeExtractor:SaveableFromNode(XmlNode, Object[])
Verse.Scribe_Deep:Look(Settings&, Boolean, String, Object[])
Verse.Scribe_Deep:Look(Settings&, String, Object[])
Verse.LoadedModManager:ReadModSettings(String, String)
Verse.Mod:GetSettings()
Safely_Hidden_Away.Mod:.ctor(ModContentPack)
System.Reflection.MonoCMethod:InternalInvoke(Object, Object[], Exception&)
System.Reflection.MonoCMethod:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo)
System.Reflection.MonoCMethod:Invoke(BindingFlags, Binder, Object[], CultureInfo)
System.Activator:CreateInstance(Type, BindingFlags, Binder, Object[], CultureInfo, Object[])
System.Activator:CreateInstance(Type, Object[], Object[])
System.Activator:CreateInstance(Type, Object[])
Verse.LoadedModManager:LoadAllActiveMods()
Verse.PlayDataLoader:DoPlayLoad()
Verse.PlayDataLoader:LoadAllPlayData(Boolean)
Verse.Root:<Start>m__1()
Verse.LongEventHandler:RunEventFromAnotherThread(Action)
Verse.LongEventHandler:<UpdateCurrentAsynchronousEvent>m__1()
Title: Re: [B18] Smart Medicine
Post by: Uuugggg on March 06, 2018, 06:16:21 PM
O_o no clue what's going on there.

I'd say delete the config files and relaunch... but the config is printed in the error there and looks fine
Title: Re: [B18] Smart Medicine
Post by: Harry_Dicks on March 06, 2018, 07:04:50 PM
That's what I was originally doing that caused the first error I was posting about ::)

Anyway, when I don't have my settings on this particular configuration, I get no error. However, I will delete my settings, and everything will be fine, but then when I switch back to these settings then I will get this recurring error. I'm sure there might be some other tests I could do, but I want to say I am fairly confident that I did try running only this mod and I had those issues, but I am not 100% sure of this - I might have been only messing with the other issue. Messing around with so many mods for so many days makes it all become just one big blur.

I'll try to get around to doing this to confirm. If this ends up being the case, then this error could possibly be being caused by these particular settings, no?
Title: Re: [B18] Smart Medicine
Post by: Kori on March 10, 2018, 07:07:48 AM
I experienced the same problem as Harry.
The first time I clicked on a particular option I got this error. When I went back and tried the same thing again, it worked.
Title: Re: [B18] Smart Medicine
Post by: Uuugggg on March 10, 2018, 10:25:12 AM
Alright, here's the issue:

If your config file is blank, it still goes through the loading process and sets defaults.

If you don't even have a config file, it doesn't do that. So there are some null arrays there. It then saves your config, and initializes the array.

So... the defaults need to be saved in two places in code. Ehhh. Fine.
Title: Re: [B18] Smart Medicine
Post by: Harry_Dicks on March 11, 2018, 08:08:30 PM
I figured out where that odd error I was getting was coming from: I had an extra mod settings file saved in my config from where I had your mod under a separate name. Ah well, sorry for the confusion.

Anyway, I would like to submit a request, if you don't mind. The ability to let pawns carry a drug with them. This way we can always have our "combat stim" on hand. Go Juice, flake, yayo, or whatever you could have from mods. It would be really awesome if there was something similar to how you can select what medicines you allow doctors to carry, but you could also select what drugs pawns could carry as well.

Taking it one step further, like you had mentioned earlier, would be letting the player differentiate what pawns can carry what drugs/medicines. Of course, I know all of this could take a lot of work. Either way, I just wanted to put the idea out there, as you seemed to have been on such an awesome spree lately, tackling a lot of pawn inventory issues.

If this is beyond the scope or direction that you want to take this mod, I understand. However, maybe you could consider something like a "Smart Drugs" mod in the future then? :)

PS-BTW I had just had my first raid on my new map, and was watching my doctor patch up the other colonists after the fight. It was really nice watching him (who carried 5 regular and 5 herbal medicine) use his on hand herbal medicine for the captured prisoner with heavy wounds, no medicine for one colonist with light wounds, and then used the medicine from my other doctor's inventory for her dire wounds.
Title: Re: [B18] Smart Medicine
Post by: Lethe on March 29, 2018, 11:04:36 PM
>"Multiple Reservations
This hardly deserves an entire section since it was actually easy to implement and it should be in the base game. But now multiple doctors can reserve the same stack."

Hmmm...do you think you could extend this behavior to the rest of the game? A multiple reservations extension mod that allows different pawns to all harmoniously work with one stack of X good/material/item. It's high time our rimworld-ers learned the importance of sharing.
Title: Re: [B18] Smart Medicine
Post by: Uuugggg on March 29, 2018, 11:13:35 PM
Oh, my, no.

Things are reserved in a hundred places, and you'd need to know how many you're reserving each time, and the code to edit that would not be pretty. It's not feasible in some cases.

Medicine, though, is only reserved a few places, so I went in and fixed that. My code was reserving and checking reservations already, so it was a small change.

Now, if I had control over source code, it'd be doable. I can only imagine 1.0 has this coming.
Title: Re: [B18] Smart Medicine
Post by: coldcell on March 30, 2018, 07:48:58 AM
I'm having the problem as above, but mine isn't consistent and ticking/unticking the options don't seem to always work 100%. Many times my doctors will just "Standing" beside the patient. It may be conflicting with Fluffy's Work Tab because of the many sub-jobs added by that mod.

However just wanna say +1 this mod because the idea is awesome.
Title: Re: [B18] Smart Medicine
Post by: Vlad0mi3r on April 03, 2018, 06:29:09 AM
Can it be confirmed that there is no issue with Fluffy's work tab? This mod is awesome but I don't think I can play without Fluffy's work tab any more.
Title: Re: [B18] Smart Medicine
Post by: Uuugggg on April 03, 2018, 06:37:58 AM
You bet, I use Fluffy's Work Tab.

The job to stock up is not even work anymore, actually, so there's definitely no conflict with the work tab.
Title: Re: [B18] Smart Medicine
Post by: Vlad0mi3r on April 03, 2018, 06:44:58 AM
Sweet thank you.
Title: Re: [B18] Smart Medicine
Post by: Marsunpaisti on April 10, 2018, 04:00:20 PM
Hi! I'm getting this error every now and then causing pauses, and I'm 90% sure its this mod causing it. It just happened when a visiting caravan member got injured so perhaps it has something to do with it.

EDIT: Actually now I think it happens when any non-colonist gets hurt. Just after a siege it started occurring again. My ghetto fix is to reload the save with the mod disabled and then re-enable and it wont happen again until later.

Error in WorldPawnGCTick(): System.NullReferenceException: Object reference not set to an instance of an object
at Verse.Map.get_ParentHolder () <0x0000c>
at Verse.ThingOwnerUtility.AnyParentIs<RimWorld.Planet.TravelingTransportPods> (Verse.Thing) <0x00087>
at (wrapper dynamic-method) RimWorld.PawnUtility.IsTravelingInTransportPodWorldObject_Patch1 (Verse.Pawn) <0x0001d>
at RimWorld.Planet.WorldPawnGC.GetCriticalPawnReason (Verse.Pawn) <0x000da>
at RimWorld.Planet.WorldPawnGC/<AccumulatePawnGCData>c__Iterator0.MoveNext () <0x000db>
at RimWorld.Planet.WorldPawnGC/<PawnGCPass>c__Iterator1.MoveNext () <0x0016b>
at RimWorld.Planet.WorldPawnGC.WorldPawnGCTick () <0x000d3>
at RimWorld.Planet.WorldPawns.WorldPawnsTick () <0x00260>

Verse.Log:Error(String)
RimWorld.Planet.WorldPawns:WorldPawnsTick()
RimWorld.Planet.World:WorldTick()
Verse.TickManager:DoSingleTick()
Verse.TickManager:TickManagerUpdate()
Verse.Game:UpdatePlay()
Verse.Root_Play:Update()
Title: Re: [B18] Smart Medicine
Post by: Uuugggg on April 10, 2018, 08:45:53 PM
Smart Medicine isn't touching those things.

There is a mod patching IsTravelingInTransportPodWorldObject_Patch1

Which could be one of: Vehicles or Cthulhu (or any other mod that doesn't use github)

https://github.com/jecrell/JecsTools/blob/4c05fc2023e0f0e8873eb6ab6b16c887f079b877/Source/AllModdingComponents/CompVehicle/HarmonyCompVehicle.cs#L93

https://github.com/Rim-Of-Madness-Team/Call-of-Cthulhu---Cults/blob/6d544de0a12b394575c09349aba2be916fe6d8c4/Source/HarmonyPatches.cs#L24
Title: Re: [B18] Smart Medicine
Post by: Marsunpaisti on April 11, 2018, 09:49:26 AM
Hmm. Not using either one of those. Perhaps its just the reloading of the save that fixes the errors then.
Title: Re: [B18] Smart Medicine
Post by: Reaper on April 21, 2018, 11:20:24 PM
Where can I find the config file for the mod settings?
Title: Re: [B18] Smart Medicine
Post by: Canute on April 22, 2018, 03:12:51 AM
Like all other config files too, should be same area like the safegames.
When you use windows open Options then click at "Open safe data folder".
Title: Re: [B18] Smart Medicine
Post by: alexo on April 24, 2018, 05:05:30 PM
Congrat! i need this!"
Title: Re: [B18] Smart Medicine
Post by: Kori on June 10, 2018, 07:54:35 AM
Smart Medicine seems to be conflicting with the Prison Labor mod.
When a prisoner is working as a doctor and tries to use medicine it's not possible and the following error appears

JobDriver threw exception in initAction. Pawn=Wolverine, Job=TendPatient (Job_1209010) A=Thing_Human15994, Exception: System.NullReferenceException: Object reference not set to an instance of an object
  at Verse.AI.Toils_Haul+<CheckForGetOpportunityDuplicate>c__AnonStorey2.<>m__0 () [0x00000] in <filename unknown>:0
  at Verse.AI.JobDriver.TryActuallyStartNextToil () [0x00000] in <filename unknown>:0  lastJobGiver=PrisonLabor.JobGiver_Labor, curJob.def=TendPatient, curDriver=RimWorld.JobDriver_TendPatient


Can you please include prisoners into your mod's routine to make it compatible?

Does it already work for Hospitality guests who help your colony?
Title: Re: [B18] Smart Medicine
Post by: Sladki on June 18, 2018, 04:04:55 AM
The latest release (from Github) is not compatible with Pharmacy: when a pawn tries to tend, he chooses the best available medicine (Downgrade is disabled) ignoring Pharmacy "advice".

But there is a strange thing: I've tried to compile .dll from source and it works fine with Pharmacy (log shows, that SM prefix uses Pharmacy "advice" validator when tries to find the best medicine).
Title: Re: [B18] Smart Medicine
Post by: Uuugggg on June 20, 2018, 08:27:35 PM
Weird, I had rebuilt Smart Medicine to support Pharmacy because it didn't work; no reason it didn't work though.

Well there's a new version that seems to work.
Title: Re: [B18] Smart Medicine
Post by: EgotisticalElf on July 08, 2018, 09:05:39 PM
I can confirm that Pharmacist and Smart Medicine do not play well on the currently posted 1.0 builds.

I had to rebuild the Pharmacist from source as it needed updated references from the game proper. I tried to recompile Smart Medicine with those same reference updates and with a few compile errors I think resolved, the game refused to load the mod at all.

*edit*
PickUpAndHaul adds items to the pawns inventory as it hauls up to their weight limit, however, this mod hides the ability to see what they have (the button and such is on top of the list i guess).

I lack the skillz to determine why though. :(
Title: Re: [B18] Smart Medicine
Post by: CH3N9 on July 29, 2018, 02:59:39 PM
Current version conflict with Pick Up and Haul 1.0.2 on Rimworld v1.0.1978. Pawn pick up stuffs but doesn't drop 'em at the stockpiles unless I done it manually.

Could not execute post-long-event action. Exception: System.TypeInitializationException: An exception was thrown by the type initializer for PickUpAndHaul.HarmonyPatches ---> System.Exception: Exception from HarmonyInstance "mehni.rimworld.pickupthatcan.main" ---> System.ArgumentException: Object type System.Collections.Generic.List`1[Harmony.ILCopying.ExceptionBlock] cannot be converted to target type: System.Collections.Generic.List`1[Harmony.ILCopying.ExceptionBlock]
Parameter name: val
  at System.Reflection.MonoField.SetValue (System.Object obj, System.Object val, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Globalization.CultureInfo culture) [0x000e3] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoField.cs:152
  at Harmony.Traverse.SetValue (System.Object value) [0x00000] in <filename unknown>:0
  at Harmony.CodeTranspiler+<>c__DisplayClass4_0.<ConvertInstruction>b__0 (System.String name, Harmony.Traverse trvFrom, Harmony.Traverse trvDest) [0x00000] in <filename unknown>:0
  at Harmony.Traverse+<>c__DisplayClass37_0.<IterateFields>b__0 (System.String f) [0x00000] in <filename unknown>:0
  at System.Collections.Generic.List`1[System.String].ForEach (System.Action`1 action) [0x00018] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/List.cs:361
  at Harmony.Traverse.IterateFields (System.Object source, System.Object target, System.Action`3 action) [0x00000] in <filename unknown>:0
  at Harmony.CodeTranspiler.ConvertInstruction (System.Type type, System.Object op, System.Collections.Generic.Dictionary`2& unassigned) [0x00000] in <filename unknown>:0
  at Harmony.CodeTranspiler.ConvertInstructionsAndUnassignedValues (System.Type type, IEnumerable enumerable, System.Collections.Generic.Dictionary`2& unassignedValues) [0x00000] in <filename unknown>:0
  at Harmony.CodeTranspiler.ConvertToGeneralInstructions (System.Reflection.MethodInfo transpiler, IEnumerable enumerable, System.Collections.Generic.Dictionary`2& unassignedValues) [0x00000] in <filename unknown>:0
  at Harmony.CodeTranspiler+<>c__DisplayClass10_0.<GetResult>b__0 (System.Reflection.MethodInfo transpiler) [0x00000] in <filename unknown>:0
  at System.Collections.Generic.List`1[System.Reflection.MethodInfo].ForEach (System.Action`1 action) [0x00018] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/List.cs:361
  at Harmony.CodeTranspiler.GetResult (System.Reflection.Emit.ILGenerator generator, System.Reflection.MethodBase method) [0x00000] in <filename unknown>:0
  at Harmony.ILCopying.MethodBodyReader.FinalizeILCodes (System.Collections.Generic.List`1 transpilers, System.Collections.Generic.List`1 endLabels, System.Collections.Generic.List`1 endBlocks) [0x00000] in <filename unknown>:0
  at Harmony.ILCopying.MethodCopier.Finalize (System.Collections.Generic.List`1 endLabels, System.Collections.Generic.List`1 endBlocks) [0x00000] in <filename unknown>:0
  at Harmony.MethodPatcher.CreatePatchedMethod (System.Reflection.MethodBase original, System.String harmonyInstanceID, System.Collections.Generic.List`1 prefixes, System.Collections.Generic.List`1 postfixes, System.Collections.Generic.List`1 transpilers) [0x00000] in <filename unknown>:0
  --- End of inner exception stack trace ---
  at Harmony.MethodPatcher.CreatePatchedMethod (System.Reflection.MethodBase original, System.String harmonyInstanceID, System.Collections.Generic.List`1 prefixes, System.Collections.Generic.List`1 postfixes, System.Collections.Generic.List`1 transpilers) [0x00000] in <filename unknown>:0
  at Harmony.PatchFunctions.UpdateWrapper (System.Reflection.MethodBase original, Harmony.PatchInfo patchInfo, System.String instanceID) [0x00000] in <filename unknown>:0
  at Harmony.PatchProcessor.Patch () [0x00000] in <filename unknown>:0
  at Harmony.HarmonyInstance.Patch (System.Reflection.MethodBase original, Harmony.HarmonyMethod prefix, Harmony.HarmonyMethod postfix, Harmony.HarmonyMethod transpiler) [0x00000] in <filename unknown>:0
  at PickUpAndHaul.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)
Title: Re: [B18] Smart Medicine
Post by: Kassidoo on August 24, 2018, 10:00:12 AM
Hi, it seems something broke SmartMedicine today in my game (B19)
https://gist.github.com/HugsLibRecordKeeper/dc1d82931009672417af256e25a35ad5

heres a snipet

Isildria threw exception in WorkGiver DoctorTendToHumanlikes: System.NullReferenceException: Object reference not set to an instance of an object
at SmartMedicine.Settings.Get () <0x00022>
at SmartMedicine.GoodLayingStatusForTend_Patch.Postfix (Verse.Pawn,bool&) <0x00031>
at (wrapper dynamic-method) RimWorld.WorkGiver_Tend.GoodLayingStatusForTend_Patch1 (Verse.Pawn,Verse.Pawn) <0x000c2>
at RimWorld.WorkGiver_Tend.HasJobOnThing (Verse.Pawn,Verse.Thing,bool) <0x00103>
at RimWorld.WorkGiver_TendOther.HasJobOnThing (Verse.Pawn,Verse.Thing,bool) <0x00032>
at RimWorld.JobGiver_Work/<TryIssueJobPackage>c__AnonStorey1.<>m__0 (Verse.Thing) <0x0005e>
at Verse.GenClosest/<ClosestThingReachable>c__AnonStorey0.<>m__0 (Verse.Thing) <0x000fa>
at Verse.GenClosest.ClosestThing_Global (Verse.IntVec3,System.Collections.IEnumerable,single,System.Predicate`1<Verse.Thing>,System.Func`2<Verse.Thing, single>) <0x00214>
at Verse.GenClosest.ClosestThingReachable (Verse.IntVec3,Verse.Map,Verse.ThingRequest,Verse.AI.PathEndMode,Verse.TraverseParms,single,System.Predicate`1<Verse.Thing>,System.Collections.Generic.IEnumerable`1<Verse.Thing>,int,int,bool,Verse.RegionType,bool) <0x00504>
at (wrapper dynamic-method) RimWorld.JobGiver_Work.TryIssueJobPackage_Patch1 (object,Verse.Pawn,Verse.AI.JobIssueParams) <0x0131b>

Title: Re: [B19] Smart Medicine
Post by: Uuugggg on August 30, 2018, 02:19:52 PM
Updated for official B19, problems seem to be fixed
Title: Re: [B19] Smart Medicine
Post by: deliveryservice on September 04, 2018, 10:53:27 AM
I get this warning:
Tried to use an uninitialized DefOf of type StatDefOf. DefOfs are initialized right after all defs all loaded. Uninitialized DefOfs will return only nulls. (hint: don't use DefOfs as default field values in Defs, try to resolve them in ResolveReferences() instead)
Verse.Log:Warning(String, Boolean)
RimWorld.DefOfHelper:EnsureInitializedInCtor(Type)
RimWorld.StatDefOf:.cctor()
System.RuntimeMethodHandle:GetFunctionPoi


This is mild but it may leads to complication after more mods were added.
Title: Re: [B19] Smart Medicine
Post by: bigheadzach on September 22, 2018, 02:09:43 PM
So I have a prisoner develop an infected injury (2% higher than immunity at the time) and my colony only has standard medicine, no herbal. Both Smart Medicine and Pharmacist are set to their initial settings, which suggest that even a prisoner should get standard meds for a life-threatening injury (which an infection leading immunity would be).

Yet, the doctor applies no medicine to tending the infection. The only way I "fixed" this was cranking both Pharmacist and the prisoner's personal vanilla settings from "Herbal" to "Best Possible".

Am I seeing a bug, or am I misunderstanding how SM determines the use of standard meds? Is there a logic that gives up when "Herbal or worse" is the setting and only "Better than Herbal or nothing" is available?
Title: Re: [B19] Smart Medicine
Post by: Soupy Delicious on October 25, 2018, 09:15:23 AM
Wow, looks like a really well thought out mod.  I'd be interested, if you'd update :D
Title: Re: [1.0] Smart Medicine
Post by: shadowstitch on October 26, 2018, 05:27:15 PM
Could I suggest the option to disable the "use best medicine for surgery" toggle in the pawn -> health -> overview panel?
In my game at least, it causes "metabolism" at the bottom of the list to be halfway cut off by the bottom bar of the screen. And I believe this option is toggle-able elsewhere, so there's already some redundancy there.
Title: Re: [1.0] Smart Medicine
Post by: Jiro on October 30, 2018, 11:03:25 AM
Is there any reason to use both Smart Medicine and Pharmacist at the same time? I'm not really quite understanding what Pharmacist does that Smart Medicine doesn't already do.
Title: Re: [1.0] Smart Medicine
Post by: bigheadzach on October 30, 2018, 11:44:21 AM
Pharmacist attempts to make judgement calls on what medicine to use to treat certain illnesses/injuries based on severity, but since Smart Medicine allows you to individually select treatment options per illness/injury, all Pharmacist does at that point is save you a click from time to time.

Personally, if I can pause the game when injuries occur, I don't feel I need Pharmacist if I can choose freely via Smart Medicine.
Title: Re: [1.0] Smart Medicine
Post by: Canute on October 30, 2018, 01:14:11 PM
Not to speak, Smart Medicine allow you to stock up medicin at the doctor's inventory.
Title: Re: [1.0] Smart Medicine
Post by: Ser Kitteh on November 20, 2018, 08:39:22 AM
So in my current run, for some reason, the 'stock up' option isn't available in the gear tab. I'm not sure why.

https://gist.github.com/HugsLibRecordKeeper/509c80326dcec870683f8610cf107152
Title: Re: [1.0] Smart Medicine
Post by: Canute on November 20, 2018, 08:53:34 AM
Tt's about
Sandy's Detailed RPG Inventory !
Try to load SmartMedicin after that mod, then it should works.
At last it does at my side.
Title: Re: [1.0] Smart Medicine
Post by: Ser Kitteh on November 20, 2018, 08:58:58 AM
Dang, it didn't! Smart Medicine is right after it.

However, this never happened before, so Idk why this is the case!
Title: Re: [1.0] Smart Medicine
Post by: Canute on November 20, 2018, 09:04:32 AM
Maybe another mod, did you try to load Smart Medicin at the last place ?
Do you use the latest version ? 8 days ago there was an update so it works with RPG mod. If you use steam the question is pointless.
Title: Re: [1.0] Smart Medicine
Post by: Ser Kitteh on November 20, 2018, 09:07:16 AM
Ah, that must be it! I downloaded the newest version of github, it was an older version. Thanks, Canute.
Title: Re: [1.0] Smart Medicine
Post by: Dr_Zhivago on November 23, 2018, 09:50:29 PM
Not sure if this is intended, or a me issue, or mod issue, but my UI on the "Assign" tab looks like this when I run your mod:

https://imgur.com/a/FjxRW0M
Title: Re: [1.0] Smart Medicine
Post by: paragonid on February 07, 2019, 12:57:52 PM
Does option "Medical settings for surgery default to using best available medicine" work as intended? I have it off and all new pawns/prisoners still get "Use best medicine for surgery" on, so I have to disable manually for everyone. Any ideas?

The options: https://imgur.com/a/SWtR77i
Title: Re: [1.0] Smart Medicine
Post by: Uuugggg on February 07, 2019, 01:03:10 PM
Yes I guess that doesn't work, I am fixing that now
Title: Re: [1.0] Smart Medicine
Post by: Uuugggg on February 07, 2019, 01:25:18 PM
Y'know what, that setting is working correctly but confused me so the description is updated.

The setting in the Smart Medicine options is for new games - it's what the default is set to.

The actual default you want to change in game, can be set alongside the normal medical defaults, accessible from the Health tab.
Title: Re: [1.0] Smart Medicine
Post by: paragonid on February 07, 2019, 01:46:50 PM
Uh so can't change it during game?
Rip micromanaging one more thing for each new captured pirate/colonist now
Thanks for response
Title: Re: [1.0] Smart Medicine
Post by: togfox on February 07, 2019, 08:09:18 PM
Does this expand or enhance a pawns inventory? Can a pawn carry a simple meal AND a herbal medicine? Would this mod let a pawn carry more than they normally could in vanilla?
Title: Re: [1.0] Smart Medicine
Post by: Dr_Zhivago on February 08, 2019, 12:00:53 AM
Quote from: togfox on February 07, 2019, 08:09:18 PM
Does this expand or enhance a pawns inventory? Can a pawn carry a simple meal AND a herbal medicine? Would this mod let a pawn carry more than they normally could in vanilla?

Expand? Not really. Enhance? Sure. It allows you to designate drugs/medicine to be carried around in inventory based on your desired number. (eg: carry 10 herbal medicine and 1 beer).

Yes can carry multiple items.

Does not change the total carry weight of a pawn, so they may not be able to pick up items if too burdened.
Title: Re: [1.0] Smart Medicine
Post by: CEPMatos on March 12, 2020, 03:05:40 PM
Steam version working on 1.1, will this one work too?
Title: Re: [1.0] Smart Medicine
Post by: Monzer on May 10, 2020, 03:47:25 PM
please update 1.1 !