Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Duncan

#1
Outdated / Re: [A18] Realistic Starvation
December 02, 2017, 03:13:28 PM
Updated
#2
Outdated / Re: [A17] Realistic Starvation
July 06, 2017, 06:06:32 PM
I missed that faction leaders needs are handled differently than normal pawns. This has now been fixed in the current version. Enjoy.
#3
Outdated / Re: [A16] Realistic Starvation
May 22, 2017, 11:44:09 AM
So I rewrote the mod using the Harmony framework (https://github.com/pardeike/Harmony). This should make the mod much more stable and remove any compatibility issues with other mods.

***

@Modo44 I agree but Rimworld actually has a lot of those, and I am still waiting for fixes for the first ones I complained about. In terms of priorities I am hoping first for fixes to the problems that have direct effects even in the vanilla version. Hopefully one day refactoring to facilitate easier modding will get done too.
#4
Outdated / Re: [A16] Realistic Starvation
May 05, 2017, 06:40:53 PM
Updated mod:

-fixed starving animals alert
-removed debug message for pawns with no hunger need (mechanoids)
-Haplo's Misc. Robots compatibility: robots no longer get hungry

Sorry you went to so much trouble deshara218, I sympathise and regret being the cause. In my defence food is really hard coded in rimworld and most of these bugs are caused by the vanilla code referencing things which bypass the mod, usually bad coding practices. I believe I have fixed all the major examples of that now, the last one being that the the animals starving alert references the variable Pawn.needs.food.TicksStarving which is completely locked down and not accessible to any mod, and is initalised to a massive minus value. The colonist starving alert on the other hand checks Pawn.needs.food.Starving which actually tests if the creature is currently starving. The specific problem you had with the colonists not eating was caused by the weird method that the game uses to assign the food need. It actually checks all of the pawns needs to see if any of the are of the type Need_Food and the assigns the variable when it finds one. Assigning variables based on type checks is bad practice. This means you can override the class and then add it to all the pawns in xml and but it will never get added to their actual food need which is what all other classes access. This means that although they have a food need, they cant eat or starve or be hungry.

All my mod actually does is change some variables, it should have taken 5 minutes to make and been completely bug free on the first try. I guess I shouldn't complain too hard though, this is still an alpha.
#5
Outdated / Re: [A16] Realistic Starvation
April 09, 2017, 02:26:35 PM
Feel free Razzoriel. The source for the assembly is included in the mod if you need to modify anything.

Make sure you download the mod again if you already downloaded it, there was an intermittent issue with the first version which has now been fixed.
#6
Outdated / Re: [A16] Realistic Starvation
April 06, 2017, 04:51:03 AM
Good point skyarkhangel. I didn't think of that. And I was going to ask you to put this in your modpack, but I guess you aren't keen.

Well I still prefer it this way. Until thirst is implemented as a proper need it is possible to starve to death on a high rainfall map next to a lake. I really would like to see thirst and water in the game but that is much more effort to implement. This mod was just an evening's work.
#7
Mods / Re: Want to see YOUR mod in RimWorld?
April 05, 2017, 05:01:35 PM
You can add my realistic starvation mod. It very simple.
https://ludeon.com/forums/index.php?topic=31548.0

Bear in mind when integrating the source: The if() block at line 45 is just a hack because your code doesn't recognise my class as a valid Food_Need and it never gets added to the pawn as one. The only code changes that are really need are the values in NeedInterval() and FoodFallPerTickAssumingCategory(cat) and the constants BaseFoodFallPerTick and MalnutritionSeverityPerInterval.

I also noticed in this class never uses these constants in the vanilla game. Don't you get a bunch of annoying warnings about that?
#8
Outdated / Re: [A16] Mod Announcements Thread
April 05, 2017, 04:56:10 PM
Realistic starvation mod released:
https://ludeon.com/forums/index.php?topic=31548.0
#9
Outdated / [B18] Realistic Starvation
April 05, 2017, 04:50:50 PM
Download Link
Steam link: http://steamcommunity.com/sharedfiles/filedetails/?id=899134090

More realistic starvation numbers. Basically pawns will eat the same amount as usual when food is there, but when they are starving they will starve much more slowly, and suffer severe performance penalties.

I felt that the colonists starve far too fast in the vanilla game. In real life a person can survive 3 weeks without food. This goes up significantly if the person has a lot of body fat. I think the record with vitamin supplements is over a year. Additionally starvation is a crippling illness and the effects should reflect this.   
The hunger/starvation times are as follows (based on default starting hunger, not full) in hours (vanilla/this mod):
hungry - 8/10
very hungry - 12/17
starving(trivial) - 19/32
Minor starvation - 28/70
Moderate - 37/104
Severe - 46/116
Extreme(Unconscious) - 31/176
Death - 64/199

This means a colonist will now die after a bit over 8 days without food, instead of the vanilla 3.

Additional changes
-pawns recover from starvation slower
-pawns recover faster from starvation the more food they get (based on hunger level)
-starvation now comes with severe reductions to disease resistance, move speed and work speed (manipulation)

Update 2017.04.09
-Fixed an issue where food need was not initialised or could become uninitialised, resulting in pawns that were unable to eat and would eventually starve. The issue was rare but seemed to occur more frequently when mod was used with the SK-Hardcore pack

Update 2017.05.22
-Rewrote the mod using the harmony framework eliminating all known compatibility issues with other mods

Update 2017.07.07
-Updated mod to handle faction leaders frozen needs
#10
Mods / Re: Valve planning to monetize mods (again)
February 12, 2017, 06:25:23 AM
Most rimworld mods are already creative commons licensed and available on github, at least the best ones. You can't really undo that license. Patreon is better way to pay modders.
#11
True, you wouldn't really need to add in a bunch of new plants. Random worth is not a problem, but if the player has not identified what the drug does it should sell for almost nothing. People aren't going to pay for a drug you randomly mixed.

A more difficult  problem is having the drug unidentified but identifiable through testing. I am coming at this from a roguelike background. None of this is impossible though, just requiers some c#.
#12
Help / [A16] C# Auto-Documentation
February 11, 2017, 05:59:09 AM
I noticed there was a documentation thread for the XML and I thought it might be useful to make a similar doc for the C# modders. This can be found here.

I am not sure how useful this is as most people will probably be fine with just intellisense from VS, but if there are people looking for documentaton now it is there.

#13
Help / Implementing a custom alert - double loading issue
February 10, 2017, 08:32:08 AM
I am trying to implement a custom alert (relates to bug report https://ludeon.com/forums/index.php?topic=30217.0).

I realised I don't need to modify the existing alert but could just add an additional alert in that covers pawns in medical beds. I implemented a new alert with the following code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RimWorld;
using UnityEngine;
using Verse;

namespace Medical_Alert
{
    public class Alert_ColonistNeedsTendInBed : Alert
    {
        private IEnumerable<Pawn> NeedingColonists
        {
            get
            {
                return
                    from p in PawnsFinder.AllMaps_FreeColonistsAndPrisoners
                    where (HealthAIUtility.ShouldBeTendedNow(p) && RestUtility.InBed(p) && RestUtility.CurrentBed(p).Medical)
                    select p;
            }
        }

        public Alert_ColonistNeedsTendInBed()
        {
            this.defaultLabel = "ColonistNeedsTreatment".Translate();
            this.defaultPriority = AlertPriority.High;
        }

        public override string GetExplanation()
        {
            StringBuilder stringBuilder = new StringBuilder();
            foreach (Pawn current in this.NeedingColonists)
            {
                stringBuilder.AppendLine("    " + current.NameStringShort);
            }
            return string.Format("ColonistNeedsTreatmentDesc".Translate(), stringBuilder.ToString());
        }

        public override AlertReport GetReport()
        {
            Pawn pawn = this.NeedingColonists.FirstOrDefault<Pawn>();
            if (pawn == null)
            {
                return false;
            }
            return AlertReport.CulpritIs(pawn);
        }
    }
}


This does not work at all however. Not only does the alert not show up, I get a whole series of other issues:

  • "<something> already has short hash" errors on start
  • Unable to select a start region after world generation
  • (On load save) all vanilla alerts are shown twice on the alert list

I looked around for mods implementing similar functionality to see if I had missed anything and found this one: https://github.com/Aeryl/TempGauge/blob/master/Source/TempGauge/Alert_TemperatureGauge.cs

I can not see any major differences. Yet my mod seems to trigger multiple parts of the game to be loaded twice.

Anyone know what is going on here?
#14
I am definitely in favour of doctors automatically cancelling work to tend to patients. Having said that illnesses often happen to a number of colonists at the same time so I think the alert is still useful to have even if the doctors are on the case. It enables the player to prioritise which patients get care first if they wish. A player may also wish to modify the patients care settings (i.e give them better or worse medicine). A patient may have a long term illness and the player may want them getting high quality medicine, but patients also often tantrum and can get cuts and bruises. Player awareness of the care, and some micromanagement seem unavoidable.

It is also worth noting that a doctor should probably not cancel a job if he/she has a lower job priority on patient care than the current task.

Another complication is prisoners and guests, whether doctors should cancel jobs for those is questionable and may depend on the player.
#15
If a colonist needs medical treatment an alert is shown (Alert_ColonistNeedsTend)

If a colonist lies down in a medical bed the alert is no longer shown

The player still needs to know about medical needs, regardless of beds. I would expect this alert to show regardless of bed status.

Reproduction:
1. There needs to be a colonist with an untreated wound or illness, and a medical bed. This can easily be achieved with cheats in dev mode.
2. When the colonist is not in the bed, observe that the alert is shown
3. Send the colonist to the medical bed
4. Observe that the alert is no longer shown to the player

Due to this situation being common and easily repeatable I have ommitted the log and savegame. If either of these are required please let me know and I will gladly add them to the report.

Note: At first I thought this was an intentional feature, and maybe it is. I find it counterintuitive though and it causes a lot of problems because an illness or wound can become life-threatening very fast if the doctor is busy, and medical beds are a useful way to locate the sick in a specific room and ensure that they have a good bed. The result is that if the player wishes to use medical beds they must constantly monitor the health screen of any pawn in the bed and mouse over any illnesses to check if treatment is required so that doctors can be interrupted and sent to treat the patient.

I originally intended to simply make a mod to rectify this but the decompiler cant seem to correctly decompile the section of code that deals with this.