Jump to content

Bad Company Manager (ApiMod for Servers)


StompyNZ

Recommended Posts

Got the prefab export / import working with painted textures, and the imported prefabs include the sleepers.

 

Still need to fix a few bits with using the player location (currently have to enter all the co-ords) so will probably do a pre-release build and upload it to github tomorrow night. The chunk reloading still needs some work too, but that can wait till a later release :)

 

 

here's a tower I imported, painted, exported, then imported 3 times.

export_import.jpg

Link to comment
Share on other sites

Awesome! Would it be possible to save a partial existing poi, import it, build more onto it, and then save it out?

 

Here's my thought... I'd like to build a deep mine poi, incorporating some of the industrial building parts as underground rooms. The descent would have lighting, and personal lighting would be discouraged. I'd have underground navigation like the skyscraper, and at the bottom of the descent would be a chest with some select rare loot making it worthwhile getting down.

 

I'd want to save the rock work and ground as well.

 

I'd like it DEEP, and it would have to spawn only in high rgw elevations as as result.

 

Does this sound possible?

Link to comment
Share on other sites

In case the custom hub indeed does not work, could this be used to put a custom prefab at a certain position and have a custom zombie spawn there? Would it work for single player to or is a server necessary..?

 

once you can get the sleepers into the custom pois then that would be entirely possible. Just need to configure the sleeper spawns to spawn the custom zombie :)

 

- - - Updated - - -

 

Awesome! Would it be possible to save a partial existing poi, import it, build more onto it, and then save it out?

 

Here's my thought... I'd like to build a deep mine poi, incorporating some of the industrial building parts as underground rooms. The descent would have lighting, and personal lighting would be discouraged. I'd have underground navigation like the skyscraper, and at the bottom of the descent would be a chest with some select rare loot making it worthwhile getting down.

 

I'd want to save the rock work and ground as well.

 

I'd like it DEEP, and it would have to spawn only in high rgw elevations as as result.

 

Does this sound possible?

 

one issue with deep PoI's is you don't have control over the terrain they spawn on, so you could end up with big empty spaces where the system tries to spawn them and fails (that's what happens in a15 at least)

 

other than that and the cant fly underground very well bug, there's nothing stopping you from doing what you need.

Link to comment
Share on other sites

once you can get the sleepers into the custom pois then that would be entirely possible. Just need to configure the sleeper spawns to spawn the custom zombie :)
Without a server too..? I'd be fine just copying a vanilla prefab, renaming it and giving it a new sleeper-group in the xml (which, I assume, is possible).

 

And what about creating a custom hub in a certain cell? Like I said, as soon as I assigne a position to a cell-rule, an error is returned. Un-commenting the example for example does that. Did you really get that working? Please share, if so.

Link to comment
Share on other sites

Without a server too..? I'd be fine just copying a vanilla prefab, renaming it and giving it a new sleeper-group in the xml (which, I assume, is possible).

 

And what about creating a custom hub in a certain cell? Like I said, as soon as I assigned a position to a cell-rule, an error is returned. Un-commenting the example for example does that. Did you really get that working? Please share, if so.

 

check the prefab rule if you uncomment the vanilla example, when I last looked it had an old one that didn't exist. Also leave the prob=0 off as I vaguely recall that being an issue.

 

My api mod only works on servers, but you can always run a dedi on your local machine and then connect to it. It's what I do for all my testing and prefabbing :) Once you have the prefab tho, you can include it in the rwgmixer as normal for SP

Link to comment
Share on other sites

check the prefab rule if you uncomment the vanilla example, when I last looked it had an old one that didn't exist. Also leave the prob=0 off as I vaguely recall that being an issue.

 

My api mod only works on servers, but you can always run a dedi on your local machine and then connect to it. It's what I do for all my testing and prefabbing :) Once you have the prefab tho, you can include it in the rwgmixer as normal for SP

I can't get it to work. This is what I have:

 

ruleset:

 

<cell_rule name="customHubTest" position="0,1"/>

 

cellrule unchanged, then hub rule:

 

		<hub_rule name="customHubTest"> 
		<hub_type value="town"/>
		<hub_layout name="customHubTest"/>

		<prefab_rule name="default"/>
	</hub_rule>

And then hub layout:

 

		<hub_layout name="customHubTest">
		<township_type value="town"/>
		<street start_point="-64,0" end_point="64,0"/>
		<lot min_x_y="0, 8" size="60,60" rotation_to_road="2"/>
		<lot min_x_y="-32, 12" prefab="utility_waterworks_01" rotation_to_road="2"/>
	</hub_layout>

This one shows up in the previewer, but returns an error when I load the game:

 

ArgumentNullException: Argument cannot be null.
Parameter name: collection
 at System.Collections.Generic.List`1[RWG2.HubCell+Lot].CheckCollection (IEnumerable`1 collection) [0x00000] in <filename unknown>:0 
 at System.Collections.Generic.List`1[RWG2.HubCell+Lot].AddRange (IEnumerable`1 collection) [0x00000] in <filename unknown>:0 
 at RWG2.HubCell.GetAllLots () [0x00000] in <filename unknown>:0 
 at RWG2.RWGPrefabDecorator.GetPrefabsAround (Vector3 _pos, Single _distanceMin, Single _distanceMax, System.Collections.Generic.Dictionary`2 _prefabs) [0x00000] in <filename unknown>:0 
 at PrefabLODManager.Update () [0x00000] in <filename unknown>:0 
 at GameManager.LZ () [0x00000] in <filename unknown>:0 
 at GameManager.Update () [0x00000] in <filename unknown>:0 

I'm not sure if it showing up in the previewer is a step forward, I did not always check the previewer like I did not always try to load a proper game.

 

Did you actually create a custom hub, give it a position and see it working fine ingame, and not just the previewer..?

 

Spawning a prefab with a custom sleeper-population would be a makeshift solution, if it does not work via the rwgmixer.

Link to comment
Share on other sites

i didn't visit the location but i didn spawn in ok with it in the rwg mixer.

 

I'll try a test tonight when I get home and see what happens. Kin said the custom hub code is still in there and from what I can read in the dll I don't see it not being an option (other hub types were removed, but socket and layouts are still there)

Link to comment
Share on other sites

i didn't visit the location but i didn spawn in ok with it in the rwg mixer.

 

I'll try a test tonight when I get home and see what happens. Kin said the custom hub code is still in there and from what I can read in the dll I don't see it not being an option (other hub types were removed, but socket and layouts are still there)

I just noticed this post:

 

It's a blessing modders are considered at this stage, although building new prefabs is gonna kick off big time with all these textures and shapes and truely become it's own thing.

 

With regards to my issue tho hal I can't help but think I've either went full potato somewhere or it's perhaps something related to the custom hub code/rwgmixer or the new style of xml the prefabs use.

 

I have a mixer here that uses the default custom hub test code to spawn a single prefab with a simple road surround, I've tried this replacing the custom prefab with one of the new skyscrapers (the only difference is you get the mesh in the previewer, error is same), both cases the previewer shows the small hub with the prefab but as soon as it loads the game and you try go anywhere near the it hammers you with the null error.

 

Output

Converted prefab

rwgmixer (needs the prefab adding)

 

I can spawn the custom prefab in nav without issue, post conversion the tts file seems ok other than some rotation stuff etc

Looks like it does not work.. I hope it gets fixed, if you haven't found the magic syntax. My mod kinda depends on this to work.

 

 

sad_kid.jpg

 

Link to comment
Share on other sites

Ran into an issue with using an in memory prefab for the undo function so I will redo the code tonight to save prefabs to file for undo since the import/export seem to be working correctly.

 

ETA for a (pre-)release is tonight NZ time :)

Link to comment
Share on other sites

I just noticed this post:

Looks like it does not work.. I hope it gets fixed, if you haven't found the magic syntax. My mod kinda depends on this to work.

 

I'll have a look later and see if I can get anything to work (once I get the release done)

Link to comment
Share on other sites

Version 1.6.0 is up, details on front page.

 

Still lots of work to do and there are some bit that are broken, but at the least most of the data mining commands work (such as ListPlayers)

 

The prefab import / export / undo is in

 

for export:

bc-export x y z x2 y2 z2 filename (where the first 6 params are a pair of co-ords)

 

for import:

bc-prefab <filename> <rot> - inserts at current location

bc-prefab /undo - revert the previous insert command. Undo file is saved to disk but currently the undo pos data is not preserved after server reboot

 

also, bc-prefab filename x y z rot - to insert at a fixed point

bc-prefab filename 0 /nw or /ne or sw or se to place the prefab at current location in the direction indicated

 

see help bc-prefab for full details

 

There's a few bugs still to work out, but nothing that is likely to break the world :p

Link to comment
Share on other sites

Thanks for this release StompyNZ!

 

It's worked well so far although we do have a strange issue. When I initially went to place a prefab, it threw a bunch of warnings in the console, but it proceeded to place the prefab much higher than the specified elevation, so it was floating in the air. I did an undo to remove it, and ran the command again to place it and it worked. The issue we have now is that if any players are teleported to that location, they end up falling to their death. There is no floating prefab in the air anymore, but the game is trying to place them onto of the non-existent prefab.

 

I tried creating an "airpocket" prefab to load it over the invisible one. It didn't work, however I did manage to get the error to show again. Log shows the following:

 

2017-06-18T15:56:24 23405.685 INF (BCM)Spawning prefab airpocket @ -566, 139, 524, size=90, 116, 54
2017-06-18T15:56:24 23406.390 INF (BCM) Error in BCPrefab.Execute: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
 at System.Collections.Generic.Dictionary`2[system.Int32,Entity].get_Item (Int32 key) [0x00000] in <filename unknown>:0 
 at BCM.Commands.BCPrefab.InsertPrefab (.Prefab prefab, Int32 x, Int32 y, Int32 z, Vector3i pos) [0x00000] in <filename unknown>:0 
 at BCM.Commands.BCPrefab.Process () [0x00000] in <filename unknown>:0 
 at BCM.Commands.BCCommandAbstract.Execute (System.Collections.Generic.List`1 _params, CommandSenderInfo _senderInfo) [0x00000] in <filename unknown>:0 

 

Client console shows:

 

XT5Ccod.jpg

 

I did grab a new version of the prefab using your export rather than using the converted HAL9000 prefab. Moved it onto a test server, placed it there without any errors and it didn't teleport me to the top of an invisible prefab anymore. So, the fix is easy.. when we drop the server, I'll delete the region file and then import your version of the prefab. Just thought I'd let you know in case this is something you can handle in the API mod.

Link to comment
Share on other sites

Cheers for the info Mythan.

 

I'm fairly sure i know why the first error happened.

 

I'm currently using a function GetClients, which i now believe returns the list of clients connected, but potentially not spawned yet. The log shows someone connecting just as you ran that command.

 

can fix that by using the entities dict and filter for players.

 

The super high prefab insert could be a few different things, would need to do some testing to confirm (if I can reproduce it)

 

I currently do a check for max height of the prefab vs world height, and move it down if it hits the roof, I may have something around the wrong way in the logic, i'll look into it.

 

Another issue could be a large yoffset of the prefab, but if it worked on a second attempt that isnt likely.

 

By default an insert based on player pos wont use yoffset (/yoffset option to override), so a prefab with a big -yoffset could insert a lot higher than expected if you are used to coppis function. I think I might flip that to default to using the yoffset if inserted at player pos, and use /yoffset=0 to ignore it (or override with a diff value).

 

The final issue is the chunk reloading, which I had modeled similar to coppis at first, but have a few issues with that method and need to change it. Currently it just scans for players within 200 blocks of the insert and reloads the effected chunks for them. Instead I think I can check what chunks each player has loaded and check that against the inserted chunks, reloading only those the player has loaded.

I pushed this version out before finishing that part as i'm not sure how long it's going to take to get it loading correctly. (not easy to test by myself on a server :) )

 

If I get the first two issues sorted then I think worst case you'll have to do a tp away and back if chunks don't reload correctly :)

That would prob be a handy command to add in separately anyway, ReloadChunksForPlayer(s), I'll chuck that in too :)

Link to comment
Share on other sites

Use the 6200 machine server if you need, stomp.

 

its not so much the lack of machine, its the need for other players to test some code with ;0

 

I'll have to arrange some tests and get someone to team up with and test it out.... I guess I could buy a second copy of the game to do it too... maybe next sale

Link to comment
Share on other sites

recoded the chunk reloading today and added a double insert of the undo prefab to help overcome the issue with multidim blocks (will update later to change all blocks to air first, not entirely trivial as terrainfiller blocks etc need to be considered)

 

will do some testing tonight and all going well will update the release

Link to comment
Share on other sites

Updated with a new release

 

Fixed the ListHubCellData command to include the town lots again

 

Fixed issues with the prefab command undo and chunk reloading

 

Still need to add the removing of claim blocks from player data, and allow for ownership on inserts to be applied like hal does with his command.

 

Sleepers I'm not sure about but they are probably not inserting atm. I've added a /sleepers and /nosleepers option to set the bSleeperVolumes var which should change it from inserting the sleepers blocks vs sleepers spawners, but i forgot to test that one :)

 

Also Entities I haven't had a chance to test but I did try a trader insert and the trader wasn't there but that prob needs code to translate from the placeholder to the random trader entity

 

The chunks now compare the loaded chunks for each online player vs the list of changed chunks and reloads for those that require.

You might still get the occasional error if it tries to reload a chunk just as the player client unloads it by moving out of range, but they should not crash the chunk gen thread.

 

I discovered with a minimal amount of testing that position based inserts result in the prefab being inserted at ground level. From that I assume that the y pos of the player can (should?) never be below ground now. I guess that's why coppis underground detection is broken too.

To place a prefab with sub levels you'll have to use co-ords based insert.

 

In my testing of the undo, it is technically possible to have loot from one searched loot container transfer to the new inserted one. I'll look at adding a /clearloot option at some stage.

 

Undo does keep the prefab files on a server reboot but currently the pos data is lost. Once that is persisted it will allow undo to be preserved after a reboot. I'll look at adding loot container contents into that data too, so that an undo or restore can reset the loot contents and ownership etc.

Link to comment
Share on other sites

Now that the chunk reloading is working reasonably well, it should make it fairly quick work to add some bc-blocks commands.

 

I was thinking of these to start with:

 

loc - shows player current location (/worldpos /etc), and sets the pos for prefab and block commands

bc-block upgrade - upgrades the blocks 1 step within an area

bc-block repair - repairs all blocks in the area

bc-block downgrade /nodestroy - downgrades all blocks in area, optional for no destroy but only those not on the last stage

bc-block insert /fill=terrain /fill=air /fill=cube[/texture=0,1,2,3,4,5] [default]/fill=all - changes all blocks in an area with the block specified, options act as filters for what blocks get replaced in the target area

bc-block prefab /nopartial /2d - inserts a prefab in the area defined repeating the prefab to fill the area, optional on nopartial to prevent the insertion of partial prefabs at the edges of the area. 2d optional to only draw 1 layer of prefabs rather than stacking them (default)

Link to comment
Share on other sites

Sry, i loaded your fixed version and copy it on my server. i used bc-prefab or bc-lppos and get an error and nothing happened.

After copied back the first version the tool works fine again. But the prefab i spawned with the updated version i got an error

and wasn´t there, was there after restart the server with the old version ^^

Sry for my bad english, i hope you understand my problem.

The manager is a really useful tool, thx for this. The pblock from coppi would be very helpful ^^ I hope you can get it in.

Link to comment
Share on other sites

from what you are describing I would make a guess that it is the chunk reloading that gave the error, as when you reloaded the server and the prefab was there. That indicates the insert worked, and it just didn't reload the chunks so you could see it. If that happens you can move well away from the prefab spot and back again and it should appear.

 

Was it just you on the server or other people as well? I haven't tested it in MP yet so it's possible something doesn't work well when more than one in range. I'll try and get someone to help me test that tonight

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...