niston Posted June 20, 2022 Share Posted June 20, 2022 My mod lets you build a connector in workshop. As you build it, the mod spawns another one like it, right next to it and both connectors become linked with an invisible wire.I call this construction a "buried wire". The constructed connector is known as "near connector" while the spawned in one is known as "far connector".Far connector has a reflink to near connector, for maintenance purposes. Both near and far connector have WorkshopObjectScript and get reflinked to the workshop on placement/spawn-in. When you place the near connector you built on, say, a floor piece, everything is normal.But when you place the far connector that was spawned in onto the same floor piece, weird things happen: - As you grab the floor piece in workshop, the far connector placed on it disappears. No workshop events or OnLoad/OnUnload are received by the far connector during this phase.- As you let go of the floor piece without moving it, or as you move it and then cancel the movement with TAB, the far connector reappears. No workshop or OnLoad/OnUnload events are received during this.- But when you move the floor piece and place it in a new spot, the instant you put it down, the already vanished far connector receives a OnWorkshopObjectDestroyed event. Reflinks are still intact at this time.- When left to it's own devices, about half a second later, the vanished far connector reappears and OnInit fires as if it had been freshly spawned. The far connector that reappears will have the same FormID as the far connector that vanished, but it will have been reset - Any reflinks it had, gone. Any script properties, empty. Consequently, the reflink from the spawned connector to the built connector on the other end of the hidden wire is now lost and so is the WorkshopItemLink reflink from the spawned connector to the workshop.- No OnWorkshopObjectGrabbed/OnWorkshopObjectMoved events are ever received by the far connector during move of the floor piece underneath it. The unsolvable problem this weirdness creates:- As you need to be able to scrap this "buried wire" from either end, the far connector must react to OnWorkshopObjectDestroyed event and trigger removal of the hidden wire and the near connector on the other side.- As far as I can tell, it is impossible to discern if the OnWorkshopObjectDestroyed event was fired because a) the far connector actually got scrapped or because b) the floor under the far connector got moved. As a result:- When you place the far connector on a floor piece and then move the floor piece around, the buried wire scraps itself (just as if one of it's ends had been scrapped by the player), even though nothing has been scrapped by the player at all. But:- The same things do not happen when you place the near connector on the floor piece and move it.- Only the far connector will disappear as you grab the floor piece, and reappear as you put it down without moving or cancel the movement with TAB.- Only the far connector will ever receive a OnWorkshopObjectDestroyed when the floor underneath it is being placed in different spot.And the same is true for connectors that go on the wall or onto the ceiling, ie it's not specific to stuff being placed on a floor. Questions:- Just what the heck is going on here?- Why does the spawned in connector even vanish when the floor under it gets picked up/grabbed?- Why in Todd's name does the game send a OnWorkshopObjectDestroyed event to the spwaned-in connector (and ONLY to that one) when the floor move is completed?- And most importantly: How can I stop this super bizarre behavior? Link to comment Share on other sites More sharing options...
SKKmods Posted June 20, 2022 Share Posted June 20, 2022 I have had similar issues with placeable proxy items and their actual in world linked objects: (a) Does the spawned item fire OnUnload and OnLoad events when it disappears/reappears ? (b) If you DebugTrace OnInit and OnLoad on the workshop constructed/placed object does it fire multiple times and do you only spawn off the last instance ? © Do you set the WorkshopItemKeyword linkeref to the workshop on the spawned connector ? (d) Does the spawned connector base form have a construction or scrap recipe ? Link to comment Share on other sites More sharing options...
niston Posted June 20, 2022 Author Share Posted June 20, 2022 a) No. b) On near connector, no OnLoad/OnUnload fires during the move of the floor with the far connector on it. In case I misunderstood the question: OnInit fires once as expected on construction of the near connector. This event is used to spawn the other (far) connector. Also, OnLoad fires once as expected on the near connector. It is used (exclusively) to run a SelfTest() procedure that verifies the hidden wire is working properly. c) Yes, I do this explicitly for the far connector, immediately after it was successfully spawned. d) Yes. Link to comment Share on other sites More sharing options...
niston Posted June 20, 2022 Author Share Posted June 20, 2022 Maybe a crazy arrangement with a timer could solve this, idk.Since -when left alone- the vanishing far connector seems to reinitialize after the move, I could perhaps start a timer (implemented in the near connector that won't reset) when the *Destroyed event gets fired on the far connector and stop that timer when OnInit happens on the far connector (floor was moved). I could then discern and only trigger the cleanup in case the timer manages to expire (no OnInit follows because the far connector really got scrapped), and perhaps perform repair on the reflink/properties of the far connector otherwise. OMFG what a fercking mess! I swear every time I try to get back into modding, I'm immediately reminded why I quit. The endless Bethesda Bullcrap Bingo gets old and tiresome so fast. Link to comment Share on other sites More sharing options...
South8028 Posted June 20, 2022 Share Posted June 20, 2022 (edited) I wonder if it is possible to implement wires on the basis of ce as in tlou? Something like a spline with physics based on a sequence of bones, limited in kinematics strictly along the Z axis. With animation, it is easy to implement such a wire. But how to implement such a connection in the form of three objects? So that two objects can be moved independently in the workshop, and the third is represented by a garland of bones connecting the two objects? ) It would be possible to implement a transfer. Activators at the ends of the spline connect bs connect point. In general, I was delighted with the tlou2 wires. I dream of such wires in fo4. Edited June 21, 2022 by South8028 Link to comment Share on other sites More sharing options...
niston Posted June 20, 2022 Author Share Posted June 20, 2022 I tried using IsBoundGameObjectAvailable to discern between destroyed and scrapped vs destroyed but not scrapped - but Workshop Plus is keeping scrapped stuff around (undo function), so that doesn't work.Off to messing with timers, brb... @South8028 not sure I follow... :smile:Workshop wires are made from a spline (visual representation) and some entries in the power grid table (actual "electrical" connection). Link to comment Share on other sites More sharing options...
niston Posted June 20, 2022 Author Share Posted June 20, 2022 The timer solution works - sort of: As long as you close the workshop immediately after moving the floor.... FFS. Link to comment Share on other sites More sharing options...
South8028 Posted June 20, 2022 Share Posted June 20, 2022 I tried using IsBoundGameObjectAvailable to discern between destroyed and scrapped vs destroyed but not scrapped - but Workshop Plus is keeping scrapped stuff around (undo function), so that doesn't work.Off to messing with timers, brb... @South8028 not sure I follow... :smile:Workshop wires are made from a spline (visual representation) and some entries in the power grid table (actual "electrical" connection).https://youtu.be/-z1cU7_ds2cI can do that, but only as an animation. But I mean advanced ragdoll physics applied to a garland of bones. A real wire, instead of that pathetic craft that is presented in fo4. Link to comment Share on other sites More sharing options...
niston Posted June 20, 2022 Author Share Posted June 20, 2022 well, if it's somehow possible to place this flexible wire style between two objects, it should certainly be possible to create a hidden wire between the same two objects (to actually transfer the power) for it. the usual shenanigans re powered objects spawned from script will apply. Link to comment Share on other sites More sharing options...
South8028 Posted June 20, 2022 Share Posted June 20, 2022 (edited) well, if it's somehow possible to place this flexible wire style between two objects, it should certainly be possible to create a hidden wire between the same two objects (to actually transfer the power) for it. the usual shenanigans re powered objects spawned from script will apply.I don't know yet how to do it. We need a way in which the object linked with the hi solver of the last bone of the garland is moved separately from the object that is skinned on the first, or several first bones. It is probably impossible to make such a wire work in the workshop. But it will be possible to physically push (carry like a corpse) the "connector" to the desired area, and this will deform the bones attached to it, randomly laying the wire along the route.Then, when we bring the "connector", we can go to the workshop and "plug" it into the bs connect point. This is the only way that comes to mind. Edited June 20, 2022 by South8028 Link to comment Share on other sites More sharing options...
Recommended Posts