Skip to content

[Bug] Alarmsound does not change if changed right after deactivating it #160

@GHXX

Description

@GHXX

Describe the bug
When calling the .setAlarm() lua function of the alarm block right after calling .deactivate(), and activating it immediately after, then it does not change.

In which environment did the Bug appear?
Singleplayer, fresh world.

To Reproduce
Steps to reproduce the behavior:

  1. Make a new world
  2. use the /oc_sc command to plop down a opencomputers computer
  3. place an alarm block next to the computer
  4. turn on the pc
  5. open the lua prompt in oc by typing "lua" and hitting enter
    6.1. set the variable "a" to be an alarm (a = require("component").sc_alarm)
    6.2 paste in the following code snippet (as a single line! you can paste it with middle mouse button):
    for i=1,#a.listSounds() do al = a.listSounds()[i]:gsub(".ogg",""); print(al);a.setAlarm((al)); a.activate(); os.sleep(5);a.deactivate() end
  6. hit enter
  7. how the first sound thats installed (klaxon2) will play and keep looping, but the other will never play. (i installed 6 additional sounds, but it shouldnt matter here)
  8. now, run this snippet:
    for i=1,#a.listSounds() do al = a.listSounds()[i]:gsub(".ogg",""); print(al);a.setAlarm((al)); a.activate(); os.sleep(5);a.deactivate();os.sleep(0.5) end
    and now it will work properly.

Expected behavior
The sound should change when deactivating the alarm, changing it an reactivating it.
Adding an extra "os.sleep" should not be necessary under any circumstances.

Screenshots / Code Snippet
image

Minecraft:

  • Mod Version (e.g. OpenSecurity-MC1.12.2-1.0-48)
  • Minecraft Version (e.g. Minecraft 1.12)
  • Forge Version (e.g. Forge 14.23.5.2854)
    (some other mods are installed, but this should not be a compatability issue i am assuming)
    image

Additional context
There are no outputs in the log file while this problem happens.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions