Eloreden Posted June 26, 2021 Share Posted June 26, 2021 Hi guy i'm here cause i need help with my mod. the mod in question kept gases and liquids separated when the door was in "auto" state so if the duplicators crossed it there was no passage of elements. the idea was very simple and functional. Override the "SetSimState" method of the doors so that only with my Door the "ReplaceAndDisplaceElement" was called even if the door was open for passage. but now apparently this method also affects duplicators by "throwing them back if they stop at the door". Specifically, the call to the "SimMessages.ModifyCell (arg)" method ModifyCellMessage * modifyCellMessagePtr = stackalloc ModifyCellMessage [1]; editCellMessagePtr-> cellIdx = gameCell; editCellMessagePtr-> callbackIdx = callbackIdx; editCellMessagePtr-> temperature = temperature; editCellMessagePtr-> mass = mass; editCellMessagePtr-> elementIdx = (byte) elementIdx; editCellMessagePtr-> replaceType = (byte) replace_type; editCellMessagePtr-> diseaseIdx = disease_idx; modifyCellMessagePtr-> diseaseCount = disease_count; editCellMessagePtr-> addSubType = do_vertical_solid_displacement? (byte) 0: (byte) 1; Sim.SIM_HandleMessage ((int) SimMessageHashes.ModifyCell, sizeof (ModifyCellMessage), (byte *) modifyCellMessagePtr); Do you have any idea how I can fix it? Link to comment https://forums.kleientertainment.com/forums/topic/131257-mod-help-fix-airlock-door-iraku/ Share on other sites More sharing options...
Eloreden Posted June 27, 2021 Author Share Posted June 27, 2021 can I know what the "SimMessages" class manages? Link to comment https://forums.kleientertainment.com/forums/topic/131257-mod-help-fix-airlock-door-iraku/#findComment-1473924 Share on other sites More sharing options...
jiuye007 Posted June 29, 2021 Share Posted June 29, 2021 If you don't know how to do, you can refer to other mods of the same type.such as stephen's airlock door.come on! Link to comment https://forums.kleientertainment.com/forums/topic/131257-mod-help-fix-airlock-door-iraku/#findComment-1474490 Share on other sites More sharing options...
StarGeek Posted June 29, 2021 Share Posted June 29, 2021 6 hours ago, jiuye007 said: If you don't know how to do, you can refer to other mods of the same type.such as stephen's airlock door.come on! I admittedly don't know much about creating mods, but I believe the Stephen's Airlock Door works in a completely different manner. That mod lets things into the center chamber, then pushes the gas/liquids back into the room they came from. The dupe is stuck in the inner chamber until that happens. Eloreden's mod, in the base game, completely prevents gas/liquids from passing through when the door is set to auto without impeding the movement of dupes. The only other mod that works the same as Eloreden's, chromiumboy's Self-sealing Airlocks, suffers from the same problem. Dupes trying to pass through stop and get entombed in the DLC. Link to comment https://forums.kleientertainment.com/forums/topic/131257-mod-help-fix-airlock-door-iraku/#findComment-1474566 Share on other sites More sharing options...
Eloreden Posted June 29, 2021 Author Share Posted June 29, 2021 I actually took inspiration for the creation of the chromiumboy Mod. Enhancing it so that it can only be applied to a specific port. Right now the only way I can conceive is to completely change the flow of the elements by preventing it from going through the door, however I can't find in the code where the physics of the elements is managed. Actually as I understand the world is evolving in the background. There is the game grid where each cell has its own properties, (set as pointers in memory or something similar) these properties change with the movement of the elements. But how these elements move I cannot understand. the last thing that comes to my mind is that the UI affects the game code. But I don't know if this can actually be true. Link to comment https://forums.kleientertainment.com/forums/topic/131257-mod-help-fix-airlock-door-iraku/#findComment-1474664 Share on other sites More sharing options...
Eloreden Posted June 30, 2021 Author Share Posted June 30, 2021 After numerous tests I realized that even inserting and managing the mod in the same way it is managed by the source code the error remains. So I don't think it depended on the "ReplaceAndDisplace" but on the initialization of the assets maybe ... Link to comment https://forums.kleientertainment.com/forums/topic/131257-mod-help-fix-airlock-door-iraku/#findComment-1475003 Share on other sites More sharing options...
EnemyArea Posted August 3, 2021 Share Posted August 3, 2021 Hey there, could you please use this code and try it again? worked 4 me using HarmonyLib; namespace SelfSealingAirlocks { // Update sim state setter to make airlock doors gas impermable [HarmonyPatch(typeof(Door), "SetWorldState")] internal class SelfSealingAirlocks_Door_SetWorldState { private static void Postfix(Door __instance) { // If the attached gameobject doesn't exist, exit here if (__instance.gameObject == null) return; Door.DoorType doorType = __instance.doorType; if (doorType <= Door.DoorType.ManualPressure || doorType == Door.DoorType.Sealed) { for (var i = 0; i < __instance.building.PlacementCells.Length; i++) { var offsetCell = __instance.building.PlacementCells[i]; SimMessages.ClearCellProperties(offsetCell, 1); SimMessages.ClearCellProperties(offsetCell, 2); SimMessages.ClearCellProperties(offsetCell, 4); SimMessages.SetCellProperties(offsetCell, (byte)(__instance.CurrentState == Door.ControlState.Auto ? 7 : 4)); } } } } } Link to comment https://forums.kleientertainment.com/forums/topic/131257-mod-help-fix-airlock-door-iraku/#findComment-1483707 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.
Please be aware that the content of this thread may be outdated and no longer applicable.