• Mods are now organized as resources. Use the Mods link above to browse for or submit a mod, tool, or prefab.

    The TFP Official Modding Forum Policy establishes the rules and guidelines for mod creators and mod users.

Bad Medicine

Bad Medicine 2.0.1.1

No permission to download

khzmusik

Hunter
khzmusik submitted a new resource:

Bad Medicine - You have to feel it to heal it.

Bad Medicine​


Hurting yourself is easier, healing yourself is more painful.

Features


Dirty Bandages
Bandages must be sterilized to prevent infection.
  • Dirty bandages can be crafted from only cloth fragments, but have a chance to cause infection. The chance of infection is much higher if you have a laceration.
  • Bandages must be sterilized by boiling with clean water in a cooking pot.
  • Crafting a first aid bandage requires a...

Read more about this resource...
 
khzmusik updated Bad Medicine with a new update entry:

Bad Medicine is updated for 2.x

I have released an update for Bad Medicine to version 2.0.1.0. It should be compatible with 2.0 and 2.1.

Changes for this release:
  • More complete tagging for "soft hands"
  • "Soft hands" when hitting hard items makes sprained or broken arms worse
  • "Fever vision" now starts at stage 2, adds "Drunk" effect at stage 3
  • Add pick up/place sounds for dirty bandages
  • Add dirty bandages to new loot groups
  • Dirty bandage recipe's cloth count matches vanilla
Enjoy!

Read the rest of this update entry...
 
The soft hands part of this mod prevents the mod Horns open doors from working. I'm guessing it's something to do with the changes you made in the blocks xml. When I removed all coding relating to soft hands and deleted the blocks xml, Horns open doors started working again.
 
Can you link to the horns mod you're using? I will take a look at it. I have no idea how my mod could affect it.
 
Here's the link Horns open doors
I looked over the coding and couldn't see how your mod could affect it but somehow something in your blocks xml kept it from functioning in my game. I tested it several times with just the 2 mods installed and kept having the same result. It loads after your mod so I would have thought it would overwrite things and still function. Hopefully you have better luck than I did in trying to find what may be conflicting. For now I will continue to use your mod with the soft hands part removed as I really like what your mod does. I've been a big fan of your mods for years.
 
So, I tried reproducing this, and the only issue that I could see is that honking the horn does not open the smaller, chain-link doors in traders. Double doors all worked fine. (I did not try with player-built doors though.)

I found the cause of that issue. It is really an issue with the Horn Opens Doors mod, but it could also be fixed in Bad Medicine.

The issue is with this XPath in ZZZ_HornsOpenDoors/Config/blocks.xml:
XML:
<append xpath="/blocks/block/property[@name='Tags'][@value='door']/@value">,openbyhorn</append>

That line will append the "openbyhorn" tag, but only if the existing "Tags" property value is "door" and nothing else. If there are any other tags, that XPath fails.

But because doors are made from hard materials, the Bad Medicine mod adds the "hard" tag to them, so you will get hurt if you punch them.

There are two ways to solve this by modifying the Horns Open Doors mod, and one way to solve it in the Bad Medicine mod.

The first way to solve this in the Horn Opens Doors mod, and the simplest, is to use contains instead of checking for equality:
XML:
<append xpath="/blocks/block/property[@name='Tags'][contains(@value, 'door')]/@value">,openbyhorn</append>

The second way to solve this in the Horn Opens Doors mod, and the one that is probably "more correct," is to also use the csv operation rather than append:
XML:
<csv xpath="/blocks/block/property[@name='Tags'][contains(@value, 'door')]/@value" delim="," op="add">openbyhorn</append>

The way to solve this in the Bad Medicine mod, is to add this to the csv XPath in blocks.xml which adds the "hard" tag to existing tags:
XML:
and not(descendant::property[@name='Tags' and @value='door'])
(That's the first big XPath statement in the file, I tested by adding it after the 'verticalBlinds' line.)

But if you do this, you will no longer get hurt by punching doors. This might be OK, since you may not want that, or it could be an in-game explanation that "punching" the door really means "knocking" on it, so you don't get hurt.

(It would be nice if I could conditionally check if the Horn Opens Doors mod is installed, but I can't, because it's loaded after all other mods.)

That will solve the conflicts between this mod and Horn Opens Doors. But there might be other mods out there that also add a tag to doors, and those mods will still be incompatible.

So, it would be better if Area8888 made the changes in Horn Opens Doors. I don't know how open they are to that suggestion. It looks like they don't have an account here, so I'm contacting them on Nexus Mods to see if they'll release a patch. If they don't reply soon, I'll update Bad Medicine.

In the meantime, you can add one of those fixes to your own local copy of the mods. (If it's on a server, the changes should be pushed to the client, but you'll have to restart the server first.)
 
Thanks for coming up with a solution so quickly. For now I'll edit Horns Open Doors using the solution you came up with and go back to the original Bad Medicine without the changes I made. I didn't mention the issue to Area8888 on Nexus as they don't seem to really respond in comments. I brought it up with you as you've always been responsive to comments and I know you have the coding knowledge to figure out the issue. My knowledge of xpath is rather basic and I know pretty much nothing about using csv operations. What bit of modding I do is basic and often based upon looking at someone else's coding that is similar to what I want to accomplish and then butchering it until it does what I need it to do.
 
I hate to throw a wrench into things but I tried all 3 fixes and they only partially worked. Originally, Horns Open Doors worked on all doors in the game, poi or player made. With just that mod it still does that with your suggested fix. Once I add Bad Medicine though it only works on some of the doors. Wooden doors work fine with the exception of the wooden garage door. All steel doors work fine. None of the iron doors will open though. The behavior is the same with or without your suggested fix for Horns Open Doors. I even tried setting Bad Medicine to load after Horns Open doors and had the same result. I looked at the coding on the iron doors, iron garage doors, and the wooden garage doors and can't see anything that would make them behave differently than all the other doors.
 
Last edited:
I'm not sure that this helps any but I got curious and turned on the soft hands feature in SCore and with the Horns Open Doors mod, without the fix you suggested, the doors all open properly. Maybe there is something in the SCore coding for soft hands that might give you some ideas on the issue.
 
The SCore "soft hands" feature is unrelated, and requires C#, which I don't want to use with this mod.

But, the good news is that I see the issues you're talking about, and I should have fixed them.

If you want to test it out, here is a download link:
https://gitlab.com/karlgiesing/7d2d...rn-opens-doors.zip?path=khzmusik_Bad_Medicine

It was my misunderstanding. I thought that the "Tags" property did not extend on blocks. (It does not extend on entity classes.) So I wrote XPath code which adds that property to all blocks that extend "hard" blocks, but do not have their own "Tags" property.

Well, that is incorrect, so when I added the new "Tags" property, it overrode the tags that were extended from the "parent" block. I removed that XPath altogether, and things seem to work as intended.

I also saw a couple other issues and fixed them. I also added optional code to remove the "hard" tag if the only other tag was "door", in case Horn Opens Doors isn't updated soon.

Speaking of the Horn Opens Doors fix: I discovered that the code I posted earlier will add a second "openbyhorn" tag to a couple blocks. It doesn't hurt anything, but it's easy enough to fix: only add the tag if it isn't already there. This is the updated code to do it:
XML:
<append xpath="/blocks/block/property[@name='Tags' and contains(@value, 'door') and not(contains(@value, 'openbyhorn'))]/@value">,openbyhorn</append>

Incidentally, this also seems to fix the existing bug in Horn Opens Doors where horns won't open powered garage doors. (That bug has nothing to do with Bad Medicine, it has to do with the fact that those doors have more than just the "door" tag in the vanilla XML.)
 
Last edited:
I tested it with the fix uncommented in Bad Medicine and I tested the fix you came up with for Horns Open Doors. Both fixes worked great. All the doors opened properly for me. Thanks for coming up with a solution so quickly. On a side note, I do have a question about your NPC mods but I will post that in the appropriate thread.
 
khzmusik updated Bad Medicine with a new update entry:

Minor update for compatibility with Horns Open Doors

An incompatibility was discovered between this mod and the Horn Opens Doors mod. This is due to the "hard" tag added by Bad Medicine to support the "soft hands" feature. The additional tag interferes with the XPath used by Horn Opens Doors to add its own tags.

Please note that I cannot fix this incompatibility on my own. The best I can do is to remove the "hard" tag in cases where it interferes with Horn Opens Doors. But that means the "soft hands" feature won't work on any doors.

There is...

Read the rest of this update entry...
 
Back
Top