#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Simple Event Sensor
# Version: 1.10
# Author : LiTTleDRAgo
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# Instruction :
#
# Set the event name to : <Sensor(RANGE)>
# example :
# <Sensor4>
#
# If player is in event sensor range, Self switch D (default) will turned ON
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
class Game_Event < Game_Character
#-----------------------------------------------------------------------
SENSOR_SELF_SWITCH = 'D'
#-----------------------------------------------------------------------
alias drago64c_update update
def update
sensor_updating unless @unsensor
drago64c_update
end
def sensor_updating
@event.name =~ /<Sensor(\d+)>/i
s = [$1.to_i,[$game_map.map_id,@id,SENSOR_SELF_SWITCH],[]]
s[2] = [(($game_player.x-self.x).abs + ($game_player.y-self.y).abs <= s[0] ##这里是范圍
), $game_self_switches[s[1]]] if s[0] > 0
return unless s[0] > 0 && s[2][0] != s[2][1]
$game_self_switches[s[1]], $game_map.need_refresh = s[2][0], true
end
end