Ludeon Forums

Ludeon Forums

  • August 17, 2022, 04:16:43 AM
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 2 [3] 4 5 ... 8

Author Topic: [A12d] Community Core Library (v0.12.3b)  (Read 126371 times)

mrofa

  • Planetologist
  • ****
  • Posts: 1668
  • Squirrel Hunter
    • View Profile
Re: [A11b] Community Core Library (v0.11.2)
« Reply #30 on: July 09, 2015, 12:54:09 PM »

I think you can check traversability ,fillprocent and attlitudelayer. This should be engouh for most things
Logged
All i do is clutter all around.

1000101

  • Planetologist
  • ****
  • Posts: 1344
  • RimFortress Builder
    • View Profile
Re: [A11b] Community Core Library (v0.11.2)
« Reply #31 on: July 09, 2015, 04:48:42 PM »

I took a look at what I can do about it and changed the code as follows:

Code: [Select]
            Building support = c.GetEdifice();
            if( ( support == null )||
                ( ( support.def.graphicData.linkFlags & ( LinkFlags.Rock | LinkFlags.Wall ) ) == 0 ) )
            {
                return "MessagePlacementAgainstSupport".Translate();
            }

So, if a building is an edifice AND links with walls or rock it's valid.  This generally only applies to walls and mineable rocks (not chunks) which is the intent.
Logged
(2*b)||!(2*b) - That is the question.
There are 10 kinds of people in this world - those that understand binary and those that don't.

Powered By

mipen

  • Colonist
  • ***
  • Posts: 545
  • {0} has gained the infirm trait!
    • View Profile
Re: [A11b] Community Core Library (v0.11.3)
« Reply #32 on: July 11, 2015, 04:36:26 AM »

Hey 1000101, I was thinking of making a new def type that would let you change things in existing defs easily, to stop people having to overwrite the entire def. Would it be okay if I add it as a pull request to be merged with CCL?
Logged

1000101

  • Planetologist
  • ****
  • Posts: 1344
  • RimFortress Builder
    • View Profile
Re: [A11b] Community Core Library (v0.11.3)
« Reply #33 on: July 11, 2015, 01:10:21 PM »

Absolutely!

The whole idea of CCL is to be not just one persons code but generic redundant code from all for all.  I am actually thinking about removing the sunlamp building due to the fact that it's not overly generic and is more of a niche thing.
« Last Edit: July 11, 2015, 01:12:03 PM by 1000101 »
Logged
(2*b)||!(2*b) - That is the question.
There are 10 kinds of people in this world - those that understand binary and those that don't.

Powered By

jacob814

  • Colonist
  • ***
  • Posts: 236
  • Tinker
    • View Profile
Re: [A11b] Community Core Library (v0.11.3)
« Reply #34 on: July 23, 2015, 04:54:30 PM »

I am a little annoyed unhappy with the colored lights approach. It may work with the vannila light but with mine modded lights, some of my colored lights have different attributes to them that make it not work. Example: the yellow/orange light has a comfort effect. I dont want this attribute for all lights.

Proposal. Make a categorized system like the stuff system, but for colors. This would give modders more room and compatibilty.
« Last Edit: July 26, 2015, 02:53:53 PM by jacob814 »
Logged
My Mods:
Glass&Lights

1000101

  • Planetologist
  • ****
  • Posts: 1344
  • RimFortress Builder
    • View Profile
Re: [A11b] Community Core Library (v0.11.3)
« Reply #35 on: July 23, 2015, 07:48:30 PM »

Being "annoyed" with it is meaningless since there are lots of "annoying" things in the game.  If would like to see a change, can you elaborate on it?  What are you trying to and how are you doing it?  What do you think the comp should be doing and how should it do that?

I'm trying to keep things generic enough to work with any mod but specific enough as to not be useless.

tbh, I'm not sure how "comfort" applies to light given the context of comfort in the game (which seems to deal with physical comfort, not psychological comfort).
Logged
(2*b)||!(2*b) - That is the question.
There are 10 kinds of people in this world - those that understand binary and those that don't.

Powered By

jacob814

  • Colonist
  • ***
  • Posts: 236
  • Tinker
    • View Profile
Re: [A11b] Community Core Library (v0.11.3)
« Reply #36 on: July 25, 2015, 09:20:45 PM »

Point be taken with the comfort :)

This also applies to any other item as well. How about sub categories like the stuff sytem but something modders can use to create tehre own sub categories under a single assets.
Example: Instead of designating lights how you do now have it that once you have it colored light research, you can find the colored lights  in a list where standing lamp is located like how the stuff system works.
Another Example: lets say I want to have different recipes with my celing lights(dyed glass and such) but would like to keep them under the ceiling light button. Same as the stuff system does with walls and such.

This would of course only be so it would be easyer to navigate the menu. The system you have for colored lights could be kept but if you have it under a system like I described it would be quicker to find what you want with less button pressing, same with carpets. I need to point out that this system should not be limited to colors.

Another idea similiar to this is the possibilty to add more menu tabs. For example: instead of having my celing lights under furniture, I could create a new tab for lights. This is possible allready with some coding but I think that if this "Light category" was premade for this mod, my mod and advance lights mod could take advantage of this. Some other mods could like this as well if they desire.

I may have been harsh about being "annoyed". I just think this could be handled better for all modders. I feel like the way implimented now is restricting and could be worked apon. Thanks for the great mod.
Logged
My Mods:
Glass&Lights

jacob814

  • Colonist
  • ***
  • Posts: 236
  • Tinker
    • View Profile
Re: [A11b] Community Core Library (v0.11.3)
« Reply #37 on: July 26, 2015, 03:29:23 PM »

What am I doing wrong. I am trying use the advance research to have multiple research requirements for  a few buildings. It doesnt seem to be working. I am getting two errrors as well and as well stumped.

Code: [Select]
<?xml version="1.0" encoding="utf-8" ?>
<Defs>

<AdvancedResearchDef>

<defName>BuildColoredCeilingLamps<defName>
<Priority>1</Priority>

<researchDefs>
<li>ColoredLights</li>
<li>GlassworksResearch</li>
</researchDefs>

<buildingDefs>
<li>CeilingLampYellow</li>
<li>CeilingLampViolet</li>
<li>CeilingLampOrange</li>
<li>CeilingLampRed</li>
<li>CeilingLampGreen</li>
<li>CeilingLampBlue</li>
</buildingDefs>

</AdvancedResearchDef>

</Defs>


Error Log:

Sorry didnt know how to coppy the error log.

I know I am doing this wrong but I couldnt figure it out with the examples.
Logged
My Mods:
Glass&Lights

1000101

  • Planetologist
  • ****
  • Posts: 1344
  • RimFortress Builder
    • View Profile
Re: [A11b] Community Core Library (v0.11.3)
« Reply #38 on: July 26, 2015, 05:02:29 PM »

You have not installed and activated CCL properly.

CCL MUST be installed and loaded.  DO NOT simply copy the DLL from CCL to your mod.  I can not stress this enough to people and it has come up a couple times.  Copying CCL in part or in whole to your mods directory WILL cause errors and possibly cause the earth to crash into the sun (you have been warned).

CCL users should be downloading "CCL_vx.y.z.zip" and installing as normal.

For modders, I recommend downloading the source package.  The source package requires you to copy "_Mod/Community Core Library" to your games mod directory and enable the CCL mod as normal.  The rest of the source package is all the reference materials to make mods for CCL.  For purely xml based mods, "_Mod/Modders Resource" [should] contains examples for everything which doesn't have a core mod tweak, ie, no modders resource for CompPowerLowIdleDraw.

If installed correctly as a user, modder or space pope, your modsConfig file should look something like this:
Code: [Select]
<?xml version="1.0" encoding="utf-8"?>
<ModsConfigData>
    <buildNumber>nnn</buildNumber>
    <activeMods>
        <li>Core</li>
        <li>Community Core Library</li>
        <li>EVERYTHING ELSE</li>
    </activeMods>
</ModsConfigData>
Additionally you should see a line in your output log which reads "Community Core Library :: Advanced Research :: Initialized."
(Your RimWorld log file can be found in "RimWorldnnnPlatform_Data/output_log.txt".)

CCL is independent of everything except the Core mod and is designed to be upgraded independently.  This is so updates can automagically provide new features to existing CCL based mods without those mods also updating.  For example, since the first release CompColoredLight has a gizmo for changing the light color, v0.11.3 the same comp adds gizmos for sharing the color with other CompColoredLights and all the user has to do is update CCL to use them.

CCL is a mod like any other mod.  The only difference is it's intended purpose, aside from some basic vanilla core changes to take advantage of it's features; there is more than just an assembly (DLL) for CCL.  All* the files in the client package are required, there is nothing which is "optional."  The options come from other mods taking advantage of what CCL offers.

* Changes which are technically optional are changes to production tables (CompPowerLowIdleDraw) and the standing lamps (CompColoredLight), but who doesn't want those?

Edit:  Looking closer at your screen capture, it looks like you may have unzipped CCL into a parent zip directory name.  Check that it's unzipped correctly, the directory should be "Mods/Community Core Library", not "Mods/CommunityCoreLibrary-x.y.z"
« Last Edit: July 26, 2015, 05:21:29 PM by 1000101 »
Logged
(2*b)||!(2*b) - That is the question.
There are 10 kinds of people in this world - those that understand binary and those that don't.

Powered By

jacob814

  • Colonist
  • ***
  • Posts: 236
  • Tinker
    • View Profile
Re: [A11b] Community Core Library (v0.11.3)
« Reply #39 on: July 26, 2015, 06:33:59 PM »

I like how you have a copypast for this XD
Logged
My Mods:
Glass&Lights

jacob814

  • Colonist
  • ***
  • Posts: 236
  • Tinker
    • View Profile
Re: [A11b] Community Core Library (v0.11.3)
« Reply #40 on: July 26, 2015, 07:13:23 PM »

My code still doesnt work even with the mod install correctly(facepalm)

Code: [Select]
<?xml version="1.0" encoding="utf-8" ?>
<Defs>

<AdvancedResearchDef>

<defName>BuildColoredCeilingLamps</defName>
<Priority>1</Priority>

<researchDefs>
<li>ColoredLights</li>
<li>GlassworksResearch</li>
</researchDefs>

<buildingDefs>
<li>CeilingLampYellow</li>
<li>CeilingLampViolet</li>
<li>CeilingLampOrange</li>
<li>CeilingLampRed</li>
<li>CeilingLampGreen</li>
<li>CeilingLampBlue</li>
</buildingDefs>

</AdvancedResearchDef>

</Defs>

the errors are gone though
Logged
My Mods:
Glass&Lights

1000101

  • Planetologist
  • ****
  • Posts: 1344
  • RimFortress Builder
    • View Profile
Re: [A11b] Community Core Library (v0.11.3)
« Reply #41 on: July 26, 2015, 09:42:34 PM »

Well, that xml looks correct and I am assuming at this point you are getting the CCL AR log message to indicate it's running.

Copy _Mod/Modders Resource/Advanced Research/Ancient Tech to your mods directory and enabling it.  That will hide the normal cryptosleep and allow you to build the ancient cryptosleep and demonstrates hiding and enabling buildings.  If that doesn't work, it would imply there is a bug in CCL.

I am using CCL 0.11.4 (not yet released) but nothing about the advanced research has changed so if you want to send me your mod I'll give it a test.  Perhaps there is a bug in CCL but I don't think so.
« Last Edit: July 26, 2015, 09:44:53 PM by 1000101 »
Logged
(2*b)||!(2*b) - That is the question.
There are 10 kinds of people in this world - those that understand binary and those that don't.

Powered By

ypBwivc2aji6

  • Muffalo
  • *
  • Posts: 3
  • Refugee
    • View Profile
Re: [A11b] Community Core Library (v0.11.3)
« Reply #42 on: July 29, 2015, 12:49:00 PM »

Hi,

I've been playing around with this, and given that the LowIdleDraw code already automatically turns glow on/off, I figured I start with something easy and make a motion activated light.

Community Core Library has been added to the Mods folder and is being loaded right after Core.

As I'm currently running the Ultimate Overhaul Modpack (V 1.0115),  I decided to use the "lighted wall" as a basis, making a copy of the xml, adding a few "motion" in the appropriate name and description elements, and adding both CompColoredLight and CompPowerLowIdleDraw to it.

The result looks like this:
Code: [Select]
<ThingDef ParentName="BuildingBase">
<defName>WallLightedMotion</defName>
<label>motion-activated lighted wall</label>
<thingClass>Building</thingClass>
<category>Building</category>
<description>A motion-activated lighted wall with a built in light.</description>
<graphicData>
<texPath>Things/Building/SCWalls/WallLights_Atlas</texPath>
<graphicClass>Graphic_Single</graphicClass>
<linkType>CornerFiller</linkType>
<linkFlags>
<li>Wall</li>
<li>Rock</li>
</linkFlags>
</graphicData>
<uiIconPath>Things/Building/SCWalls/WallLights_MenuIcon</uiIconPath>
<blueprintGraphicData>
<texPath>Things/Building/Linked/Wall_Blueprint_Atlas</texPath>
</blueprintGraphicData>
<statBases>
<MaxHitPoints>300</MaxHitPoints>
<WorkToMake>150</WorkToMake>
<Flammability>1.0</Flammability>
</statBases>
<leaveResourcesWhenKilled>false</leaveResourcesWhenKilled>
<altitudeLayer>BuildingTall</altitudeLayer>
<passability>Impassable</passability>
<castEdgeShadows>true</castEdgeShadows>
<fillPercent>1</fillPercent>
<coversFloor>true</coversFloor>
<placingDraggableDimensions>1</placingDraggableDimensions>
<tickerType>Normal</tickerType>
<rotatable>false</rotatable>
<selectable>true</selectable>
<neverMultiSelect>true</neverMultiSelect>
<terrainAffordanceNeeded>Heavy</terrainAffordanceNeeded>
<holdsRoof>true</holdsRoof>
<designationCategory>Structure</designationCategory>
<staticSunShadowHeight>1.0</staticSunShadowHeight>
<blockLight>false</blockLight>
<CostList>
<SteelBar>1</SteelBar>
<Glass>5</Glass>
</CostList>
<stuffCategories>
<li>Metallic</li>
<li>Woody</li>
<li>Stony</li>
</stuffCategories>
<costStuffCount>6</costStuffCount>
<building>
<ignoreNeedsPower>false</ignoreNeedsPower>
</building>
    <Comps>
<li>
<compClass>CompPowerTrader</compClass>
<transmitsPower>true</transmitsPower>
<basePowerConsumption>50</basePowerConsumption>
<shortCircuitInRain>false</shortCircuitInRain>
<soundPowerOn>PowerOnSmall</soundPowerOn>
<soundPowerOff>PowerOffSmall</soundPowerOff>
</li>
<li>
<compClass>CompGlower</compClass>
<glowRadius>12</glowRadius>
<glowColor>(217,217,208,0)</glowColor>
</li>
      <li Class="CommunityCoreLibrary.CompProperties_ColoredLight">
        <compClass>CommunityCoreLibrary.CompColoredLight</compClass>
      </li>
      <li Class="CommunityCoreLibrary.CompProperties_LowIdleDraw">
        <compClass>CommunityCoreLibrary.CompPowerLowIdleDraw</compClass>
        <idlePowerFactor>0.1</idlePowerFactor>
        <operationalMode>WhenNear</operationalMode>
      </li>
</Comps>
<damageMultipliers>
<li>
<damageDef>Bomb</damageDef>
<multiplier>3</multiplier>
</li>
</damageMultipliers>
<researchPrerequisite>LightedWalls</researchPrerequisite>
</ThingDef>

Unfortunately, building one of these then results in the debug log popping up with a red error (and the counter keeps increasing very quickly). See the attached PowerError.png for the callstack. (Couldn't figure out if there is any way to copy the debug log as text, or if it's being saved somewhere as text automatically).

Looking at your source, it appears that compPower is null in CompPowerLowIdleDraw.isItIdle, but the ThingDef does have a CompPowerTrader, and Log.Message( "Community Core Library :: CompPowerLowIdleDraw :: '" + parent.def.defName + "' needs compPowerTrader!" ); didn't get logged, so I'm not sure how that could happen.

As I was already looking through the source, I checked out what "WhenNear" actually means, and unfortunately I found that your and my definition of near in this context is very different.

If I read your code right, then "near" in this case (no interaction point) means the cell occupied by the wall, and the 8 cells around it.

So to make this actually work, beyond fixing whatever problem is causing the null pointer exception (be it a mistake in my xml definition or your code), will require the addition of a "within glow radius" operational mode. When building the scan positions for that, it should start at the object, then move up to "glowRadius from CompGlower" steps (only in 4 ways, not 8), stopping at any cell that has blockLight true. It would be nice if sleeping pawns could be ignored when scanning.

I'm not sure what the performance implications will be of having a lot of objections with relatively large scan ranges around. One possible optimization would be to remember the pawn that has been found in range, and on further ticks, only null that reference and start a new scan if that pawn is no longer in range. But that still won't prevent the probably relatively high cost of scanning if nothing is in range.


On to a different problem, when I loaded a savegame where that motion-activated wall was already build, I got a single NullReferenceException right after load pointing at something going wrong in CompColoredLight. I've attached the callstack as ColorError.png








[attachment deleted due to age]
Logged

1000101

  • Planetologist
  • ****
  • Posts: 1344
  • RimFortress Builder
    • View Profile
Re: [A11b] Community Core Library (v0.11.3)
« Reply #43 on: July 29, 2015, 04:44:28 PM »

Quote from: ypBwivc2aji6
Hi,

I've been playing around with this, and given that the LowIdleDraw code already automatically turns glow on/off, I figured I start with something easy and make a motion activated light.
LowIdleDraw isn't really intended to be used with ColoredLights, part of the reason is that some of the optimization strategies used by LowIdleDraw such as grabbing the needed ThingComps (power, glower) once would be defeated by changing the comp out from under it.  The code could be changed to get the comp via a property, but I'd rather avoid a bunch of getter properties if I can as a call is a lot more expensive then a memory reference and in some cases, it could actually end up being a long call chain.  Thus, it's done once and the result is cached.

Quote from: ypBwivc2aji6
Community Core Library has been added to the Mods folder and is being loaded right after Core.

As I'm currently running the Ultimate Overhaul Modpack...

Unfortunately, building one of these then results in the debug log popping up with a red error (and the counter keeps increasing very quickly). See the attached PowerError.png for the callstack. (Couldn't figure out if there is any way to copy the debug log as text, or if it's being saved somewhere as text automatically).
(You can find your log in /RimWorld/RimWorldNNNWin_Data/output_log.txt)

Quote from: ypBwivc2aji6
Looking at your source, it appears that compPower is null in CompPowerLowIdleDraw.isItIdle, but the ThingDef does have a CompPowerTrader, and Log.Message( "Community Core Library :: CompPowerLowIdleDraw :: '" + parent.def.defName + "' needs compPowerTrader!" ); didn't get logged, so I'm not sure how that could happen.
That is a strange thing unless you are changing out your power trader too.  I could see errors like that happening if the glower was changed, but the power trader should be static in this sense so the reference to it should be valid.

Quote from: ypBwivc2aji6
As I was already looking through the source, I checked out what "WhenNear" actually means, and unfortunately I found that your and my definition of near in this context is very different.

If I read your code right, then "near" in this case (no interaction point) means the cell occupied by the wall, and the 8 cells around it.
"WhenNear" is intended for things in close proximity such as doors and the NPD.  So near is the entire area of the building and all adjacent cells and it discards cells which a pawn can't enter.  I choose this for a balance between speed and functionality.  For a larger radius I think it would just start lagging and there is Haplo's PowerSwitch mod which can be used for that purpose.

Quote from: ypBwivc2aji6
So to make this actually work, beyond fixing whatever problem is causing the null pointer exception (be it a mistake in my xml definition or your code), will require the addition of a "within glow radius" operational mode. When building the scan positions for that, it should start at the object, then move up to "glowRadius from CompGlower" steps (only in 4 ways, not 8), stopping at any cell that has blockLight true. It would be nice if sleeping pawns could be ignored when scanning.

I'm not sure what the performance implications will be of having a lot of objections with relatively large scan ranges around. One possible optimization would be to remember the pawn that has been found in range, and on further ticks, only null that reference and start a new scan if that pawn is no longer in range. But that still won't prevent the probably relatively high cost of scanning if nothing is in range.
Performance is certainly an issue and that is why I specifically opted to not to have a radial scan.  In your example, even a small base with only 50 walls doing radial scans every ~30 ticks would really start to lag.  I decided instead to leave anything that wanted such a power toggle scheme to using the more centralized approach of the power switch mod.

Quote from: ypBwivc2aji6
On to a different problem, when I loaded a savegame where that motion-activated wall was already build...
Loading a know-bad save will cause that.  Since you already knew that there was a problem with what you were attempting, I'm not sure why you would think any save would be valid.  :P
« Last Edit: July 31, 2015, 03:20:56 PM by 1000101 »
Logged
(2*b)||!(2*b) - That is the question.
There are 10 kinds of people in this world - those that understand binary and those that don't.

Powered By

jacob814

  • Colonist
  • ***
  • Posts: 236
  • Tinker
    • View Profile
Re: [A11b] Community Core Library (v0.11.4)
« Reply #44 on: August 03, 2015, 03:16:03 PM »

I am not getting the log msg saying CCL is loaded. It does show that in my modsconfig that ccl is loaded second and I assume that ccl is working because my machines are not useing power unless being in use as well as colored lights work. I did get CCL to work with my mod because I have gotten my ceiling lights only placable under a roof and my wall light only placable on a wall.

I tried what you said with putting Ancient tech mod into the mods folder and running it which i did. The problem is that is did show the ancient cryosleep casket without anything researched.

I am not getting error logs either so I am lost. It seems like CCL is running because of the colored lights. I did triple check to see if CCL was properly installed and I dont see why it isnt.

Here is my code: https://github.com/jacob814/Glass_N_Lights/releases/tag/0.5

Thankyou for you help.
Logged
My Mods:
Glass&Lights
Pages: 1 2 [3] 4 5 ... 8