function init()
    switch = FindShape("switch")
    lamp = FindShapes("lamp")
    for i = 1, #lamp do
        SetShapeEmissiveScale(lamp[i], 0)
    end
    SetTag(switch, "interact", "Turn On")
    onsnd = LoadSound("MOD/not-evf-scripts/snd/switchon.ogg")
    offsnd = LoadSound("MOD/not-evf-scripts/snd/switchoff.ogg")
end

function tick()
    if IsShapeBroken(switch) then
        RemoveTag(switch, "interact")
    end

    if GetPlayerInteractShape() == switch and InputPressed("interact") then
        if on then 
            for i = 1, #lamp do
                SetShapeEmissiveScale(lamp[i], 0)
            end
            SetTag(switch, "interact", "Turn On")
            on = false
            PlaySound(offsnd)
        else
            for i = 1, #lamp do
                SetShapeEmissiveScale(lamp[i], 1)
            end
            SetTag(switch, "interact", "Turn Off")
            on = true
            PlaySound(onsnd)
        end
    end
end