Jump to content

A16 - djkrose's Scripting Mod


djkrose

Recommended Posts

A lot of the density issues are from prefabs. Many of them all full of density settings outside the normal range. An example is the sandpit in the daycare.

 

For falling blocks you can look at the entities dict

 

The game produces new density mismatches constantly even on without any POI or falling blocks involved. As I said, even creating a fresh game, walking 5 meters straight ahead - 10 density errors. Walking another 5 meters, 13 density errors. -- So there is really a conceptunally problem there, but I guess the problem is more "what counts as an error".

My mod internally uses the density checks from the game (from Alloc AFAIK), so maybe they are just too strict.

 

I found only real problems after imort/export operations, reverted region files, regenerated chunks, huge collapses,... basically messing around. :)

 

djkrose

Link to comment
Share on other sites

Hi djkrose, thanks for the mod, I have been using it on my server for a while. I have a couple of questions.

 

1. Is it possible to find out which region the physics calculations are taking place in? We still get occasional griefers who will try to lag out the server by causing huge collapses. Finding them is a pain and takes up admin time. We have a rule against large collapses but there are always players who didn't know or "forgot".

 

could use something like this

 

 

     var world = GameManager.Instance.World;
     if (world == null) return;

     var threshhold = 200;

     var entityCount = world.Entities.Count;
     if (entityCount > threshhold)
     {
       var regions = new Dictionary<string, int>();
       var fallingBlocks = world.Entities.dict.Values.OfType<EntityFallingBlock>();
       foreach (var blockEntity in fallingBlocks)
       {
         var rx = (int)Math.Floor(blockEntity.position.x / 512);
         var rz = (int)Math.Floor(blockEntity.position.z / 512);
         var regionXZ = new BCMVector2(rx, rz);
         if (regions.ContainsKey(regionXZ.ToString()))
         {
           regions[regionXZ.ToString()] += 1;
         }
         else
         {
           regions.Add(regionXZ.ToString(), 1);
         }
       }

       var regionsSorted = regions.OrderByDescending(r => r.Value).ToDictionary(r => r.Key, r => r.Value);
       //do stuff with results, like remove all falling blocks in top region(s)

     }

 

Edit: you could make the search finer grained by changing the /512 to say /16 for chunks etc

Link to comment
Share on other sites

If you are referring to the density check errors: I also get massive amounts of wrong densities on my server, and it's even like this on a completely new world with just me walking a few meters back and forth. So I asked Alloc (TFP) the same question, and he wasn't sure how those occur. But he said that most likely most of these "density mismatches" don't lead to any problems. So while "technically" wrong, it's not really worth looking at until problems are visible. Maybe it's just a design flaw in the game or whatever.

 

I have excluded the automatic density check on my server and just execute once in a while manually when people are falling through the world or weird terrain texture shapes appear.

 

djk

 

I also get a lot of Respawn locked because of entites lost messages, so I wonder if all them are legit too. I haven't had any complaints about the weird texture shapes in a while so the mod must be doing something at least. :p

 

- - - Updated - - -

 

could use something like this

 

 

     var world = GameManager.Instance.World;
     if (world == null) return;

     var threshhold = 200;

     var entityCount = world.Entities.Count;
     if (entityCount > threshhold)
     {
       var regions = new Dictionary<string, int>();
       var fallingBlocks = world.Entities.dict.Values.OfType<EntityFallingBlock>();
       foreach (var blockEntity in fallingBlocks)
       {
         var rx = (int)Math.Floor(blockEntity.position.x / 512);
         var rz = (int)Math.Floor(blockEntity.position.z / 512);
         var regionXZ = new BCMVector2(rx, rz);
         if (regions.ContainsKey(regionXZ.ToString()))
         {
           regions[regionXZ.ToString()] += 1;
         }
         else
         {
           regions.Add(regionXZ.ToString(), 1);
         }
       }

       var regionsSorted = regions.OrderByDescending(r => r.Value).ToDictionary(r => r.Key, r => r.Value);
       //do stuff with results, like remove all falling blocks in top region(s)

     }

 

Edit: you could make the search finer grained by changing the /512 to say /16 for chunks etc

 

Thanks, that just might do the trick.

Link to comment
Share on other sites

Hello and thank you for this wonderful mod. I use it to help combat electrical corruption. I do have a question of concern. I noticed that after I began using this mod my servers sleepers were disappearing. I am NOT stating this mod was indeed the cause but i am wondering if maybe others may have experienced this issue as well. If so is there a way to reverse the problem? More important regardless of how this happens this mod uses scripts to fix so many issues. Can you update this mod to fix sleepers that are no longer in buildings? Thank you for your time

Link to comment
Share on other sites

I also get a lot of Respawn locked because of entites lost messages, so I wonder if all them are legit too. I haven't had any complaints about the weird texture shapes in a while so the mod must be doing something at least. :p

 

The locked respawn detection is actually more a fuzzy one. For a definitive check if a zombie has disappeared, the mod would need to load EVERY chunk of the whole map and search for the zombie, which is not feasible. Also, I would still consider it "locked up" when for example a zombie from chunk 0,0 follows a player and wanders off far away to chunk 25,37. This would mean no spawns at chunk 0,0 until some player comes by at 25,37 and kills that one zombie.

 

Therefore the detection algorithm at present is as follows: A zombie is regarded as lost when it cannot be found within 9 chunks (144 blocks) of its origin, or in any other currently loaded chunk. So when a zombie wanders 150 blocks away and no player is nearby, it is regarded as lost for the originating chunk, i.e. the originating chunk is allowed to spawn a new one when players come by.

 

If you have StompiNZ' latest BCM mod installed and activated the spawn detection (default), you'll actually see in the console how the game spawns zombies in a chunk right after lost zombies were declared dead by the mod.

 

The scan radius is configurable internally, but I thought it makes sense to be <10 blocks because that is often the view/load range of players, and I don't see a goot reason why zombies should wander so far off unless intentionally pulled away.

 

Hello and thank you for this wonderful mod. I use it to help combat electrical corruption. I do have a question of concern. I noticed that after I began using this mod my servers sleepers were disappearing. I am NOT stating this mod was indeed the cause but i am wondering if maybe others may have experienced this issue as well. If so is there a way to reverse the problem? More important regardless of how this happens this mod uses scripts to fix so many issues. Can you update this mod to fix sleepers that are no longer in buildings? Thank you for your time

 

None of the repair algorithms does anything with the sleeper volume spawns (POI), so I doubt it has anything to do with that. I also have it running on my server since the beginning and never noticed anything in this area. -- I know that StompiNZ is currently investigating deep into the sleeper volume data and as a result might bring a command to get detailed information about sleeper volumes in a chunk. Maybe check this out to see what's going on? As an alternative, the included sleeper script in my mod shows the number of sleepers volumes in the current chunk, so you can check that easily.

 

What do you actually mean by "fixy sleepers that are no longer in buildings"? I haven't seen a problem in this area.

 

ooOO( djkrose )OOoo

 

ps: i'm currently drunk so excuse my bad english (not first language) ^^

Link to comment
Share on other sites

None of the repair algorithms does anything with the sleeper volume spawns (POI), so I doubt it has anything to do with that. I also have it running on my server since the beginning and never noticed anything in this area. -- I know that StompiNZ is currently investigating deep into the sleeper volume data and as a result might bring a command to get detailed information about sleeper volumes in a chunk.

 

I've got the latest release with this command in now

 

bc-sleeper volume <index> will give the details on sleeper volume: group, pos, size, spawn points, and importantly the remaining time in days until the next respawn. This version doesnt include any info on current spawned zombies etc but the data is there so will be adding that probably in the next update (a list of spawned entityIds)

 

bc-sleeper chunk will give the indexes of the volumes in the chunk etc for use in the above command, and bc-sleeper list will give the list for the entire world. I havent tested the impact of the full world list command on a busy server yet, so be aware it may lag the server if lots of players on

Link to comment
Share on other sites

Hi, i am currently using your scripting mod (JS).

 

I am iterating GameManager.Instance.World.Entities.list and collection the player entities on the fly while doing other stuff. I want to get their steam ids. I thought it would be a simple task like entity.SteamId, but it seems more complicated. Are there any docs of 7dtd functions? I found nothing via google. I also tried iterating single entity objects to get more infos about properties but its not working. (I think because i tried to iterate a C# object in a javascript loop)

Link to comment
Share on other sites

Hey DJ, I got a corrupt player base that dj-repair isn't able to fix. I was wondering if you could take a look at it.

 

https://www.dropbox.com/s/ay5nbu53x0nxs9j/corrupt%20base.rar?dl=0

 

If you look at the North side of the tower near the NE corner there's some invisible blocks that are throwing out errors.

 

Here's a picture of the area with error messages.

 

C8D57667D13D497F1382A0B55EF4689C886160F9

 

I don't know how it happened, but when I got there there was frozen physics because the players had been collapsing so much. Not only were large chunks of terrain floating but even the diamond shaped falling debris was stuck in mid air. I tried to clean it up as best I could but it made no difference. I tried recalculating stability which didn't do anything, and repairchunkdensity didn't find any errors. If you walk around on that level in the base it's easy to fall through the blocks like they aren't there.

Link to comment
Share on other sites

I don't know how it happened, but when I got there there was frozen physics because the players had been collapsing so much. Not only were large chunks of terrain floating but even the diamond shaped falling debris was stuck in mid air. I tried to clean it up as best I could but it made no difference. I tried recalculating stability which didn't do anything, and repairchunkdensity didn't find any errors. If you walk around on that level in the base it's easy to fall through the blocks like they aren't there.

 

there's an issue with falling blocks on resetting the chunks the way we are. a server restart fixes the falling blocks.

Link to comment
Share on other sites

there's an issue with falling blocks on resetting the chunks the way we are. a server restart fixes the falling blocks.

 

Server restart has not fixed the falling blocks, also has not fixed recurring error messages for players in the area. I might try to overwrite these broken blocks with pblock, but I understand that is also causing errors now.

Link to comment
Share on other sites

Server restart has not fixed the falling blocks, also has not fixed recurring error messages for players in the area. I might try to overwrite these broken blocks with pblock, but I understand that is also causing errors now.

 

hmm, must be something with the glitch that breaks it then, maybe not releated the the reset command in this case.

 

Whats the issue with pblock? I've seen no breaking changes for my block command in bad co :)

Link to comment
Share on other sites

hmm, must be something with the glitch that breaks it then, maybe not releated the the reset command in this case.

 

Whats the issue with pblock? I've seen no breaking changes for my block command in bad co :)

 

You said so yourself here https://7daystodie.com/forums/showthread.php?44835-Coppi-MOD-New-features&p=745574&viewfull=1#post745574

 

I don't want to use the command now if it's going to cause a null ref every time someone kills a zombie.

Link to comment
Share on other sites

Side note for those running in Linux: I had an issue with Windows line breaks in the scripts causing them to not be read correctly and unable to be used. Removing these line breaks corrected the issue.

 

Thanks for the report! Apparently the script engines are not flexible enough to handle both types of line breaks. So which line break style worked for you under Linux? The example scripts are shipped with Windows-sytel line breaks, but when you edit/create your own scripts under Linux as normal text files, they have Linux-style line breaks.

 

I added an issue on Gitup for it: https://github.com/djkrose/7DTD-ScriptingMod/issues/28

 

I am iterating GameManager.Instance.World.Entities.list and collection the player entities on the fly while doing other stuff. I want to get their steam ids. I thought it would be a simple task like entity.SteamId, but it seems more complicated. Are there any docs of 7dtd functions? I found nothing via google. I also tried iterating single entity objects to get more infos about properties but its not working. (I think because i tried to iterate a C# object in a javascript loop)

 

The Entity objects don't contain steam IDs as far a I know, but the ClientInfo objects do. You can get it like this:

 

[color=#99CF50]var[/color] clientInfo [color=#E28964]=[/color] ConnectionManager.Instance.GetClientInfoForEntityId(entityId);
[color=#DAD085]dump[/color](clientInfo.playerName); [color=#AEAEAE][i]// nickname of player[/i][/color]
[color=#DAD085]dump[/color](clientInfo.playerId); [color=#AEAEAE][i]// steam id of player[/i][/color]
[color=#DAD085]dump[/color](clientInfo.ownerId); [color=#AEAEAE][i]// steam id of game owner (differs for Steam familiy sharing)[/i][/color]

 

To get properties about an object, just use the built-in method dump(..). It will dump the full object to the server log file. With a second parameter you can control the hierarchy depth that dump traverse, for example dump(entity, 2) to dump all properties of the entitiy 2 levls deep.

 

Simple iterating over properties is not possible in the sme way as with normal JavaScript objects, unfortunately.

 

Hey DJ, I got a corrupt player base that dj-repair isn't able to fix. I was wondering if you could take a look at it.

 

Can you post the full error message with stack trace from the server log file? Otherwise I have no idea where that problem comes from and if it's a generic data-driven problem that the mod could fix.

 

..ooOO( djkrose )OOoo..

Link to comment
Share on other sites

Patch for zombie corpse item dupe exploit

 

I just released a new mod version: Download

 

Because I got sick of cheaters and unfixed exploits on my server, I implemented a full runtime code patching system. It allows my mod to modify the game code and basically every game's behavior at runtime in memory, similar to how it can be done with SDX mods on client-side. Patches can be activated and deactivatd on-the-fly.

 

Fix for zombie corpse dupe exploit

The mod includes one patch: Finally fix that damn zombie corpse item dupe exploit!

 

In contrast to other xml workarounds, this one ...

  • ... does not put your server into the modded section,
  • ... also prevents duplication of originally dropped items,
  • ... has minimal functionality change: Only when a corpse was touched and items were left inside, the corresponding gore block is emptied. Untouched or emptied bodies are not modified in any way.

 

What is logged?

Whenever a corpse loot is emptied, a server log message is written like this:

 

[sCRIPTING MOD] Cleared touched zombie corpse at 630, 115, 1945 killed by 'djkrose'.

 

How to activate it?

dj-patch corpse-dupe on

 

Command help

> help dj-patch
Applies runtime patches to the server code in memory without modifying any server files. The on/off status of the patch
is remembered and automatically reapplied after server restart. The applied patches is listed in server log upon restart.
Currently supported patches:
   corpse-dupe   =>  Patches the zombie corpse item dupe exploit listed in the known issues for A16.x
Usage:
   1. dj-patch
   2. dj-patch <patch-name> on
   3. dj-patch <patch-name> off
3. Lists the current status (on/off) of all patches.
2. Enable the named patch.
3. Disable the named patch.
Example:
   dj-patch corpse-dupe on                Patch the zombie corpse item dupe exploit

 

Release change log

 

  • Add runtime patching system and command "dj-patch"
  • Added patch for zombie corpse item dupe exploit; activate with: dj-patch corpse-dupe on
  • Removed command aliases "js" and "lua" to leave only the "-test" ones.

 

..ooOO( djkrose )OOoo..

Link to comment
Share on other sites

Yeah, I didn't like that either...

 

Gore blocks go poooof when there is already one in the same block, which can easily happen with hordes.

And setting the value down to 1 sometimes disables drops entirely, and setting it higher makes it possible to at least duplicate the original loot.

Plus the server goes into modded... :\

Link to comment
Share on other sites

Cool !!! Thanks lot !!!

 

I just released a new mod version: Download

 

Because I got sick of cheaters and unfixed exploits on my server, I implemented a full runtime code patching system. It allows my mod to modify the game code and basically every game's behavior at runtime in memory, similar to how it can be done with SDX mods on client-side. Patches can be activated and deactivatd on-the-fly.

 

Fix for zombie corpse dupe exploit

The mod includes one patch: Finally fix that damn zombie corpse item dupe exploit!

 

In contrast to other xml workarounds, this one ...

  • ... does not put your server into the modded section,
  • ... also prevents duplication of originally dropped items,
  • ... has minimal functionality change: Only when a corpse was touched and items were left inside, the corresponding gore block is emptied. Untouched or emptied bodies are not modified in any way.

 

What is logged?

Whenever a corpse loot is emptied, a server log message is written like this:

 

 

 

How to activate it?

dj-patch corpse-dupe on

 

Command help

> help dj-patch
Applies runtime patches to the server code in memory without modifying any server files. The on/off status of the patch
is remembered and automatically reapplied after server restart. The applied patches is listed in server log upon restart.
Currently supported patches:
   corpse-dupe   =>  Patches the zombie corpse item dupe exploit listed in the known issues for A16.x
Usage:
   1. dj-patch
   2. dj-patch <patch-name> on
   3. dj-patch <patch-name> off
3. Lists the current status (on/off) of all patches.
2. Enable the named patch.
3. Disable the named patch.
Example:
   dj-patch corpse-dupe on                Patch the zombie corpse item dupe exploit

 

Release change log

 

  • Add runtime patching system and command "dj-patch"
  • Added patch for zombie corpse item dupe exploit; activate with: dj-patch corpse-dupe on
  • Removed command aliases "js" and "lua" to leave only the "-test" ones.

 

..ooOO( djkrose )OOoo..

Link to comment
Share on other sites

I see "Removed command aliases "js" and "lua" to leave only the "-test" ones."

 

But cant to call command "sleepers" , I also try js-sleepers or dj-sleepers ... command complete removed?

 

No, the command is still there named "js-sleepers". See the file js.sleepers.js. In the header you can change the command to anything you like.

 

Remember that the command works from the console, not the chat, and that you need to be admin by default to use it.

Link to comment
Share on other sites

I trying but I got "ERROR: unknown command "

 

Screenshot :

dj.jpg.4ba36f70ff005321f0ae493197110f0a.jpg

No, the command is still there named "js-sleepers". See the file js.sleepers.js. In the header you can change the command to anything you like.

 

Remember that the command works from the console, not the chat, and that you need to be admin by default to use it.

Link to comment
Share on other sites

Can try dj-version to see if the mod is loaded at all?

 

Then you can have a look into the server log at start-up. The mod logs out a lot of status messages, all tagged with "[sCRIPTING MOD]". If a script is loaded, or cannot be loaded or is ignored for any reason, it would say so in the log.

 

There were reports that different line endings on Linux could cause troble, but I believe that was only for Lua scripts...

 

Just check in the scripts folder below the ScriptingMod directory if the js-sleepers.js script is there and the content loks alright. If in doubt, get a fresh copy.

 

djk

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...