ghostforest.nut 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import("/levels/preload_worldselect.nut");
  2. state.world_select["/levels/world2/worldmap.stwm"].unlocked <- true;
  3. if("ambient_r" in state && "ambient_g" in state && "ambient_b" in state){
  4. worldmap.settings.fade_to_ambient_light(state.ambient_r,
  5. state.ambient_g,
  6. state.ambient_b,
  7. 0);
  8. }
  9. if(! ("ghostforest" in state)){
  10. state.ghostforest <- false;
  11. print("[DEBUG] Ghost Forest state initialized\n");
  12. }
  13. function go_ghostforest(under){
  14. fade_time <- 0.35;
  15. ghost_darkness.fade(under ? 1 : 0, fade_time);
  16. ghost_land.fade(under ? 1 : 0, fade_time);
  17. ghost_convex.fade(under ? 1 : 0, fade_time);
  18. ghost_edges.fade(under ? 1 : 0, fade_time);
  19. ghost_back.fade(under ? 1 : 0, fade_time);
  20. ghost_front.fade(under ? 1 : 0, fade_time);
  21. ghost_trees0.fade(under ? 1 : 0, fade_time);
  22. ghost_trees1.fade(under ? 1 : 0, fade_time);
  23. ghost_trees2.fade(under ? 1 : 0, fade_time);
  24. ghost_trees3.fade(under ? 1 : 0, fade_time);
  25. ghost_trees4.fade(under ? 1 : 0, fade_time);
  26. land_trees1.fade(under ? 0 : 1, fade_time);
  27. land_trees2.fade(under ? 0 : 1, fade_time);
  28. land_trees3.fade(under ? 0 : 1, fade_time);
  29. land_trees4.fade(under ? 0 : 1, fade_time);
  30. back_trees.fade(under ? 0 : 1, fade_time);
  31. state.ghostforest <- under;
  32. }
  33. go_ghostforest(state.ghostforest);