Ludeon Forums

RimWorld => Mods => Help => Topic started by: XenGrimm on January 23, 2017, 06:40:30 AM

Title: Way to make glowing pawns?
Post by: XenGrimm on January 23, 2017, 06:40:30 AM
I've been working on several custom creatures (They're available on steam workshop, I'll post them up here soon) - one of which is a large "Spirit Wolf" that I am trying to apply a subtle glow effect to.

The problem is: The glow effect is not sticking to the pawn - it's sticking at their spawn location.

I'm trying to use this bit of code to apply the glow effect:

<comps>
      <li Class="CompProperties_Glower">
        <glowRadius>4</glowRadius>
        <glowColor>(46,161,228,0)</glowColor>
      </li>
</comps>


Can anyone shed any light on my light shedding issue?

EDIT: So - upon some further research, it seems Rimworld does not support movable lightsources without making a custom DLL or something. Burned.

Does anyone have anything like this in the works? Can anyone point me somewhere useful? Or is this a lost cause?
Title: Re: Way to make glowing pawns?
Post by: Vandris on January 23, 2017, 09:01:26 AM
I believe you can make something not be affected by lighting, which would be a cheap way to make something appear "glowing" but I'd say best bet is to try C# to actually make a mobile light source. I'm still a noob though, don't know a thing about C#
Title: Re: Way to make glowing pawns?
Post by: forestfey on January 23, 2017, 09:43:54 AM
you might be interested in looking at the Mining Helmet:
https://ludeon.com/forums/index.php?topic=14711.msg153940#msg153940 (https://ludeon.com/forums/index.php?topic=14711.msg153940#msg153940)

And what an interesting idea btw, I asked myself inspired by this if you can make slightly transparent textures? Have you tried that, it might be a nice effect, too?
Let me know if it works, I might be interested in using something like this, too :)
Title: Re: Way to make glowing pawns?
Post by: Vandris on January 23, 2017, 10:45:42 AM
Haven't looked at the mining helmet's files, but does it work because the lighting is assigned to a thing (helmet) that is then worn by a pawn? If so, you could make an invisible item for your creatures to wear in a similar way. Definitely is a cool concept. I hope it can work. :)
Title: Re: Way to make glowing pawns?
Post by: forestfey on January 23, 2017, 01:27:52 PM
actually, I haven't looked myself yet. I just linked it to you so you could get on crackin' ;)
I'm working on different construction sites at the moment. Please take a look how it's exactly done for yourself^^ I don't know if and when I get to it... but you're asking the right question I'd say! =)
Title: Re: Way to make glowing pawns?
Post by: squirrel gnut on January 23, 2017, 05:19:03 PM
I wonder if you created a Fang(s) for the Spirit Wolf, much like the Thrumbo Horn, and then added the glowing verse to the Fang(s)...that might solve your problem. I am interested in adding glowing to Core and other Mod items...just can't figure out how to make a new Mod def that will work. Seems simple...but...
Title: Re: Way to make glowing pawns?
Post by: XenGrimm on January 24, 2017, 03:08:54 PM
Looking at the mining helmet assembly - I think the key piece of code would be

IntVec3 intVec = IntVec3Utility.ToIntVec3(this.wearer.get_DrawPos());
if ((!ThingUtility.DestroyedOrNull(this.light) && intVec != this.light.get_Position()) || this.refreshIsNecessary)


the rest of the assembly seems to be rules for when people wearing the helmets should switch the light on or off.

Is there someone more familiar with C# who can tell me what I need to change for this?

I'm thinking I have to assign a new animal pawn class (newpawnytpe for hypothetical) within the assembly (and likely XMLs also?) and use this.newpawntype.get_Drawpos


Also - thanks a million for the info thus far. The mining helmet link was ESPECIALLY helpful.
Title: Re: Way to make glowing pawns?
Post by: XenGrimm on January 24, 2017, 03:33:24 PM
Quote from: squirrel gnut on January 23, 2017, 05:19:03 PM
I wonder if you created a Fang(s) for the Spirit Wolf, much like the Thrumbo Horn, and then added the glowing verse to the Fang(s)...that might solve your problem. I am interested in adding glowing to Core and other Mod items...just can't figure out how to make a new Mod def that will work. Seems simple...but...

Well, the thrumbo horn and elephant tusk aren't actually ITEMS until the creature dies and they are dropped.

I don't think it's calling any graphic data for the horns or tusks, just using them as a damage base.
Title: Re: Way to make glowing pawns?
Post by: forestfey on January 24, 2017, 05:28:09 PM
^interesting. And good to see some progress/learning! TEAMWÖÖÖRK  ;D