[Bilka] Allow optional "night only" and darkness threshold for spawners and units

Post Reply
kyranzor
Filter Inserter
Filter Inserter
Posts: 499
Joined: Fri Oct 31, 2014 4:52 pm
Contact:

[Bilka] Allow optional "night only" and darkness threshold for spawners and units

Post by kyranzor »

A tag on spawner type entities that spawn a variety of units having a tag for enabling a simple 'night only' spawn behaviour, and associated parameter (double data type, or whatever makes most sense for referring to the surface's 'darkness' value) as a threshold.

For example, a spitter spawner that spawns special varieties of spitters when darkness is above 0.5 (out of 1.0 being full night time).

Additionally, a unit entity tag for vulnerability to day time with specified threshold and 'effect' result (which may be damage, or slowness, or explosions etc).

Aeternus
Filter Inserter
Filter Inserter
Posts: 835
Joined: Wed Mar 29, 2017 2:10 am
Contact:

Re: Allow optional "night only" and darkness threshold for spawners and units

Post by Aeternus »

... and then mod them into zombies to turn Factorio into a sciency survival horror game? :D

kyranzor
Filter Inserter
Filter Inserter
Posts: 499
Joined: Fri Oct 31, 2014 4:52 pm
Contact:

Re: Allow optional "night only" and darkness threshold for spawners and units

Post by kyranzor »

yeah that's the plan. why is that so funny? should be horrifying!

321freddy
Fast Inserter
Fast Inserter
Posts: 125
Joined: Fri Sep 23, 2016 10:16 pm
Contact:

Re: Allow optional "night only" and darkness threshold for spawners and units

Post by 321freddy »

You do already have the means to simlate this behaviour. The darkness of a surface can be read with LuaSurface->darkness. When this value reaches a specified limit (check in on_tick) do two things:
  • 1) Loop through every spawner on the surface and set it to active = false
    2) And either one of these:
    • Create a giant invisible poison cloud at the center of the map that has a custom damage type which every entity other than your special spitter has a 100% resistance for.
    • Or loop through every special spitter and "fast replace" it with a similar entity what has a negative healing_per_tick parameter. (See create_entity fast_replace)
After the night you can reverse the changes again. If you encounter performance issues spread the loops out over multiple ticks (or even minutes for a gradual effect).

kyranzor
Filter Inserter
Filter Inserter
Posts: 499
Joined: Fri Oct 31, 2014 4:52 pm
Contact:

Re: Allow optional "night only" and darkness threshold for spawners and units

Post by kyranzor »

This is true, great points there 321freddy.

Bilka
Factorio Staff
Factorio Staff
Posts: 3133
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: [Bilka] Allow optional "night only" and darkness threshold for spawners and units

Post by Bilka »

Okay, I added EnemySpawnerPrototype::min_darkness_to_spawn and max_darkness_to_spawn for 0.17.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

Post Reply

Return to “Implemented mod requests”