RimWorld

RimWorld

LightsOut
This topic has been locked
Yoann 1 Dec, 2022 @ 7:52am
About MechGestator and LargeMechGestator
Sorry to insist, but why your mod can't skip these 2 buildings, as it does it for heater/cooler/turrets and some others?
Do you can't do it easily without having access to the Biotech C# files?

How can I help you to fix it (without C# skills)?
Can't you take a look from a gog version please?

I would be sad to have to disable this mod :'(
But I didn't find how to fix the things on my side...
< >
Showing 1-9 of 9 comments
juanlopez2008  [developer] 2 Dec, 2022 @ 7:05am 
Without having Biotech, I can't do any testing against Biotech buildings such as the Mech Gestators; in order to fix issues, I'd have to make an attempt at fixing something, then send it out to 50k+ people completely untested to see if it worked. I take pride in keeping the quality of my mod high, and using my subscribers as beta testers doesn't fit that mindset.

Further, the items you listed are all ignored because they either aren't a Building_WorkTable or have a CompHeatPusher. My mod primarily uses what kind of building something is and what comps it has in order to disqualify things. The mech gestators aren't disqualified because they should be affected by my mod, they just have a different mechanic that I can't account for without owning Biotech. It doesn't just skip those buildings by name, otherwise mod support would be a complete nightmare.

Regarding "can't you take a look from a gog version please?" I'm not intending to buy Biotech because I don't have time to play RimWorld these days and I feel like it would be a waste of money for something I won't play; further, I also don't intend to pirate Biotech just for the purpose of testing my mod -- that's not fair to the developers.

Does this version[filebin.net] do what you want?
Last edited by juanlopez2008; 2 Dec, 2022 @ 7:09am
Yoann 2 Dec, 2022 @ 7:34am 
Yes, thank you, this version fix the bug, and raise the quality of your mod ;)
Yoann 18 Dec, 2022 @ 8:16am 
Can you give a try to add standby to Mech recharger when you have time please? Now that the Mech gestator is fixed, I see that Mech rechargers draw power even when no Mechanoid are charging.

The part of XML you could need. If you need also something in C# I can take a look, if you tell me what to search ~

<ThingDef Name="BaseMechCharger" ParentName="BuildingBase" Abstract="True"> <thingClass>Building_MechCharger</thingClass> <comps> <li Class="CompProperties_Flickable"/> <li Class="CompProperties_Forbiddable"/> <li Class="CompProperties_WasteProducer"> <showContentsInInspectPane>false</showContentsInInspectPane> </li> </comps> </ThingDef> <ThingDef ParentName="BaseMechCharger"> <defName>BasicRecharger</defName> <building> <requiredMechWeightClasses> <li>Light</li> </requiredMechWeightClasses> </building><comps> <li Class="CompProperties_ThingContainer"> <compClass>CompThingContainer</compClass> <stackLimit>5</stackLimit> <drawContainedThing>false</drawContainedThing> <dropEffecterDef>MechChargerWasteRemoved</dropEffecterDef> </li> <li Class="CompProperties_Power"> <compClass>CompPowerTrader</compClass> <basePowerConsumption>200</basePowerConsumption> </li> </comps> </ThingDef> <ThingDef ParentName="BaseMechCharger"> <defName>StandardRecharger</defName>
juanlopez2008  [developer] 19 Dec, 2022 @ 5:48pm 
Unfortunately something like that isn’t as simple as looking at a def name or doing an XML patch. That requires looking into the C# to see how I could (in a performant manner) detect when something is actually charging or not. It’s something that would require a significant amount more testing than ignoring something.

At this juncture, ignoring the mech charger entirely and having it draw power at all times is the correct behavior for my mod.
Yoann 20 Dec, 2022 @ 2:05am 
I agree that it's better to skip a building than leaving a bug, it was the purpose of this topic.
However, I'm ok to do the crash test if you want to try to improve it.

You don't have already access to the code of Biotech even without owning the DLC? (it's in the same file than vanilla, there is 8 versions of this file?)

So, in: Building_MechCharger @02001310
private bool IsAttachedToMech { get { return this.currentlyChargingMech != null && this.wireExtensionTicks >= 70; } }

public bool CanPawnChargeCurrently(Pawn pawn) { if (this.Power.PowerNet == null) { return false; } if (this.IsFullOfWaste) { return false; } if (!this.IsCompatibleWithCharger(pawn.kindDef)) { return false; } if (this.IsPowered) { if (this.currentlyChargingMech == null) { return true; } if (this.currentlyChargingMech == pawn) { return true; } } return false; }
Yoann 20 Dec, 2022 @ 2:06am 
public override void Tick() { base.Tick(); if (this.currentlyChargingMech != null && (this.currentlyChargingMech.CurJobDef != JobDefOf.MechCharge || this.currentlyChargingMech.CurJob.targetA.Thing != this)) { Log.Warning("Mech did not clean up his charging job properly"); this.StopCharging(); } if (this.currentlyChargingMech != null && this.Power.PowerOn) { this.currentlyChargingMech.needs.energy.CurLevel += 0.00083333335f; this.wasteProduced += this.WasteProducedPerTick; this.wasteProduced = Mathf.Clamp(this.wasteProduced, 0f, (float)this.WasteProducedPerChargingCycle); if (this.wasteProduced >= (float)this.WasteProducedPerChargingCycle && !this.Container.innerContainer.Any) { this.wasteProduced = 0f; this.GenerateWastePack(); } if (this.moteCablePulse == null || this.moteCablePulse.Destroyed) { this.moteCablePulse = MoteMaker.MakeInteractionOverlay(ThingDefOf.Mote_ChargingCablesPulse, this, new TargetInfo(this.InteractionCell, base.Map, false)); } Mote mote = this.moteCablePulse; if (mote != null) { mote.Maintain(); } } if (this.currentlyChargingMech != null && this.Power.PowerOn && this.IsAttachedToMech) { if (this.sustainerCharging == null) { this.sustainerCharging = SoundDefOf.MechChargerCharging.TrySpawnSustainer(SoundInfo.InMap(this, MaintenanceType.None)); } this.sustainerCharging.Maintain(); if (this.moteCharging == null || this.moteCharging.Destroyed) { this.moteCharging = MoteMaker.MakeAttachedOverlay(this.currentlyChargingMech, ThingDefOf.Mote_MechCharging, Vector3.zero, 1f, -1f); } Mote mote2 = this.moteCharging; if (mote2 != null) { mote2.Maintain(); } } else if (this.sustainerCharging != null && (this.currentlyChargingMech == null || !this.Power.PowerOn)) { this.sustainerCharging.End(); this.sustainerCharging = null; } if (this.wireExtensionTicks < 70) { this.wireExtensionTicks++; } }

public void StartCharging(Pawn mech) { if (!ModLister.CheckBiotech("Mech charging")) { return; } if (this.currentlyChargingMech != null) { Log.Error("Tried charging on already charging mech charger!"); return; } this.currentlyChargingMech = mech; mech.needs.energy.currentCharger = this; this.wireExtensionTicks = 0; SoundDefOf.MechChargerStart.PlayOneShot(this); } public void StopCharging() { if (this.currentlyChargingMech == null) { Log.Error("Tried stopping charging on currently not charging mech charger!"); return; } if (this.currentlyChargingMech.needs.energy != null) { this.currentlyChargingMech.needs.energy.currentCharger = null; } this.currentlyChargingMech = null; this.wireExtensionTicks = 0; }
juanlopez2008  [developer] 20 Dec, 2022 @ 5:50am 
Anything tick-wise or relating to checks of whether it’s charging or not are not very useful places for my mod to hook into. It’s costly to run patches constantly, so you want to put them in places where they run least frequently, at least as best as you can.

It looks like charging is still job-driven, so theoretically the NotifyPatherArrived hook should just take care of it automatically once the bench is picked up (since it doesn’t derive from Building_WorkTable it doesn’t count as a bench). My guess is that modifying Tables.CanBeTable (or more likely patching it for Biotech) to also include this building would just work out of the box. Failing that, StartCharging and StopCharging would also be good candidates for setting the in-use/on-standby status.

I don’t really have time these days to work on this mod, especially if that involves making a version for you to remote debug since that requires an even greater time commitment. This is the sort of fix that, ideally, the community contributes via GitHub.
Yoann 20 Dec, 2022 @ 6:27am 
Ok, no hurry. Thank you to already looked at it, and good end of year!
juanlopez2008  [developer] 17 Feb, 2023 @ 5:45pm 
Closing, since Biotech support was recently added
< >
Showing 1-9 of 9 comments
Per page: 1530 50