Ludeon Forums

Ludeon Forums

  • April 03, 2020, 07:01:30 AM
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: [1.0] Swimming Kit  (Read 7777 times)

Pyrce

  • Muffalo
  • *
  • Posts: 17
  • Refugee
    • View Profile
[1.0] Swimming Kit
« 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.



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
Github


How to Use

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

Code: [Select]
<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:

Code: [Select]
// 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.

Code: [Select]
<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.


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
Powered by Harmony Patch Library
« Last Edit: October 21, 2018, 09:05:13 PM by Pyrce »
Logged

pinpi

  • Colonist
  • ***
  • Posts: 128
    • View Profile
Re: [1.0] Swimming Kit
« Reply #1 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?
Logged

vandal

  • Drifter
  • **
  • Posts: 55
  • Refugee
    • View Profile
Re: [1.0] Swimming Kit
« Reply #2 on: November 15, 2018, 01:54:58 PM »

Wow this is very cool.

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?
Logged

pinpi

  • Colonist
  • ***
  • Posts: 128
    • View Profile
Re: [1.0] Swimming Kit
« Reply #3 on: February 09, 2019, 01:56:59 AM »

Is this already dead?
Logged

eksynn

  • Drifter
  • **
  • Posts: 24
  • Refugee
    • View Profile
Re: [1.0] Swimming Kit
« Reply #4 on: February 12, 2019, 01:53:04 PM »

can i swim in the ocean with this?
man we really need boats
Logged

Ruisuki

  • Colonist
  • ***
  • Posts: 933
  • Hunter of Pinochet's followers
    • View Profile
Re: [1.0] Swimming Kit
« Reply #5 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
Logged