Space Engineers

Space Engineers

465 个评价
Tank Tracks Framework & API
8
6
5
3
2
3
2
2
2
   
奖励
收藏
已收藏
取消收藏
Type: Mod
Mod category: Script, Other
文件大小
发表于
更新日期
512.638 KB
2024 年 4 月 1 日 上午 6:42
6 月 14 日 下午 10:06
17 项改动说明 ( 查看 )

订阅以下载
Tank Tracks Framework & API

在 Digi 的 1 个合集中
Digi's Space Engineers mods
51 件物品
描述
This provides other mods the ability to have tracks over specific types of blocks.

Video courtesy of Patrick.

Player usage
You need other mods that use this to have something actually happen.

List of known mods using this:
If you make a mod that uses this framework, contact me and I'll add it to this list.


Features
  • Framework & API
    Any mod can use this to make their own tracks over specific blocks with their own model.
    It also has a C# modding API, refer to the tank track builder mod as an example.

  • Flexible and animated (View[imgur.com])
    Track "stretches" over any number of chosen wheels as a convex shape.
    It animates 1:1 to vehicle movement and it reacts to terrain or grids under it.
    But do mind that it's visual only! At least by default, other mods can use the API to give it special properties.

  • Static rollers
    Non-suspension wheels can also be used with or without rotors.
    They're also rotated with track movement (or a subpart can be instead).

  • Car controls maintained
    Suspensions still physically steer but visually they remain straight, allowing you to control it like a car.
    For actual tank-steering you'll have to use the various options already out there like PB scripts or mods.

  • Debris when destroyed
    The pieces get scattered from the broken wheel location and live for about 10s.
    Also an option for particle effect per broken segment (ones near the broken wheel are tagged as broken segments).

  • Multiplayer-ready
    Track creation and removal is synchronized to/from players (the API too).

  • Blueprints, projection and copy-paste support
    Tracks get saved in one of the blocks, this means they carry over to blueprints, pastes, etc.
    Designed to work with projectors by waiting until all blocks are present.
    It also shows up in projection itself (currently only static and suspension can do this).

  • Coloring and skinning support
    The tracks take on the color and skin of the base block (suspension, rotor, or the wheel block itself if static).

  • Optimized
    Various optimizations are made to help alleviate the impact
    - Animations are computed player-side, DS still computes some track checking things but no animations.
    - Update-rate based on changes and distance as well as track size, a huge track will still update smoothly over a longer distance. Also stops updating and goes invisible after a high distance.
    - Each track is computed in parallel to all others while simulation waits for all to complete, this reduces the linear increase in compute time with more tracks present.
    - Still a lot more left to be optimized, primarily in avoiding the mod profiler hit...


Modders: Adding Tracks

A few things needed:
  • A model for the track segment (can use zonechip item model as a temporary one). Recommended to be 1m wide to aid with scaling guesstimates.
  • Blocks to allow them on, can be vanilla or custom (supported types: MotorSuspension and static CubeBlock/Wheel/etc.)
  • TankTracks.ini file in your mod's Data folder, see: https://gist.github.com/THDigi/d9d41e35a97fd9b55a3e9d3a7e0a8d72
    It is important for this file to be named exactly that and be directly Data folder, the modAPI cannot search for files.
  • This mod as dependency (also let me know if you want your mod linked in this page).

You can look at Tracks over Vanilla wheels's contents as a practical example.

For fine tweaks there's /tanktracks reload to reload all the TankTracks.ini from all mods and respawn tracks. Only works in offline worlds.


Modders: API
NOTE: This is optional! To add new tracks you don't need to program anything, see the above section instead.

The Track Builder mod can act as an example for the API usage.

The gist is:
  1. Go to this mod's downloaded files and copy the Data\Scripts\TankTracks\API folder to your mod (can rename the folder of course).
  2. A session component to handle instancing and unloading of the TankTracksAPI class: https://gist.github.com/THDigi/d515209c9dce1d0bee1deb86235a654a
  3. And that's it, now you can interact with the tank tracks API.

Mind that the API is not even close to complete so don't be shy in asking for things to be exposed or fixed.


mod io?
Please read[gist.github.com]
热门讨论 查看全部(1)
8
2024 年 4 月 21 日 下午 10:13
Flickering Text
Souls
133 条留言
DangerNoodle13 10 月 1 日 下午 4:36 
The modded suspension block (Like sprockets) have stopped being compatible again. Has there been a recent update?
Digi  [作者] 9 月 27 日 上午 7:34 
The suspension body is what gives the track the color, not the wheel. That was on purpose so that one can have differently-colored wheels than the tracks.
MUTED 9 月 26 日 下午 9:44 
For some reason tracks now keep the original colors of the grid? Re-painted blocks several times, but nothing can change them.
Sköll 9 月 14 日 上午 4:52 
I did try to go through my old logs and for whatever reason the lines weren't on them anymore about the tank tread API causing the error. I don't know why. If it happens again I can post the logs, but it likely is what you said. Taking the mod out for a while fixed it so I have it back in and it's working fine.
Digi  [作者] 9 月 14 日 上午 12:19 
@Sköll the log is still there up to 3 days from its creation if you wanna find it in %appdata%/SpaceEngineers/ and sort by date.

But it sounds like there was a failure to either load or to unload from a different world which didn't tell my mod it unloaded so it didn't close the write lock on its own log file, and loading into a new world would've always crashed from it not being able to add a write lock onto that file.

So for future ref, if you ever get strange new crashes during loading of a world, restart the game before doing any changes to clear out all the hooks from previously failed worlds.
Sköll 9 月 13 日 上午 7:29 
@Blyatapus try putting a single control block on any attached items. Like a single button panel. For some reason, the grid doesn't count as being owned by you unless some kind of accessible block is present on the grid is on it that is controlled by you. So stick a button on the side of any grid/subgrid you need to put treads on and then remove it when you're done.
Sköll 9 月 13 日 上午 7:26 
I went to go load the mod to get the log, and for reasons I can't explain, it just stopped crashing. I didn't touch or change anything, it just doesn't crash anymore. I don't understand this game >:V
Digi  [作者] 9 月 13 日 上午 12:19 
Post the SE log from when it denied you loading.
Sköll 9 月 12 日 下午 2:09 
Something broke in the mod, I can't get my world to load with the mod enabled. Disabling it makes the world load in fine.
Blyatapus 9 月 1 日 上午 9:11 
@Digi I have the same issue as UncleFester right now.

I had a LG rover that was a half-track, piston-jacked it to renovate the suspension and now it's telling me I can't build tracks on a neutral/enemy vehicle.

Restart doesn't fix it, it was just a locally hosted MP server and changing it to solo dolo doesn't fix it either. Any ideas?