Project Zomboid

Project Zomboid

SearchModeAPI
star  [udvikler] 20. aug. 2022 kl. 14:34
How it works
a mod 1
SearchModeAPI.Register("mod1", 1) -- low priority (compared)

a mod 2
SearchModeAPI.Register("mod2", 2) -- high priority

the mod 1
SearchModeAPI.Activate("mod1") local mode = getSearchMode():getSearchModeForPlayer(0) mode:getDarkness():setTargets(0.5, 0.5) SearchModeAPI.Deactivate("mod1")
Now the screen is dark (50%).

the mod 2
SearchModeAPI.Lock("mod2") SearchModeAPI.Activate("mod2") local mode = getSearchMode():getSearchModeForPlayer(0) mode:getDarkness():setTargets(1, 1) --black SearchModeAPI.Deactivate("mod2")
Now the screen is black (100%).

the mod 1
SearchModeAPI.Lock("mod1")
No effect. The ruler now is the mod 2.

the mod 2
SearchModeAPI.Unlock("mod2")
Now the screen is dark again, because the mod 2 frees resources. Now the ruler is the mod 1.

the mod 1
SearchModeAPI.Activate("mod1") local mode = getSearchMode():getSearchModeForPlayer(0) mode:getDarkness():setTargets(0, 0) SearchModeAPI.Deactivate("mod1")
Now screen is normal (0% of darkness)

the mod 2
SearchModeAPI.Lock("mod2")
Now the screen is black again. The ruler is mod 2.

the mod 1
SearchModeAPI.Activate("mod1") local mode = getSearchMode():getSearchModeForPlayer(0) mode:getDarkness():setTargets(0.1, 0.1) SearchModeAPI.Deactivate("mod1")
No effect (yet)

and so on
Sidst redigeret af star; 20. aug. 2022 kl. 15:35