Jump to content

Hal's Prefab Editor


HAL9000

Recommended Posts

[QUOTE=Pille;658087]Hi Hal, I just tried to spawn an entity in an A15 prefab using your editor but it didn't work for certain entities (e.g. traders). Any idea what I do wrong?[/QUOTE] Hi Hal, I found the problem. Some entities did not spawn because I've used the prefab xml to place the prefabs (maybe they fell through the ground). Everything works using the bbb command. I am still incapable to understand the entity spawn mechanism though. Attached entities add a few bytes to the .tts files but I don't understand the meaning of those additional data. Probably, I should try the read the dll file but where can I find the relevant information? Can you help me please?
Link to comment
Share on other sites

[QUOTE=Pille;715357]Hi Hal, I found the problem. Some entities did not spawn because I've used the prefab xml to place the prefabs (maybe they fell through the ground). Everything works using the bbb command. I am still incapable to understand the entity spawn mechanism though. Attached entities add a few bytes to the .tts files but I don't understand the meaning of those additional data. Probably, I should try the read the dll file but where can I find the relevant information? Can you help me please?[/QUOTE] Hey Pille, I haven't looked into it much but I don't think the vanilla code uses the entity data any more when loading the prefab. Yeah the DLL is the place to get the information. Do you know C# well enough to read it? You're primarily a cpp'er aren't you? Grab a decompiler (dotPeek, dnSpy, IlSpy, Reflector) and have a look at the Prefab class. In there you'll see a list of EntityCreationData classes and it's this that gets saved to the tts. Not exactly relevant but I did a video on [URL="https://www.youtube.com/watch?v=Yo092Z_Mirk"]patching using SDX[/URL] that shows usage of a decompiler to have a look around the DLL. You can check out the write method on the EntityCreationData class to see what gets written to the tts file for each entity [code] public void write(BinaryWriter _bw, bool _bNetworkWrite) { _bw.Write((byte) 25); _bw.Write(this.entityClass); _bw.Write(this.id); _bw.Write(this.lifetime); _bw.Write(this.pos.x); _bw.Write(this.pos.y); _bw.Write(this.pos.z); _bw.Write(this.rot.x); _bw.Write(this.rot.y); _bw.Write(this.rot.z); _bw.Write(this.onGround); this.bodyDamage.Write(_bw); _bw.Write(this.stats != null); if (this.stats != null) this.stats.Write(_bw); _bw.Write((short) this.deathTime); _bw.Write(this.lootContainer != null); if (this.lootContainer != null) { _bw.Write((int) this.lootContainer.GetTileEntityType()); this.lootContainer.write(_bw, !_bNetworkWrite ? TileEntity.StreamModeWrite.Persistency : TileEntity.StreamModeWrite.ToClient); } _bw.Write(this.UU.x); _bw.Write(this.UU.y); _bw.Write(this.UU.z); _bw.Write((short) this.TU); _bw.Write((byte) this.AU); if (this.entityClass == EntityClass.FromString("item")) { _bw.Write(this.belongsPlayerId); this.itemStack.Write(_bw); _bw.Write((sbyte) 0); } else if (this.entityClass == EntityClass.FromString("fallingBlock")) _bw.Write(this.blockValue.rawData); else if (this.entityClass == EntityClass.FromString("fallingTree")) { NetworkUtils.Write(_bw, this.blockPos); NetworkUtils.Write(_bw, this.fallTreeDir); } else if (this.entityClass == EntityClass.FromString("playerMale") || this.entityClass == EntityClass.FromString("playerFemale")) { this.holdingItem.Write(_bw); _bw.Write((byte) this.teamNumber); _bw.Write(this.entityName); _bw.Write(this.skinTexture); _bw.Write(this.playerProfile != null); if (this.playerProfile != null) this.playerProfile.Write(_bw); } int length = (int) this.entityData.Length; _bw.Write((ushort) length); if (length > 0) _bw.Write(this.entityData.ToArray()); _bw.Write(this.traderData != null); if (this.traderData != null) { _bw.Write((int) this.traderData.GetTileEntityType()); this.traderData.write(_bw, !_bNetworkWrite ? TileEntity.StreamModeWrite.Persistency : TileEntity.StreamModeWrite.ToClient); } if (!_bNetworkWrite) return; _bw.Write(this.sleeperPose); } [/code] That should get you the info to get started but just ask if you've any questions. I'd probably recommend seeing if you can load the DLL into your code and calling the load/save functions or at least using the c# types to load the data. I used to keep my own versions of everything but it's a lot of work when big releases happen and things change. Using the base code to handle that stuff reduces the update time dramatically.
Link to comment
Share on other sites

[QUOTE=HAL9000;715608] Yeah the DLL is the place to get the information. Do you know C# well enough to read it? You're primarily a cpp'er aren't you? [/QUOTE] Yes and yes and thank you Hal. That's exactly what i am looking for. [QUOTE=HAL9000;715608] I haven't looked into it much but I don't think the vanilla code uses the entity data any more when loading the prefab.[/QUOTE] Nope, it still works. I spawned some A15 prefabs in A16 Navezgane to test it. :)
Link to comment
Share on other sites

[QUOTE=Pille;716081]Yes and yes and thank you Hal. That's exactly what i am looking for. Nope, it still works. I spawned some A15 prefabs in A16 Navezgane to test it. :)[/QUOTE] Ok cool. Just shout if you have questions - I've spent a lot of time in that assembly so know where most the skeletons are ^^ Good to know on the spawning too. I couldn't get it working on one of the early A16 builds but it was probably something else I hadn't updated yet borking it.
Link to comment
Share on other sites

Hey Hal - Posted in pilles editor as well as I not sure which is the area is causing the issue or if it is either at all - issue - I just finished my retirement horror village and exported it using Hals commands . Went into pille editor cut the columns and rows and placed it into the prefab folder and rwgmixer. It spawned correctly however some of the paint has gone missing. Anyone else get this. Also the doors can not be locked or unlocked or anything only open and closed. I also noticed when i imported the prefab the trash compacter changes to A block but still acts like a trash compacter lol with it being able to be looted and the writing coming up saying e to open. Also the block becomes coloured lol Will post pics of before inporting and after importing. But will also post in hals editor to here is what i mean - before exporting and importing into a new world - [url]https://steamuserimages-a.akamaihd.net/ugc/853849837141308359/6FFC94D2A4D1F5305A124BF478426BE5D650E2AD/[/url] After - [url]https://steamuserimages-a.akamaihd.net/ugc/853849837141316945/EC43C8DC9A7B6B73CDC36B1A334D926AB627650F/[/url] Before - [url]https://steamuserimages-a.akamaihd.net/ugc/853849837141314466/208955C15797C7301668E87E8D551D9946326FB6/[/url] After - [url]https://steamuserimages-a.akamaihd.net/ugc/853849837141304317/0A98CF6B7016C87D2C8B760114141DC94A830CA8/[/url]
Link to comment
Share on other sites

[QUOTE=stallionsden;718384]Hey Hal - Posted in pilles editor as well as I not sure which is the area is causing the issue or if it is either at all - issue - I just finished my retirement horror village and exported it using Hals commands . Went into pille editor cut the columns and rows and placed it into the prefab folder and rwgmixer. It spawned correctly however some of the paint has gone missing. Anyone else get this. Also the doors can not be locked or unlocked or anything only open and closed. I also noticed when i imported the prefab the trash compacter changes to A block but still acts like a trash compacter lol with it being able to be looted and the writing coming up saying e to open. Also the block becomes coloured lol Will post pics of before inporting and after importing. But will also post in hals editor to here is what i mean - before exporting and importing into a new world - [url]https://steamuserimages-a.akamaihd.net/ugc/853849837141308359/6FFC94D2A4D1F5305A124BF478426BE5D650E2AD/[/url] After - [url]https://steamuserimages-a.akamaihd.net/ugc/853849837141316945/EC43C8DC9A7B6B73CDC36B1A334D926AB627650F/[/url] Before - [url]https://steamuserimages-a.akamaihd.net/ugc/853849837141314466/208955C15797C7301668E87E8D551D9946326FB6/[/url] After - [url]https://steamuserimages-a.akamaihd.net/ugc/853849837141304317/0A98CF6B7016C87D2C8B760114141DC94A830CA8/[/url][/QUOTE] Hi stallionsden, A few things for you to try: 1) Does the issue happen with an un-edit export? i.e. export the prefab, don't touch it in the editor and try importing it again. 2) Does it happen with both inserting with sleepers spawning and without? 3) Import the prefab, find a block with a dodgy texture and damage/destroy it. Import again and check if it comes in ok. You can't lock doors that you don't own in-game. Use the [own] flag when importing
Link to comment
Share on other sites

s[QUOTE=HAL9000;718551]Hi stallionsden, A few things for you to try: 1) Does the issue happen with an un-edit export? i.e. export the prefab, don't touch it in the editor and try importing it again. [/QUOTE] test 1 - step 1: made a small prefab exported using your commands and re imported thru rwgmixer prefab was fine step 2: used same prefab went thru the editor spawned thru rwgmixer and texture issues came back.
Link to comment
Share on other sites

[QUOTE=HAL9000;718551] 1) Does the issue happen with an un-edit export? i.e. export the prefab, don't touch it in the editor and try importing it again. 2) Does it happen with both inserting with sleepers spawning and without? 3) Import the prefab, find a block with a dodgy texture and damage/destroy it. Import again and check if it comes in ok. [/QUOTE] These questions are pretty hard to answer since the issues appear randomly (at least in my case), so I guess it's ok if I write down my observations here (even if the questions are directed towards stallionsden). 1) Yes. I spawned skyscraper_01 using the command 'bbb ip skyscraper_01 x z y' and got a few randomly changed textures. 2) It happens with and without the sleeper tag ( [sleepers] ). 3) Yes, this repairs the texture. Imo it doesn't happen if you replace air blocks only (e.g. if you spawn your prefab into an empty world). Have a look at my editor thread to get more, confusing information.^^ [B]Edit:[/B] [url]https://7daystodie.com/forums/showthread.php?62501-Prefab-Editor-(Alpha)&p=719007&viewfull=1#post719007[/url]
Link to comment
Share on other sites

Update Time! Updated: Auto-update fix Updated: Possible fix for texture import errors You'll still need to download from the OP again to download the version with the update fix. [QUOTE=stallionsden;718952]s test 1 - step 1: made a small prefab exported using your commands and re imported thru rwgmixer prefab was fine step 2: used same prefab went thru the editor spawned thru rwgmixer and texture issues came back.[/QUOTE] Check this version out, if it's still happening send me the prefab it's happening with and describe which blocks are getting affected and I'll take a look. [QUOTE=Pille;718980]These questions are pretty hard to answer since the issues appear randomly (at least in my case), so I guess it's ok if I write down my observations here (even if the questions are directed towards stallionsden). 1) Yes. I spawned skyscraper_01 using the command 'bbb ip skyscraper_01 x z y' and got a few randomly changed textures. 2) It happens with and without the sleeper tag ( [sleepers] ). 3) Yes, this repairs the texture. Imo it doesn't happen if you replace air blocks only (e.g. if you spawn your prefab into an empty world). Have a look at my editor thread to get more, confusing information.^^ [B]Edit:[/B] [url]https://7daystodie.com/forums/showthread.php?62501-Prefab-Editor-(Alpha)&p=719007&viewfull=1#post719007[/url][/QUOTE] Hmm, that complicates things a bit more. The [sleepers] tag uses the vanilla prefab CopyBlocksIntoChunk method to insert the blocks into the world so that's not something I can update but I did find a possible cause of the problem in the hand rolled insert method.
Link to comment
Share on other sites

Hi Hal, This is most likely a game bug and not with your tool but I noticied with my prison that some water blocks would look strange in game. I tried replacing the erroneous water blocks via pille's editor but it doesn't appear to make any difference. If I attempt tp save/export with your tool the erroneous blocks show up as air blocks within pille's editor. Any thoughts? view from underground: [img]http://i.imgur.com/wM9LcRq.jpg[/img] edit: It has to be a game glitch. I just tried importing the prison into your empty world and for 2-3 seconds all of the water looks ifne, then the air blocks magically appear throughout.
Link to comment
Share on other sites

Yeh, water is retarded. My /guess/ is that especially for larger imports, a water block is pulled into the game before the supporting block under is, so it falls. We see it in water especially, because it's so weak. ...@Hal or anyone, is there a way to set up imports so that it starts at the lowest layer, completes, then moves to the next higher layer?
Link to comment
Share on other sites

[QUOTE=Laz Man;719131]Right after empty world load: [/QUOTE] Sorry Laz, no clue. I do see weird water bugs when filling a lot of jars. I think it's just wonky [QUOTE=Guppycur;719139]Yeh, water is retarded. My /guess/ is that especially for larger imports, a water block is pulled into the game before the supporting block under is, so it falls. We see it in water especially, because it's so weak. ...@Hal or anyone, is there a way to set up imports so that it starts at the lowest layer, completes, then moves to the next higher layer?[/QUOTE] My import stuff all happens at once so it shouldn't be an issue but it does it from bottom to top on each x and z location. So they should all build in large columns. It's done this way to decrease load times as I don't have to keep swapping chunks in.
Link to comment
Share on other sites

[QUOTE=Guppycur;719538]Then water does make sense, because it flows sideways too... Build a column too slow, and the water slides out of it into the next xy. /gupothesis[/QUOTE] It happens when the prison loads into rwg too so i dont think its an issue with hals tool. I need to find a vanilla poi that has a lot of water for comparison.
Link to comment
Share on other sites

[QUOTE=HAL9000;719048] Updated: Possible fix for texture import errors [/QUOTE] I am still getting texture issues (with and without [sleepers] tag) but imo it's not very critical since you can import an air-only prefab before inserting the real prefab (because the bug doesn't occur if you don't replace any non-air blocks).
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...