module Code_Input
Codes = {}
Codes[[Input::UP, Input::UP, Input::DOWN, Input::DOWN, Input::LEFT, Input::RIGHT, Input::LEFT, Input::RIGHT, Input::L, Input::R]] = 1
@on = false
Delay_Frames = 400
# Do not modify
Max_Keys = 0
Codes.keys.each {|a| Max_Keys = a.size if a.size > Max_Keys}
Keys = []
Codes.keys.each do |code_list|
code_list.each do |constant|
Keys << constant unless Keys.include?(constant)
end
end
@delay_frames = Delay_Frames
def self.on=(bool)
@inputed = [] if bool != @on
@on = bool
end
def self.on
return @on
end
def self.update
return if @on == false
Keys.each do |constant|
if Input.trigger?(constant)
@inputed << constant
self.check_inputed
@inputed.shift until @inputed.size <= Max_Keys
end
end
if @delay_frames > 0
@delay_frames -= 1
return
end
@delay_frames = Delay_Frames
@inputed.shift
end
def self.check_inputed
for i in 0...@inputed.size
for code_list in Codes.keys
entered = true
for j in 0..code_list.size
if @inputed[i + j] != code_list[j]
entered = false
break
end
end
if entered
$game_temp.common_event_id = Codes[code_list]
return
end
end
end
end
end
module Input
class << self
alias_method :seph_codeinput_input_update, :update
def update
seph_codeinput_input_update
Code_Input.update
end
end
end