Ludeon Forums

RimWorld => Mods => Releases => Topic started by: Pyrce on October 21, 2018, 08:45:52 PM

Title: [1.0] Swimming Kit
Post by: Pyrce on October 21, 2018, 08:45:52 PM
[1.0] Swimming Kit

A RimWorld mod which adds swimming attribute for pawns to change speeds while in water tiles.

(https://steamuserimages-a.akamaihd.net/ugc/948464026885900986/82592CE12E66FBEAFF6F85AA3EFF4351DFEF94B2/)


The mod acts as a toolkit for adding swimming statistics to the game. It makes pawns respect a new SwimSpeed baseStat for both moving through water and for planning pathing through water.

In working on another mod it took the better part of a long weekend to get all the various places that needed changing correct, so to save other modders time and to enable adding actual aquatic gear / pawns I put the changes together in this mod.


Change in Terrain

This mod makes Ocean and DeepWater tiles accessible. Normal pawns will move very very slow through ocean, but it is possible for pawns and items to now be in Ocean. If a pawn has SwimSpeed it will travel much quicker through ocean tiles.


Links
Steam (https://steamcommunity.com/sharedfiles/filedetails/?id=1542399915)
Github (https://github.com/MSeal/RimworldSwimming)


How to Use

Adding the `SwimSpeed` to any `ThingDef`'s `statBases` will apply swim speed when in water tiles.


<ThingDef ParentName="AnimalThingBase" ADogSaidBody="Tail">
    <defName>Turtle</defName>
    <label>turtle</label>
    <description>A tortoise that likes water</description>
    <statBases>
        <MoveSpeed>1</MoveSpeed>
        <!-- This makes turtle have a base speed of 4 in water -->
        <SwimSpeed>4</SwimSpeed>
    </statBases>
</ThingDef>


If you want to conditionally set a SwimSpeed only if this mod is present you can do the following:


// Dynamically set the SwimSpeed to avoid requiring SwimmingKit
StatDef swimDef = DefDatabase<StatDef>.GetNamed("SwimSpeed", false);
if (swimDef != null)
{
    ThingDef turtle = ThingDef.Named("Turtle");
    turtle.SetStatBaseValue(swimDef, 4.0f);
}


You can also effect SwimSpeed by modifying equipment.


<ThingDef ParentName="ArmorMachineableBase">
    <defName>Apparel_HydroPowerArmor</defName>
    <label>hydro plate armor</label>
    <description>Augmented power armor with built-in water-jets for fast traversal underwater.</description>
    </statBases>
    <equippedStatOffsets>
        <MoveSpeed>-1.0</MoveSpeed>
        <SwimSpeed>3.5</SwimSpeed>
    </equippedStatOffsets>
</ThingDef>


Code issues / questions also welcome on the SwimmingKit Github page (https://github.com/MSeal/RimworldSwimming).


License (MIT)

If you're a modder and want to use or extend this mod I ask only that you let me know (here or on steam). Otherwise feel free to use the mod in the making of further mods.


Credits

Icon Graphic Base (https://www.freeiconspng.com/img/3775)
Powered by Harmony Patch Library (https://github.com/pardeike/Harmony)
Title: Re: [1.0] Swimming Kit
Post by: Jiro on November 15, 2018, 09:21:22 AM
Alright! I've been looking for something like this. Will "drowning" and "water rescue" ever be added?
Title: Re: [1.0] Swimming Kit
Post by: vandal on November 15, 2018, 01:54:58 PM
Wow this is very cool.

Quote from: 中村ジロ on November 15, 2018, 09:21:22 AM
Alright! I've been looking for something like this. Will "drowning" and "water rescue" ever be added?
i like this idea. Maybe a variation of space refugee, a castaway too?
Title: Re: [1.0] Swimming Kit
Post by: Jiro on February 09, 2019, 01:56:59 AM
Is this already dead?
Title: Re: [1.0] Swimming Kit
Post by: eksynn on February 12, 2019, 01:53:04 PM
can i swim in the ocean with this?
man we really need boats
Title: Re: [1.0] Swimming Kit
Post by: Ruisuki on April 24, 2019, 05:54:24 AM
if the authors of yes vehicles ever figure out how to add vehicles(waiting on jecrells tools to update last i heard), it may be possible to do the same for boats