Skip to content

Conversation

Sakura-TA
Copy link
Contributor

This should fix null pointer error when select products for FishTrapper from VFE-Faction Machanoid.
The function should sync 'building' as ThingComp instead of Thing, which causes null pointer.

Should fix VFE-Faction Machanoid_ FishTrapper being able to set products
The issue is that Command_SetItemsToSpawn is actualing using a ThingComp as param instead of Thing, witch can't be synced as Thing.
Added function for command with comp_building.
@notfood
Copy link
Member

notfood commented Feb 26, 2025

Something is wrong here.

ThingComp is different from Thing, what happened to the old method? SyncCommandWithBuilding, this would break other things.

@Sakura-TA
Copy link
Contributor Author

remains there, actually the original method SyncCommandWithBuilding was referenced 3 times, here one of them makes error, but the other 2 are fine, so I created a new method for this and remains the old SyncCommandWithBuilding there for these methods.

@SokyranTheDragon SokyranTheDragon added bug Something isn't working 1.5 labels Feb 27, 2025
@SokyranTheDragon
Copy link
Member

Looks like the field called building is a subtype of ThingComp (and from what I'm seeing it always was a ThingComp), so likely the issue originally was introduced by reading the field name as a type name. From what I'm seeing, it should all be good with the SyncWorker itself.

I've added a review on the file, as I'm not sure about the using statement added in this PR - seems unused?

Also, could you check if the SyncWorker you've added be used to replace the one for SyncSetStoneTypeCommand? It also uses a ThingComp named building that it syncs, so I believe it should be able to handle both cases. It's used by the automatic drill in VFE-Mechanoids.

The sync worker I'm talking about:

private static void SyncSetStoneTypeCommand(SyncWorker sync, ref Command obj)
{
if (sync.isWriting)
sync.Write(setStoneBuildingField(obj));
else
setStoneBuildingField(obj) = sync.Read<ThingComp>();
}

@Sakura-TA
Copy link
Contributor Author

Yeah, didn't mean to add that using, sry.
This method should works fine with SetStoneTypeCommand, as CompRockSpawner got totally same fields with CompConfigurableSpawner.
Still gonna test it later.

@Sakura-TA
Copy link
Contributor Author

It works, but I'm not gonna push it now , as there maybe more things I can do here :P

@Sakura-TA
Copy link
Contributor Author

FORGOT to create branch omg.
so now this mr contains my compat for EccentricTech.DefenseGrid by Aelanna
Tested with 2pc. seems everything right.
It's my first mod compat so tell me if there's anything could be simplified.

p.s. Have to use reference or there could be a bunch of Reflections :(

@Sakura-TA Sakura-TA changed the title Fix VFE issue syncing Command_SetItemsToSpawn Fix VFE issue syncing CommandWithCompBuilding stuffs & Add compat for EccentricTech.DefenseGrid by Aelanna Mar 5, 2025
@Sakura-TA
Copy link
Contributor Author

Seems this mod got visualeffect class in another dll. Would fix those with Rand.push/pop later.

@notfood
Copy link
Member

notfood commented Mar 23, 2025

Please separate them by feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.5 bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants