[1.3.0] Hospitality

Started by Orion, March 13, 2015, 11:19:16 AM

Previous topic - Next topic

Shadou

Has the problem I mentioned way back around page 23 or 24 -- the conflict the mod has with Mending -- been addressed? With the mods conflicting the way they are, I have to choose between these two mods. I'd rather be able to use both.

Exende

I use both and is playable, what is your problem with the mod?

TheDreaded1

Same issue with visitors leaving safely, but it doesn't register. All the factions hated me, which was kinda fun, but I turned it off until it's fixed. Game just isn't the same w/o it, but I'll make due for awhile.

☢FLAY☢

Quote from: Orion on May 28, 2016, 04:01:25 AM
Quote from: joaonunes on May 27, 2016, 07:03:14 PM
Quote from: ☢FLAY☢ on May 27, 2016, 05:30:43 PM
found a minor annoyance with this mod it claims my nonviolent colonist needs a weapon and is a hunter, having him take a weapon only to not use it.

also I see guest tab but i can't assign a guest bed don't know how?

Is the first problem related with this mod at all?
Unfortunately this happens when you install the mod into an existing save. Since it adds a new job, all existing jobs are pushed one to the right. So it can happen that someone gets assigned hunter who can't actually hunt. This is because RimWorld does not anticipate that mods might add new jobs.
Maybe I can make a hack that fixes this problem in RimWorld.

Quote from: crusader2010 on May 27, 2016, 11:54:15 AM
Hello! I've figured out where that TraverseParms error is coming from. It's from the "More vanilla turrets" mod. Basically all of the automated turrets are causing this error when they are fully built.

Is there any chance that Hospitality interacts somehow with turrets? seems very strange that before 1.13 there weren't any debug errors.
Good catch! I think it's highly unlikely that there's a conflict between these mods. Hospitality doesn't do anything with turrets.

Quote from: Atomisk on May 26, 2016, 05:55:05 AM
i get the message that people dissapear FAR too often in my map. People going missing in my territory after they have already left the map. I have no other mods that can possibly cause a conflict with yours, it just keeps happening. They depart, they're gone off the map, and the next morning i get a message about an angry chief. This has happened so many times my relations are destroyed with the only factions i can trade with, meaning i am now basically perminantly out of silver and have too much damn storage space used up. A bit of info, this is on a save existing prior to installing the mod, and several other mods that don't change anything with factions or visitation. I do have fluffy's dynamic relation chart, but this happened before i installed that mod. I also have the prepare carefully mod, which effects things even before i started my colony and is the mod i started with before adding a whole bunch of stuff. I will try playing on a smaller map with a new colony, even though this map isn't too big... and post my results.
This does indeed sound like increasing the timer won't fix the problem. There's something else going on.

Quote from: Nanao-kun on May 26, 2016, 02:16:34 PM
Actually, is it possible to make it so that relations decrease when the time limit is passed, and then be rescinded once the visitors actually make it back?
Hm. I'll have to check if this is possible. This would at least solve the problem that the timer might be too short for big maps. I'll increase it by half a day anyway.

Thank you so much for been active, a "hack" to that issue would be greatly appreciated whenever thank you  :).

Shadou

Quote from: Exende on May 28, 2016, 04:36:47 PM
I use both and is playable, what is your problem with the mod?
Quote from: Shadou on October 10, 2015, 12:10:51 AM
In one of my games, I had an issue that I think I've tracked down to this mod. Colonists would perform actions they were incapable of. In particular, I had one colonist that was incapable of caring (no medicine skill), who seemed to have priority set to 1 on Doctoring even though he could not perform it and could not be given a Doctoring priority. It literally was the first thing he did when anyone got hurt, even though the work screen would not allow him to be given doctoring as a job. I had to draft him anytime I wanted to have any surgery done, so he wouldn't try to do it and maim the patient.

My current game, the only differences in my mod list from the game when I was having the issue are:
Added Edb's mod order
Added Edb's interface
Added Ykara's Expanded Prosthetics and Organ Engineering mod
Added Brunayla's Embrasures
Added Brunayla's Neurotrainer crafting
Removed Brunayla's bionic replacement production
Removed Brunayla's organ replacement production
Removed Hospitality

I really don't think any of the other mods I added or removed could be the cause or solution to this. I like the mod, but this is a rather potentially game-breaking bug. Please fix.

Edit: Just thought of something that might be a possible conflict. I have Wastelander's Mending mod installed, which adds a Mending job to the work list. By itself, Mending doesn't cause any issues, but with two mods messing with the priority list it may be a problem.

This. I never saw anything addressing this other than a generic 'thanks for the report' reply from Orion.

Nanao-kun

Orion has already said that Hospitality adds a job so adding or removing it from an existing save will mess up jobs.

Shadou

#741
I don't add or remove mods mid-play. The game where it was happening, hospitality was installed -from the beginning-. The game where I removed hospitality and it didn't happen was a -new game-. I am aware of the fact that adding or removing mods mid-play can play hell with save files, and have been utilizing clean-install save files since I started modding Minecraft. Please read the post more thoroughly next time before you post an answer that is both non-applicable and insulting.

Hatti

There is a bug in the "IncidentWorker_VisitorGroup.GiveItems" method which causes the method to run in an endless loop cause it cant fit the designated "value" variable in the while loop. If my game tries to spawn a visitor group it just hang up.
I modified the source for logging to see whats happened and added a very simple workarround.

Here the log:
Goodwill: 77.83885
Money: '0' maxValue: ' 263.5165
Current value is: 263.5165
Energieschild (gut) has this value: 1440
Will continue cue marketValue is greater
Current value is: 263.5165
12 gauge shell (Slug) has this value: 0.3
Will continue due marketValue is less
Current value is: 263.5165
5x35mm Charged cartridge has this value: 1.28
Will continue due marketValue is less
Current value is: 263.5165
bionisches Bein has this value: 4000
Will continue cue marketValue is greater
Current value is: 263.5165
skydriller has this value: 3000
Will continue cue marketValue is greater
Current value is: 263.5165
Chinchillafleisch has this value: 3.5
Will continue due marketValue is less


this goes on and on and on.

this is the method code which i modified:


private static void GiveItems(IEnumerable<Pawn> visitors)
        {
            Log.Message("Hospitality adding adding items for '" + visitors.Count() + "' pawns");
            foreach (var visitor in visitors)
            {
                if(Rand.Value < 0.5f) GuestUtility.TryGiveBackpack(visitor);

                float totalValue = 0;

                // Money
                Log.Message("Goodwill: "+visitor.Faction.ColonyGoodwill);
                var amountS = Mathf.RoundToInt(Rand.Gaussian(visitor.Faction.ColonyGoodwill, visitor.Faction.ColonyGoodwill))+Rand.Range(0, 50);
                if (amountS > Rand.Range(10, 50))
                {
                    var money = CreateRandomItem(visitor, ThingDefOf.Silver);
                    money.stackCount = amountS;

                    var spaceFor = GuestUtility.GetInventorySpaceFor(visitor, money);
                    if (spaceFor > 0)
                    {
                        money.stackCount = Mathf.Min(spaceFor, amountS);
                        var success = visitor.inventory.container.TryAdd(money);
                        if (!success) totalValue += money.MarketValue*money.stackCount;
                        else money.Destroy();
                    }
                }



                // Items
                float maxValue = (visitor.Faction.ColonyGoodwill + 10)*Rand.Range(3, 8);
                float value = maxValue - totalValue;
                Log.Message("Money: '"+totalValue + "' maxValue: ' " + maxValue);
                int curCount = 0;
                while (value > 100 && curCount < 200)
                {
                    curCount++;
                    Log.Message("Current value is: " + value);

                    bool apparel = Rand.Value < 0.5f;
                    ThingDef thingDef;
                    do thingDef = GetRandomItem(visitor.Faction.def.techLevel);
                    while (thingDef != null && apparel && thingDef.IsApparel);
                    if (thingDef == null) break;
                   
                    var amount = Mathf.Min(Mathf.RoundToInt(Mathf.Abs(Rand.Gaussian(1, thingDef.stackLimit/2f))),
                        thingDef.stackLimit);
                    if (amount <= 0) continue;

                    var item = CreateRandomItem(visitor, thingDef);

                    Log.Message(item.Label + " has this value: " + item.MarketValue);
                    if (item.MarketValue >= value)
                    {
                        Log.Message("Will continue cue marketValue is greater");
                        item.Destroy();
                        continue;
                    }
                    /*
                    if (item.MarketValue < value/3)
                    {
                        Log.Message("Will continue due marketValue is less");
                        item.Destroy();
                        continue;
                    }
                    */
                    var maxItems = Mathf.Min(Mathf.FloorToInt(value/item.MarketValue), 3);
                    Log.Message("MaxItems:" + maxItems);
                    if (maxItems < 1)
                    {
                        Log.Message("Will continue due max items");
                        item.Destroy();
                        continue;
                    }

                    Log.Message("Can fit " + maxItems+" of "+item.Label);
                    item.stackCount = Rand.RangeInclusive(1, maxItems);
                    Log.Message("Added " + item.stackCount + " with a value of " + (item.MarketValue * item.stackCount));

                    var spaceFor = GuestUtility.GetInventorySpaceFor(visitor, item);
                    if (spaceFor > 0)
                    {
                        item.stackCount = Mathf.Min(spaceFor, item.stackCount);
                        var success = visitor.inventory.container.TryAdd(item);
                        if (success) totalValue += item.MarketValue*item.stackCount;
                        else item.Destroy();
                    }
                    value = maxValue - totalValue;
                }
            }
            Log.Message("Hospitality adding adding items finished");
        }

Stormdrake

I am getting a horrible bug where no matter whether I get guests or just a party of passer bys they NEVER seem to make it home to their faction, I get a HUGE penalty for this and I have no idea why it happens, I have 0 experience with modding so I dare not try to fix it myself. I absolutely love the idea of this mod, but with this happening every time someone visits it is impossible to maintain faction relations and is destroying any possibility I have to trade making the game almost impossible. I have been forced to remover the mod which saddens me greatly. please let me know if you know why this happens or if there is anything simple I can do to fix it, otherwise I will play without Hospitality until a newer version is released and hope that will fix the problem

Orion

Quote from: Stormdrake on May 29, 2016, 10:24:00 PM
I am getting a horrible bug where no matter whether I get guests or just a party of passer bys they NEVER seem to make it home to their faction
Quote from: TheDreaded1 on May 28, 2016, 08:38:07 PM
Same issue with visitors leaving safely, but it doesn't register. All the factions hated me, which was kinda fun, but I turned it off until it's fixed. Game just isn't the same w/o it, but I'll make due for awhile.
Apparently a lot of people are getting this. I recommend using the previous version until there is a fix. I don't have the problem myself, which makes it hard for me to find the source. I think it will take at least 2 more weeks to pin it down (due to lack of time on my end).

Quote from: Hatti on May 29, 2016, 11:45:41 AM
There is a bug in the "IncidentWorker_VisitorGroup.GiveItems" method which causes the method to run in an endless loop cause it cant fit the designated "value" variable in the while loop. If my game tries to spawn a visitor group it just hang up.
I modified the source for logging to see whats happened and added a very simple workarround.
Odd that I never encountered this issue. I'll have to try on the workaround and see if it's a good replacement for the original code. Thanks!

Quote from: Shadou on May 29, 2016, 01:30:50 AM
Quote from: Shadou on October 10, 2015, 12:10:51 AM
In one of my games, I had an issue that I think I've tracked down to this mod. Colonists would perform actions they were incapable of. In particular, I had one colonist that was incapable of caring (no medicine skill), who seemed to have priority set to 1 on Doctoring even though he could not perform it and could not be given a Doctoring priority. It literally was the first thing he did when anyone got hurt, even though the work screen would not allow him to be given doctoring as a job. I had to draft him anytime I wanted to have any surgery done, so he wouldn't try to do it and maim the patient.

Edit: Just thought of something that might be a possible conflict. I have Wastelander's Mending mod installed, which adds a Mending job to the work list. By itself, Mending doesn't cause any issues, but with two mods messing with the priority list it may be a problem.

This. I never saw anything addressing this other than a generic 'thanks for the report' reply from Orion.
[/quote]
I'm sorry you're experiencing this. I just don't have the time to make a fix for every possible mod combination people try out. So, sorry to say, but take it or leave it.
RimWorld has a problem with new jobs being added. It does not check consistency so jobs can be assigned that the colonist can't even perform. It's on my list to put the consistency check in Hospitality which would solve the problem (kind of). But as you can maybe see from other posts, there are more pressing issues right now.

Quote from: zzz1000 on May 28, 2016, 01:48:31 PM
Can you make version where it only register on map deaths - I never try to capture or somehow exploit my guests anyway, it will eliminate any possible inconsistency.
I will probably resort to this, since the timer solution just isn't working right. So if people manage to otherwise vanish visitors, so be it.


PS: I will be away for 10 days, so excuse my (likely) lack of response. I'll try to check in every now and then, but I don't know yet how often that can be.

Hatti

Quote from: Orion on May 30, 2016, 04:00:25 AM
Odd that I never encountered this issue. I'll have to try on the workaround and see if it's a good replacement for the original code. Thanks!

just my changes isnt a good replacement at all:) its just a workarround that the loop have another exit condition in terms that the "while(value > 100) condition will never met or takes too long.

of couse you could add the workarround just to be sure, that the loop wont take too long but the real issue is
"  if (item.MarketValue < value/3) "
which will exclude several items depending on the visitors goodwill. In my case my visitors goodwill is at a factor where no itemvalue is greater than value/3 or less then value.

in case you wanted to exclude ammo you could use a constant like greater then 2 or something.
its also a balancing issue cause a bad goodwill will give you as a example components ( or advanced, if you are using EPOE). with a higher goodwill you will exclude components from visitors inventory list almost all the time

Orion

Okay, before leaving I did a fixing binge for you guys. Here's a new version:

Update
1.13b - 30.05.2016
- fix: factions will now get angry on death of visitors instead of after 2 days
- fix: creating visitors will not run into an infinite loop anymore


This should take care of the weird angry faction problem and the occasional game freeze. Let's hope for the best :)

Techgenius

Orion.. I don't get it why I've angered factions leaders for having their peons die on my colony, not my fault they decided to exit the area on a RAID and got killed, am I supposed to protect them inside my lands now? oh boy..

1000101

It seems to me that you should only be penalized for actions which happen inside your home zone.  Otherwise you could get penalized for a visitor just leaving on the opposite side of a 400x400 map just as raiders show up and kill some of them.
(2*b)||!(2*b) - That is the question.
There are 10 kinds of people in this world - those that understand binary and those that don't.

Powered By

TheDreaded1

#749
Awesome! Will try when i get home.. As far as being penalized, i look at it like this. Their last known location was your territory, so if anything happens, you're responsible.

*edit* if it bothers you too much, then make the chief only get angry if a member of your colony performs a hostile action against a visitor (attack, kill, arrest)