Spidertron Engineer


Build your factory as a Spidertron from the start! Instead of unlocking better weapons and armor, unlock upgrades to yourself.

Content
1 year, 5 months ago
1.0 - 1.1
3.52K
Transportation Combat

i [Completed-1.8.0] Auto-heal implementation

3 years ago

If you still need auto-heal implementation, you can use this: https://drive.google.com/file/d/1AZOEtvCaoGwmHADWa8y9HxVROSkIodtO/view
I don't use github so i uploaded changed control.lua file to google drive. I marked all changes with "-- Spidertron heal" comment for easier search.

3 years ago

Thanks for the contribution. The code looks good, so I'll consider adding it as a feature.

3 years ago

This implementation can be pretty buggy in multiplayer (i never created anything event based for factorio MP). According to wiki, my code can lead to desync, so I'm looking to made newer version of this script, with 2 additional features:
1. Different auto-heal amounts for spidertron tier
2. System to repair damaged entities
If you want me to continue my work - just send a message and i will share my code and ideas how to implement those features.

3 years ago

Ah yeah, I wondered if it would be multiplayer safe or not. I'm agreed that I think it currently isn't. Using global variables outside of global is the issue I think.

My suggestions:
- Use on_nth_tick instead of on_tick.
- Consider conditionally hooking onto on_tick/on_nth_tick inside of on_entity_damaged and dropping the hook once spiders_to_watch. That way no code is being run when all spidertrons have full health.
- Replace spiders_to_watch with global.spiders_to_watch (or a more descriptive name like spidertrons_needing_heal) and initialise it properly at the start of setup().

"System to repair damaged entities" not sure what you mean here.

I'm not planning to implement this myself, but if you can get it working as discussed then I'd be very happy add it in. I'd recommend for your own sake that you use GitHub, but doing it over google drive is perfectly easy for me (I can paste it in locally and it shows the complete diff).

3 years ago
(updated 3 years ago)
  • Use on_nth_tick instead of on_tick.
    Already done

  • Consider conditionally hooking onto on_tick/on_nth_tick inside of on_entity_damaged
    Can cause desync, Since i can't properly test this, i better stay with more safe version

  • Replace spiders_to_watch with global.spiders_to_watch (or a more descriptive name like spidertrons_needing_heal)
    i'll use spidertrons_to_heal. Sometimes they just don't need heal or became invalid. You can change this name if you want.

  • "System to repair damaged entities" not sure what you mean here.
    As spidertron you can't use repair packs to repair stuff, so i added a shortcut, which will take one repair pack from player or his spidertron inventory and create a healing cloud. It's pretty powerfull, so i scrapped idea of better auto-heal for high tier spidertron engineers (and maybe i should lock this ability behind a research).
    Also, it comes with smoke effects that will show repair distance and how long it work. Smoke is pretty optimized too - i tried this on my low-end work pc. Dropped 10 poison capsules and my fps halfed. Used 50 repair packs - 5 fps drop.
    It works only with repair-packs now. If some mod will add a new repair-tool item, i'll need to rewrite this part.

  • I'd recommend for your own sake that you use GitHub
    I never needed version control so much. I mostly create small scripts and mods for personal use only. I tried Github, i liked it, but it's overkill when you working alone. And not long ago i switched to Waterfox browser and Github won't allow me to do literally anything now.

  • I can paste it in locally and it shows the complete diff
    I'm using compare plugin for notepad++ for this, it's pretty usefull.

Anyway - here is the new version: https://drive.google.com/drive/folders/1I7rFrlmHLA850hGTxQ_J1BPHusdnYQhd

3 years ago
(updated 3 years ago)
  • Consider conditionally hooking onto on_tick/on_nth_tick inside of on_entity_damaged
    Can cause desync, Since i can't properly test this, i better stay with more safe version

It is possible to do it safely, I think that extra code would need to be put into on_load to get it to work. Fair enough, it is not worth the effort or the risk.

Thanks for the changes. I've just tested them and I can see no issues. The repair pack cloud in particular is a nice touch, and far more ambitious then something I'd ever try myself (I quite dislike data-stage stuff!).

The changes are now committed to git (https://github.com/tburrows13/SpidertronEngineer/commit/cc8c3c029ccb92e9c7f4251c91c4f3494af16ad7, after a few minor style alterations) and will be released in the next update in the next few days. If you want to add more features (such as different auto-heal amounts depending on the spidertron tier) then feel free to send more patches and I'll add them in.

Thanks!

3 years ago
(updated 3 years ago)
  • I quite dislike data-stage stuff!
    It's easiest and fastest one. You can add, alter or remove many things on data stage.

  • If you want to add more features (such as different auto-heal amounts depending on the spidertron tier)
    Not worth the effort now. Repair pack heal cloud is pretty powerfull tool since you can stack it. In late game you have construction drones and shields, you don't need better healing at all...
    ...and i realized that repair cloud don't affect all types of spidertrons because of their lack of collision. My bad. I fixed that: https://drive.google.com/drive/folders/1I7rFrlmHLA850hGTxQ_J1BPHusdnYQhd
    Also i changed /create-spidertron command, now you can use it without arguments if you want to create spidertron for yourself without typing your playername. And rearranged my prototypes because we don't really need multiple data:extend calls.

The only feature i can think of now is locking repair cloud with research, but i'm not sure is it a good idea or not. On one side engineer can use repair packs since game start, on the other hand repair cloud is more powerfull.

3 years ago

There's no point locking repair cloud behind a research I think because without it there is no way to use the repair packs at all. I'll add your changes in as well, thanks!

3 years ago

Ok, i found another bug. Looks like my previous code for shortcut event is not working properly and it fired every time when you pressed lua-shortcut. Fixed it: https://drive.google.com/drive/folders/1I7rFrlmHLA850hGTxQ_J1BPHusdnYQhd
Well, at least i found this before new release;)

3 years ago

Thanks for that, though (not having actually tried it myself) your change no longer works for the key bind. I can fix that myself, no problem :)

3 years ago
(updated 3 years ago)

Tried new version - all works fine so far. Really liked shortcut to open spidertron inventory. But you forgot to replace ??? 2020 with actual date in changelog and update limitations section in mod description (and in other info section you can add that /create-spidertron playername can be used without playername).

3 years ago
(updated 3 years ago)

Thanks for the feedback. Yeah I noticed the messed up change log straight after publishing. It’s fixed in the next version (and if you really need a date it is in the “downloads” tab).

I did update the readme, I just forgot to paste the updated version into the mod portal.

3 years ago

Thanks very much for your help by the way. It was a very smooth process, and I'm really happy with how it turned out :D

3 years ago
(updated 3 years ago)

Thanks. It was very nice to work with you too. Merry Crisis and a happy New Fear!:D Oh, wait... stupid 2020! Merry Christmas and a happy New Year!XD

New response