Ludeon Forums

Ludeon Forums

  • January 18, 2020, 09:09:05 AM
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  

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.

Topics - Duncan

Pages: [1]
1
Outdated / [B18] Realistic Starvation
« on: 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

2
Help / [A16] C# Auto-Documentation
« on: 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.


3
Help / Implementing a custom alert - double loading issue
« on: 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:
Code: [Select]
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?

4
Bugs / Colonist need treatment alert not shown if in medical bed
« on: February 02, 2017, 03:27:07 PM »
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.

5
Mods / [Mod Request] Randomised drug creation and testing
« on: December 21, 2016, 08:17:26 PM »
Now that there is the possibility of administering drugs to animals and prisoners, I thought it might be fun to add in a drug testing and experimentation mod.

Add in a set of drug plants that grow naturally and can be farmed, say around 10 different types. (xml)
Add in recipes to combine each of these plants at a specialised chemistry workbench in pairs and maybe also in threes. (xml)
Create a system that randomises the effects of the resulting drugs based on the world seed (c#)

This would result in the following gameplay (example): the player finds two of the plants growing wild on the map and mixes them together to create 'substance 12'. The player the administers this substance to the colony cat. The cat immediately goes berserk and has to be put down. Then the player gets another plant from a trader and mixes it with one of the natively found plants to make 'substance 7'. Testing it on a recently tamed pig shows the drug has a euphoric effect. The player then starts administering daily doses to a prisoner for a period of time. These tests show that the drug is addictive.

And so on. Randomising based on the world seed would mean that the player would need to test drugs separately for each colony and would not be able to use the results of previous games.

I could do this myself and may even do so at some point, but it wont be soon so if anyone wants to run with this feel free.

6
Bugs / Omnivorous animals wont eat vegetables
« on: April 05, 2016, 02:26:26 PM »
I have not tested this with many animals, only rimdogs. It is pretty consistent with rimdogs though. If you have some dogs with no zone restrictions, and a stockpile filled with potatoes, the dogs will starve to death.

Perhaps it is intended that dogs dont eat potatoes, but the wiki says otherwise

More likely it is a special case of bug 2091

I am playing with the SK modpack and have not bothered to test it in vanilla. Please forgive me if the mods turn out to be the cause

7
Ideas / Architecture menu too small/big for some mods
« on: July 12, 2015, 06:13:27 AM »
When a user has a lot of mods installed that add things to the architecture menu, the screen becomes very full when these menus are open. This is especially problematic on lower resolutions and 3:4 5:4 aspect ratio. In many cases it can become difficult to place these objects in the map because so little of it is visible.

Please see the attached image for an exaple.

I think the menu needs a rework, either divide things into tabs, or simply restrict its size and allow it to scroll or have multiple pages.

I was not sure if I should write this in the bug report forum as it is a collection of features which are working as intended that have a problematic consequence.

This is probably already on the radar as an issue but I wanted to make sure.

[attachment deleted due to age]

8
Outdated / [MOD] (Alpha 7) Mineable ores utility mod
« on: October 03, 2014, 07:53:53 AM »
Hi all, I was helping ItchyFlea with his Neolithic Mod and I built a system to make the game accept modded ores. I thought this could interest other modders too so I am posting it here.

This mod is designed for inclusion in other mods, not as a standalone mod. Do not simply install it in your game or you will get silly bright coloured minerals that drop AI cores, and no metal.

You can download it here.

Usage:

Copy the MineableMod.dll in the assembly folder and the ModMapGenerators.xml for the MapGeneratorDefs.

If you are using an already modded MapGenerator you can just change the part where it says:
Code: [Select]
<!-- Create rocks from Elevation grid -->
      <li Class="Genstep_RocksFromGrid" />

to
Code: [Select]
<!-- Create rocks from Elevation grid -->
      <li Class="MineableMod.Genstep_RocksFromGrid_Mod" />

This is the part that calls my custom mineable scatterer.

Each modded ore needs to have a <fillPercent></fillPercent> tag with the probability of it spawning. These numbers are relative, see notes below for details or just treat them as an actual percentage, which will work as expected.

This mod will not add any vanilla ores to the map unless there are no custom ones defined. If you want vanilla ores you will have to add Defs for them copied from core and give them an appropriate fillpercent.

Notes:
The tag fillPercent is an internal rimworld tag that is used to define cover effectiveness. 1 is 100% cover (bullets dont go through stone) so using values lower than 1 is not recommended.

fillPercent is normalised internally in my code so your ores don't have to add up to 100%. If you have 2 ores with 1000% each it will work out the same as if you have two ores with 50% each, the percentages are actually just relative float values. This is also not extensively tested so let me know if this causes problems.

The actual total amount of ore per map is still the same as vanilla. I could modify this easily enough but it might be difficult to make it xml moddable. If someone desperately needs a mod with half as much or twice as much ore per map I could probably make that happen.

License is CC/BY

9
Help / overriding classes - modding mineables in alpha 7 ??
« on: October 02, 2014, 12:27:47 PM »
It seems it is not possible to mod mineable minerals in alpha 7 despite new minerals being added. I read the code and it hinges on the Genstep_ScatterMineableChunks class. The addition of minerals to the map is hard coded by def name. I wrote the following modification to the class which would work if I could get the program to call it:

Code: [Select]

public class Genstep_ScatterMineableChunks_Test : Genstep_ScatterMineableChunks
    {
private static readonly IntRange ChunkSizeRange = new IntRange(20, 40);
protected override ThingDef RandomThingDefToScatter
{
get
{
float value = Rand.Value;
                if (value < 0.1)
                {
                    return ThingDef.Named("MineableTest");
                }
if (value < 0.03f)
{
return ThingDef.Named("MineableGold");
}
if (value < 0.06f)
{
return ThingDef.Named("MineablePlasteel");
}
if (value < 0.11f)
{
return ThingDef.Named("MineableSilver");
}
return ThingDef.Named("MineableMetal");
}
}
}

The problem is this class is not referenced in any xml I can find. I don't know how to override a class that is not referenced in xml. Is it possible to get the program to call Genstep_ScatterMineableChunks_Test instead of Genstep_ScatterMineableChunks?

This is a general issue with modding and I have not found a thread which answers this question, possibly because the answer is obvious to coders familiar with dlls which I am not. If it is not possible then what is the point of the new minerals at all? There is an xml file for them but if you delete anything it crashes the game and if you add anything it ignores it.

10
Help / How does secondary equipment work?
« on: September 15, 2014, 10:27:54 AM »
Can anyone explain how to use secondary equipment and what properties and uses it has? I found that the Pawn_EquipmentTracker has a variable
public List<Equipment> secondaries = new List<Equipment>();
that seems to track a list of equipment items. I tried creating an equipment item and tagging it as secondary equipment but it seemed to crash the GUI and some other systems. While it is obviously possible I did it wrong, it is also possible that the system is simply not fully implemented or that there is a bug with it. My test was really a stab in the dark because I had no idea what to expect or how to set it up.

If anyone has modded any secondary equipment it would be greatly appreciated if you could explain briefly some of the features and usage. It does not appear to be used in the core mod.

11
Help / Low tech survival mod
« on: September 10, 2014, 11:30:13 AM »
I write the thread for two purposes, as a mod request, and as a mod help thread. I am a decent c# coder and have looked into doing this myself and I believe I can do it, but I have very little free time. If someone else is interested in doing some or all of this mod idea feel free, although mentioning that intention in this thread is probably a good idea.

The thread title should be relatively self explanatory. The idea is inspired from the game Unreal World and should involve a detailed progression from primitive neolithic stone tools, up to basic iron tools. After the end of this progression a basic communication device could be built and the normal technology progression would start, after buying some component for a research table from a trade ship.

There are a lot of possible features that could be included, but at the start I think it is a good idea to keep it simple and iterative. development progression would look something like:

1. Implement tools as equipment/apparel

2. make certain jobs require certain tools

3. Implement different tool qualities and types

4. build a progression of tool improvement up to the basic communication device

5. Tune the AI to prevent this mod from being way too hard

6. feature creep starts here


Looking into step 1.
I first investigated apparel. In my opinion one easy way to implement tools would be to add a new apparel layer in RimWorld.ApparelLayer called tools. this is nice because it wont break any other mods and the tool should always be rendered on top of clothing.

After this I noticed the equipment class includes a secondary equipment type, and that a pawn can carry multiple secondary equipment items. When I tried to mod in a test object with <equipmentType>Secondary</equipmentType> I get a runtime null reference exception in Verse.Pawn_EquipmentTracker.GetEquipmentCommands(). I can not make head or tail of this function in ILSpy it looks like gibberish.

Specific questions:

1. Anyone interested in this mode existing?
2. Anyone want to make it or help make it?
3. Would the apparel route or the secondary equipment route be the best way for implementing tools?
4. What does the GetEquipmentCommands() function do?

I will update this post with any progress I make. If this mod gets started in earnest and looks like it might happen I will make a new thread in the  mods/unfinished forum or ask a moderator to move it there.

Pages: [1]