Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- RELAY = {
- states = {},
- koefs = {},
- Do = function(self, id, state, time_delta)
- _state = self.states[id]
- if not _state then
- _state = 0
- self.koefs[id] = math.random()*3+3
- end
- if state and _state < 1 then
- _state = _state + time_delta*self.koefs[id]
- self.states[id] = _state
- elseif not state and _state > 0 then
- _state = _state - time_delta*self.koefs[id]
- self.states[id] = _state
- end
- return _state > 0.75
- end,
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement