[A15] Wall Devices, Graphical Classes, Gizmos

Started by Reikenbach, September 14, 2016, 12:42:25 AM

Previous topic - Next topic

Reikenbach



Current work in progress with wall-mounted lights, switches and windows. All derive from Wall without an independent redefinition, so they should be compatible with any other mods and have their property values scale accordingly if the default Walls are changed. All three also come with bricks/planks/smooth texture variants.

The WallSwitch uses a custom Graphic_Flickable graphic class, which is a simplified subclass of my custom Graphic_States class. These new graphical classes will allow modders to define multiple sets of regular graphics (Graphic_Multi, Graphic_Appearances, Graphic_Single, etc.) for use by a single ThingDef without having to compile a new DLL. For example, the WallSwitch uses Graphic_Flickable to have two different sets of Graphic_Appearances for its On and Off states. Graphic_States currently requires the addition of a CompProperties_States ThingComp to the ThingDef so that custom states can be defined, while Graphic_Flickable only requires a CompProperties_Flickable.

I've also created a CompProperties_Commands class that will enable the creation of simple Command gizmos to modify the properties of Thing and its Comps. I'll be using this to add color switching to the wall lights (either via preset color definitions or direct RGB adjustments) but the gizmos could be used for other things, like adding different levels of power generation/fuel consumption to a generator or adjusting the appearance of a Thing using Graphic_States.

Feedback and suggestions are appreciated, especially regarding the graphics. I tried to stay somewhat close to the vanilla Rimworld art style but was not terribly successful. The WallSwitch I'm fairly happy with, though i'll probably end up changing the blue glow of the On state.

Deimos Rast

I don't do plugin, so I understood about half of what you said, but I think your artwork is solid. It's really hard to do windows given the style, and your's work well. The wall on the right, while I like it, has a lot going on, and strikes me as a bit too "loud" and "busy". The middle one, naturally, is just right. ;D

Would you be releasing anything for the end user or is this largely proof of concept, for other modders to adapt?
I happen to maintain a couple of lighting mods that previously relied on ccl for color switching, and it's a need that is currently going unmet.
Hypothetically...
#StopPluginAbuse

Master Bucketsmith

I'm not seeing a download link with source files! :D I wanna marvel at how you did it. I'd like to learn.
I'm especially interested in what you made for the gizmos!

Your graphics are fine.
Maybe make the switch a building you build on top of a wall, and have the switch graphic on only one side? Set it to rotatable or graphic_multi so you can get the graphic of the switch on any side.

Do the windows allow light to pass through?

Deimos Rast

iirc cupropanda's window's gave a positive moodlet for being able to see outside
#StopPluginAbuse

Reikenbach



New windows. Inspired by jacob814's [A14] glass+lights but entirely custom artwork and available in Stuff-specific variants. Feedback appreciated.

The problem with making a single-direction switch is that Flickable objects do not care which direction they're flicked from. As a result, I thought it better to account for all possibilities rather than make a rotatable one-face switch. Surrounding a WallSwitch with other linkable structures like vanilla walls will make it only have one side with a visible switch and only accessible from that same side, too.

Windows let light through but due to how the engine handles the sun, daylight will not pass through a window with a roof overhead. I believe cupropanda's windows functioned similarly to a Television. Not sure if that will work well with a linkable structure but I can check.

I had to use type reflection for some of the stuff (like, say, using a Def file-defined gizmo to adjust a Thing's Glower color or BaseEnergyConsumption) so I don't want to release anything before I do a few performance tests.

Master Bucketsmith

Quote from: Reikenbach on September 14, 2016, 10:25:51 AM
New windows. Inspired by jacob814's [A14] glass+lights but entirely custom artwork and available in Stuff-specific variants. Feedback appreciated.

The problem with making a single-direction switch is that Flickable objects do not care which direction they're flicked from. As a result, I thought it better to account for all possibilities rather than make a rotatable one-face switch. Surrounding a WallSwitch with other linkable structures like vanilla walls will make it only have one side with a visible switch and only accessible from that same side, too.

Windows let light through but due to how the engine handles the sun, daylight will not pass through a window with a roof overhead. I believe cupropanda's windows functioned similarly to a Television. Not sure if that will work well with a linkable structure but I can check.

I had to use type reflection for some of the stuff (like, say, using a Def file-defined gizmo to adjust a Thing's Glower color or BaseEnergyConsumption) so I don't want to release anything before I do a few performance tests.
The new windows are looking nice.
They still look like this MASSIVE chunk of glass,  though. Maybe give them an 'indent' look where the glass starts/ends deeper into the texture?

I get that the functionality of the switch is like that. It was merely a suggestion for the graphics.

If you stumble upon hurdles that make you doubt about the entire project and/or releasing anything, then please do release what you have!
I think a lot of valuable work has been lost because some people abandon their work at some point (which is fine, they have reasons), but it might have helped someone else. People wanting to learn, or for inspiration. Or maybe someone finds a solution to a specific hurdle. Maybe the next alpha will do away with the hurdle and someone can continue the work.
So please consider this if it ever comes to that! :)

Reikenbach

They're supposed to be two separate panes of glass separated by an air pocket for insulation, rather than one huge solid block of the stuff. The panes actually are slightly inset from the exterior surface with a beveled edge, if you look closely. I'll see if I can make that a little more evident, since it didn't come through too well on the bottom lip of the screen-facing side. Probably going to do a reinforced variant with thicker glass and metal bands, too.

I'll make a single-sided rotatable variant for the WallSwitch. It looks like I'm going to have to make a Comp_FlickableCustom, too, since the graphic isn't updating until the power grid changes. Vanilla switches are hard-coded to force a power grid update when toggled, but I can just make that a Def file option.

Also looking into introducing Sand and Mud as a resources used to produce glass, silicon and clay for windows, computer bits, art objects, bricks and whatnot. Separate mod from the walls/windows, and probably going to have to treat Glass as a Metal since it doesn't look like we can define new Stuff categories without essentially cloning a massive portion of the game's code.

Master Bucketsmith

I thought that bevel was just the vertical wall face.
Good work man!

Personally, I'm a bit tired of having so many mods that add resources. If you have a large modlist with mods that add resources, it saturates the map. On the other hand, the equivalent is having all of those mods use vanilla resources and that might mean there's not enough on one map to go around. I really wish we could send expeditions for resource gathering to neighbouring tiles!

Deimos Rast

Quote from: Reikenbach on September 14, 2016, 11:47:33 AM
Also looking into introducing Sand and Mud as a resources used to produce glass, silicon and clay for windows, computer bits, art objects, bricks and whatnot. Separate mod from the walls/windows, and probably going to have to treat Glass as a Metal since it doesn't look like we can define new Stuff categories without essentially cloning a massive portion of the game's code.
Since you already know of cupro's windows you probably already know his mod adds sand, and mud and such, yes?
This is beginning to sound more like an entire "glassworks" mod. Incidentally, there is a mod by that name on nexus I believe, might be worth a look.
I share Bucket's hesitation of adding a ton of new resources, unless they are in use by other mods already. This game sorely lacks resource uniformity, and I'd rather not have duplicate sand.
Just my 0.02c which might not even be worth that much. ;D
#StopPluginAbuse

Reikenbach

Quote from: Master Bucketsmith on September 14, 2016, 03:41:47 PM
I thought that bevel was just the vertical wall face.
Good work man!

Personally, I'm a bit tired of having so many mods that add resources. If you have a large modlist with mods that add resources, it saturates the map. On the other hand, the equivalent is having all of those mods use vanilla resources and that might mean there's not enough on one map to go around. I really wish we could send expeditions for resource gathering to neighbouring tiles!

Would probably be acquired at an inexhaustible "quarry" type building you stuck on Mud or Sand tiles, rather than one acquired by mining. But yeah, I get that adding more resources is something a lot of people don't like, hence why if I did do it it would be an entirely separate mod pack. These Wall devices will be vanilla resources only.

Reikenbach



Update after a week of frustrating bughunting. Turns out it was my fault for using a volatile register. Everything seems to work now, thankfully, and I haven't run into any issues when running the stuff with other mods.

Got rid of the ugly circle on top of the switch. Slight change to the windows to try and make the inset more noticeable. Couple more attempts at getting the light to look better - long lights look pretty good, round ones still ugly.

Anyway, going to release in the next day or two. Two separate mods: one "core/essentials" pack that's mostly just the DLL I'll use for future mods and one containing the actual wall stuff. Will do a readme for modding with the DLL.

Reikenbach



Preview with regards to the XML gizmos. Light on the left has had the Red portion of its RGB values set to about 0 using the "Less Red" button, while the one on the right has a Red of about 0.8 to 0.9.

Gizmos are defined as follows:

<?xml version="1.0" encoding="utf-8" ?>
<Reikentech.CommandDefs>

<Reikentech.CommandDef>
    <defName>DecreaseGlowerRed</defName>
    <label>Less Red</label>
    <description>Decrease the Red value by 10%.</description>
<uiIconPath>Interface/Gizmos/Less_Red</uiIconPath>
<requirements>
<li>
<type>ResearchProjectDef</type>
<helper>ColoredLights</helper>
<property>IsFinished</property>
<value>true</value>
<reqType>Default</reqType>
</li>
</requirements>
<actions>
<li>
<compType>Reikentech.CompGlowerDynamic</compType>
<actionType>Offset</actionType>
<property>Red</property>
<value>-0.10</value>
</li>
</actions>
  </Reikentech.CommandDef>

<Reikentech.CommandDef>
    <defName>IncreaseGlowerRed</defName>
    <label>More Red</label>
    <description>Increase the Red value by 10%.</description>
<uiIconPath>Interface/Gizmos/More_Red</uiIconPath>
<requirements>
<li>
<type>ResearchProjectDef</type>
<helper>ColoredLights</helper>
<property>IsFinished</property>
<value>true</value>
<reqType>Default</reqType>
</li>
</requirements>
<actions>
<li>
<compType>Reikentech.CompGlowerDynamic</compType>
<actionType>Offset</actionType>
<property>Red</property>
<value>0.10</value>
</li>
</actions>
  </Reikentech.CommandDef>
</Reikentech.CommandDefs>


Adding Gizmos to a Thing involves giving it a CompProperties_Commands object:
<ThingDef ParentName="Wall" Name="WallLampBase" Abstract="True">
    <defName>WallLampBase</defName>
    <description>An impassable wall with an embedded electrical lamp. Capable of holding up a roof.</description>
<costList>
<Steel>30</Steel>
</costList>
    <building>
      <isInert>true</isInert>
      <ignoreNeedsPower>false</ignoreNeedsPower>
<canPlaceOverWall>true</canPlaceOverWall>
    </building>
<comps>
<li Class="CompProperties_Power">
        <compClass>CompPowerTrader</compClass>
        <basePowerConsumption>60</basePowerConsumption>
        <shortCircuitInRain>false</shortCircuitInRain>
<transmitsPower>true</transmitsPower>
      </li>
<li Class="CompProperties_Glower">
<compClass>Reikentech.CompGlowerDynamic</compClass>
        <glowRadius>12</glowRadius>
        <glowColor>(217,217,208,0)</glowColor>
      </li>
<li Class="Reikentech.CompProperties_Commands">
<commandGroups>
<li>
<type>Default</type>
<commands>
<li>DecreaseGlowerRed</li>
<li>IncreaseGlowerRed</li>
</commands>
</li>
</commandGroups>
</li>
</comps>
  </ThingDef>


In this case, CompProperties_Glower needed to have its ThingComp class set to a custom CompGlowerDynamic instead of the vanilla CompGlower, but otherwise it works about the same as usual.

Commands are separated into "Command Groups" because each group can be displayed in a different way according to the display type. Currently I have:


  • Default, which just displays all the gizmos
  • Toggle, which displays all the gizmos with on/off checkboxes
  • Radio, which which functions like Toggle except only one gizmo can be "On" at a given time
  • Radio_Linear, which is like Radio except it only displays the Previous, Current, and Next gizmos to save space. If the current gizmo is the first/last gizmo in the list, then only two gizmos are displayed. Designed for things like, say, sequential levels of power production on a generator (Low, Medium, High, Ultra).
  • Radio_Loop, which functions identically to Radio_Linear except the front of the list connects to the back and vice-versa.

SpaceDorf

Arise my child, your time has not yet come ..
I hope ..

does anyone have the textures created by Reikenbach ?
I try collecting Rimworld Textures that look Spacy.
Maxim 1   : Pillage, then burn
Maxim 37 : There is no overkill. There is only open fire and reload.
Rule 34 of Rimworld :There is a mod for that.
Avatar Made by Chickenplucker