gate.lua 995 B

12345678910111213141516171819202122232425262728293031
  1. if not ambiance.gate_registered then
  2. ambiance.register_sound_beacon(":soundbeacon:gate", {
  3. -- Minimum and maximum times between environment checks.
  4. check_time_min = 60,
  5. check_time_max = 60*15,
  6. -- Minimum and maximum times between sounds playing.
  7. play_time_min = 5,
  8. play_time_max = 6,
  9. -- Shall check the beacon's nearby environment, and return 'true' if beacon
  10. -- can remain, 'false' or 'nil' if it should be removed. Data can be stored in
  11. -- `data`. `pos` is always a rounded position.
  12. on_check_environment = function(data, pos)
  13. if obsidian_gateway.find_gate(pos) then
  14. return true
  15. end
  16. end,
  17. -- Shall play sound to nearby players (or check whether sound can be played at
  18. -- this time). Data can be stored in `data`. `pos` is
  19. -- always a rounded position. `dtime` is seconds since last call to func.
  20. on_play_sound = function(data, pos, dtime)
  21. ambiance.sound_play("obsidian_gate_rumble", pos, 1.0, 32)
  22. end,
  23. })
  24. ambiance.gate_registered = true
  25. end