Class: PFM::Environment
- Includes:
- GameData::SystemTags
- Defined in:
- docs/4_Systems_202_Environment.rb
Overview
Environment management (Weather, Zone, etc…)
The global Environment object is stored in $env and PFM.game_state.env
Constant Summary collapse
- UNKNOWN_ZONE =
Unkonw location text
'Zone ???'
- WEATHER_NAMES =
List of weather symbols
%i[none rain sunny sandstorm hail fog hardsun hardrain strong_winds snow]
Constants included from GameData::SystemTags
GameData::SystemTags::AcroBike, GameData::SystemTags::AcroBikeRL, GameData::SystemTags::AcroBikeUD, GameData::SystemTags::BridgeRL, GameData::SystemTags::BridgeUD, GameData::SystemTags::CrackedSoil, GameData::SystemTags::DeepSwamp, GameData::SystemTags::Empty, GameData::SystemTags::HeadButt, GameData::SystemTags::Hole, GameData::SystemTags::JumpD, GameData::SystemTags::JumpL, GameData::SystemTags::JumpR, GameData::SystemTags::JumpU, GameData::SystemTags::MachBike, GameData::SystemTags::Puddle, GameData::SystemTags::RClimb, GameData::SystemTags::RapidsD, GameData::SystemTags::RapidsL, GameData::SystemTags::RapidsR, GameData::SystemTags::RapidsU, GameData::SystemTags::Road, GameData::SystemTags::RocketD, GameData::SystemTags::RocketL, GameData::SystemTags::RocketR, GameData::SystemTags::RocketRD, GameData::SystemTags::RocketRL, GameData::SystemTags::RocketRR, GameData::SystemTags::RocketRU, GameData::SystemTags::RocketU, GameData::SystemTags::SlopesL, GameData::SystemTags::SlopesR, GameData::SystemTags::StairsD, GameData::SystemTags::StairsL, GameData::SystemTags::StairsR, GameData::SystemTags::StairsU, GameData::SystemTags::StopSlide, GameData::SystemTags::SwampBorder, GameData::SystemTags::TCave, GameData::SystemTags::TGrass, GameData::SystemTags::TIce, GameData::SystemTags::TMount, GameData::SystemTags::TPond, GameData::SystemTags::TSand, GameData::SystemTags::TSea, GameData::SystemTags::TSnow, GameData::SystemTags::TTallGrass, GameData::SystemTags::TUnderWater, GameData::SystemTags::TWetSand, GameData::SystemTags::WaterFall, GameData::SystemTags::Whirlpool, GameData::SystemTags::ZTag
Instance Attribute Summary collapse
-
#game_state ⇒ PFM::GameState
Get the game state responsive of the whole game state.
-
#last_map_id ⇒ Integer
readonly
Last visited map ID.
-
#master_zone ⇒ Integer
readonly
The master zone (zone that show the panel like city, unlike house of city).
-
#modified_worldmap_position ⇒ Array?
readonly
Return the modified worldmap position or nil.
-
#worldmap_custom_markers ⇒ Array
readonly
Custom markers on worldmap.
Instance Method Summary collapse
-
#add_worldmap_custom_icon(filename, worldmap_id, x, y, ox_mode = :center, oy_mode = :center)
Add the custom marker to the worldmap.
-
#apply_weather(id, duration = nil)
Apply a new weather to the current environment.
-
#building? ⇒ Boolean
Is the player inside a building (and not on a systemtag).
-
#can_fish? ⇒ Boolean
Can the player fish ?.
-
#cave? ⇒ Boolean
Is the player in a cave ?.
-
#convert_zone_type(system_tag) ⇒ Integer
Convert a system_tag to a zone_type.
-
#current_weather ⇒ Integer
Return the current weather id according to the game state (in battle or not).
-
#current_weather_db_symbol ⇒ Symbol
Return the db_symbol of the current weather.
-
#current_zone ⇒ Integer
(also: #get_current_zone)
Return the current zone in which the player is.
-
#current_zone_data ⇒ Studio::Zone
(also: #get_current_zone_data)
Return the zone data in which the player is.
-
#current_zone_name ⇒ String
Return the zone name in which the player is (master zone).
-
#day? ⇒ Boolean
Is it day time ?.
-
#decrease_weather_duration ⇒ Boolean
Decrease the weather duration, set it to normal (none = 0) if the duration is less than 0.
-
#fog? ⇒ Boolean
Is it foggy ?.
-
#get_event_delete_state(event_id, map_id = @game_state.game_map.map_id) ⇒ Boolean
Get the delete state of an event.
-
#get_worldmap(zone = @zone) ⇒ Integer
Get the worldmap from the zone.
-
#get_zone(x, y, worldmap_id = @worldmap) ⇒ Studio::Zone?
Get the zone data in the worldmap.
-
#get_zone_pos(zone_id, worldmap_id = @worldmap) ⇒ Array(Integer, Integer)
Return the zone coordinate in the worldmap.
-
#get_zone_type(ice_prio = false) ⇒ Integer
Return the zone type.
-
#grass? ⇒ Boolean
Is the player standing in grass ?.
-
#hail? ⇒ Boolean
Does it hail ?.
-
#hardrain? ⇒ Boolean
Is it hardrainning?.
-
#hardsun? ⇒ Boolean
Is it hardsunny?.
-
#ice? ⇒ Boolean
Is the player on ice ?.
-
#initialize(game_state = PFM.game_state) ⇒ Environment
constructor
Create a new Environnement object.
-
#load_zone_information(data, index)
Load the zone information.
-
#morning? ⇒ Boolean
Is it morning time ?.
-
#mount? ⇒ Boolean
Is the player on a mount ?.
-
#night? ⇒ Boolean
Is it night time ?.
-
#normal? ⇒ Boolean
Is the weather normal.
-
#pond? ⇒ Boolean
Is the player on a pond/river ?.
-
#rain? ⇒ Boolean
Is it rainning?.
-
#remove_worldmap_custom_icon(filename, worldmap_id, x, y)
Remove all custom worldmap icons on the coords.
-
#reset_worldmap_position
Reset the modified worldmap position.
-
#reset_zone
Reset the zone informations to get the zone id with update_zone (Panel display).
-
#sand? ⇒ Boolean
Is the player on sand ?.
-
#sandstorm? ⇒ Boolean
Duuuuuuuuuuuuuuuuuuuuuuun Dun dun dun dun dun dun dun dun dun dun dun dundun dun dundundun dun dun dun dun dun dun dundun dundun.
-
#sea? ⇒ Boolean
Is the player on a sea/ocean ?.
-
#set_event_delete_state(event_id, map_id = @game_state.game_map.map_id, state = true)
Set the delete state of an event.
-
#set_worldmap_position(new_x, new_y, new_worldmap_id = nil)
Overwrite the zone worldmap position.
-
#snow? ⇒ Boolean
Is the player on snow or ice ?.
-
#snowing? ⇒ Boolean
Is it snowing?.
-
#strong_winds? ⇒ Boolean
Is it Strong Winds ? (Mega Rayquaza).
-
#sunny? ⇒ Boolean
Is it sunny?.
-
#sunset? ⇒ Boolean
Is it sunset time ?.
-
#tall_grass? ⇒ Boolean
Is the player standing in tall grass ?.
-
#under_water? ⇒ Boolean
Is the player underwater ?.
-
#update_zone ⇒ Integer, false
Update the zone informations, return the ID of the zone when the player enter in an other zone.
-
#very_tall_grass? ⇒ Boolean
Is the player standing in taller grass ?.
-
#visited_worldmap?(worldmap) ⇒ Boolean
Test if the given world map has been visited.
-
#visited_zone?(zone) ⇒ Boolean
Check if a zone has been visited.
-
#warp_zone ⇒ Integer
(also: #get_warp_zone)
Return the warp zone ID (where the player will teleport with skills).
-
#weather_duration ⇒ Numeric
(also: #get_weather_duration)
Return the current weather duration.
Methods included from GameData::SystemTags
Constructor Details
#initialize(game_state = PFM.game_state) ⇒ Environment
Create a new Environnement object
28 29 |
# File 'docs/4_Systems_202_Environment.rb', line 28 def initialize(game_state = PFM.game_state) end |
Instance Attribute Details
#game_state ⇒ PFM::GameState
Get the game state responsive of the whole game state
25 26 27 |
# File 'docs/4_Systems_202_Environment.rb', line 25 def game_state @game_state end |
#last_map_id ⇒ Integer (readonly)
Last visited map ID
16 17 18 |
# File 'docs/4_Systems_202_Environment.rb', line 16 def last_map_id @last_map_id end |
#master_zone ⇒ Integer (readonly)
Master zone are used inside Pokemon data
The master zone (zone that show the panel like city, unlike house of city)
13 14 15 |
# File 'docs/4_Systems_202_Environment.rb', line 13 def master_zone @master_zone end |
#modified_worldmap_position ⇒ Array? (readonly)
Return the modified worldmap position or nil
22 23 24 |
# File 'docs/4_Systems_202_Environment.rb', line 22 def modified_worldmap_position @modified_worldmap_position end |
#worldmap_custom_markers ⇒ Array (readonly)
Custom markers on worldmap
19 20 21 |
# File 'docs/4_Systems_202_Environment.rb', line 19 def worldmap_custom_markers @worldmap_custom_markers end |
Instance Method Details
#add_worldmap_custom_icon(filename, worldmap_id, x, y, ox_mode = :center, oy_mode = :center)
Add the custom marker to the worldmap
188 189 |
# File 'docs/4_Systems_202_Environment.rb', line 188 def add_worldmap_custom_icon(filename, worldmap_id, x, y, ox_mode = :center, oy_mode = :center) end |
#apply_weather(id, duration = nil)
Apply a new weather to the current environment
211 212 |
# File 'docs/4_Systems_202_Environment.rb', line 211 def apply_weather(id, duration = nil) end |
#building? ⇒ Boolean
Is the player inside a building (and not on a systemtag)
32 33 |
# File 'docs/4_Systems_202_Environment.rb', line 32 def building? end |
#can_fish? ⇒ Boolean
Can the player fish ?
167 168 |
# File 'docs/4_Systems_202_Environment.rb', line 167 def can_fish? end |
#cave? ⇒ Boolean
Is the player in a cave ?
109 110 |
# File 'docs/4_Systems_202_Environment.rb', line 109 def cave? end |
#convert_zone_type(system_tag) ⇒ Integer
Convert a system_tag to a zone_type
147 148 |
# File 'docs/4_Systems_202_Environment.rb', line 147 def convert_zone_type(system_tag) end |
#current_weather ⇒ Integer
Return the current weather id according to the game state (in battle or not)
224 225 |
# File 'docs/4_Systems_202_Environment.rb', line 224 def current_weather end |
#current_weather_db_symbol ⇒ Symbol
Return the db_symbol of the current weather
228 229 |
# File 'docs/4_Systems_202_Environment.rb', line 228 def current_weather_db_symbol end |
#current_zone ⇒ Integer Also known as: get_current_zone
Return the current zone in which the player is
50 51 |
# File 'docs/4_Systems_202_Environment.rb', line 50 def current_zone end |
#current_zone_data ⇒ Studio::Zone Also known as: get_current_zone_data
Return the zone data in which the player is
55 56 |
# File 'docs/4_Systems_202_Environment.rb', line 55 def current_zone_data end |
#current_zone_name ⇒ String
Return the zone name in which the player is (master zone)
60 61 |
# File 'docs/4_Systems_202_Environment.rb', line 60 def current_zone_name end |
#day? ⇒ Boolean
Is it day time ?
155 156 |
# File 'docs/4_Systems_202_Environment.rb', line 155 def day? end |
#decrease_weather_duration ⇒ Boolean
Decrease the weather duration, set it to normal (none = 0) if the duration is less than 0
220 221 |
# File 'docs/4_Systems_202_Environment.rb', line 220 def decrease_weather_duration end |
#fog? ⇒ Boolean
Is it foggy ?
265 266 |
# File 'docs/4_Systems_202_Environment.rb', line 265 def fog? end |
#get_event_delete_state(event_id, map_id = @game_state.game_map.map_id) ⇒ Boolean
Get the delete state of an event
179 180 |
# File 'docs/4_Systems_202_Environment.rb', line 179 def get_event_delete_state(event_id, map_id = @game_state.game_map.map_id) end |
#get_worldmap(zone = @zone) ⇒ Integer
Get the worldmap from the zone
88 89 |
# File 'docs/4_Systems_202_Environment.rb', line 88 def get_worldmap(zone = @zone) end |
#get_zone(x, y, worldmap_id = @worldmap) ⇒ Studio::Zone?
Get the zone data in the worldmap
72 73 |
# File 'docs/4_Systems_202_Environment.rb', line 72 def get_zone(x, y, worldmap_id = @worldmap) end |
#get_zone_pos(zone_id, worldmap_id = @worldmap) ⇒ Array(Integer, Integer)
Return the zone coordinate in the worldmap
78 79 |
# File 'docs/4_Systems_202_Environment.rb', line 78 def get_zone_pos(zone_id, worldmap_id = @worldmap) end |
#get_zone_type(ice_prio = false) ⇒ Integer
Return the zone type
142 143 |
# File 'docs/4_Systems_202_Environment.rb', line 142 def get_zone_type(ice_prio = false) end |
#grass? ⇒ Boolean
Is the player standing in grass ?
97 98 |
# File 'docs/4_Systems_202_Environment.rb', line 97 def grass? end |
#hail? ⇒ Boolean
Does it hail ?
257 258 |
# File 'docs/4_Systems_202_Environment.rb', line 257 def hail? end |
#hardrain? ⇒ Boolean
Is it hardrainning?
236 237 |
# File 'docs/4_Systems_202_Environment.rb', line 236 def hardrain? end |
#hardsun? ⇒ Boolean
Is it hardsunny?
244 245 |
# File 'docs/4_Systems_202_Environment.rb', line 244 def hardsun? end |
#ice? ⇒ Boolean
Is the player on ice ?
133 134 |
# File 'docs/4_Systems_202_Environment.rb', line 133 def ice? end |
#load_zone_information(data, index)
Load the zone information
43 44 |
# File 'docs/4_Systems_202_Environment.rb', line 43 def load_zone_information(data, index) end |
#morning? ⇒ Boolean
Is it morning time ?
159 160 |
# File 'docs/4_Systems_202_Environment.rb', line 159 def morning? end |
#mount? ⇒ Boolean
Is the player on a mount ?
113 114 |
# File 'docs/4_Systems_202_Environment.rb', line 113 def mount? end |
#night? ⇒ Boolean
Is it night time ?
151 152 |
# File 'docs/4_Systems_202_Environment.rb', line 151 def night? end |
#normal? ⇒ Boolean
Is the weather normal
269 270 |
# File 'docs/4_Systems_202_Environment.rb', line 269 def normal? end |
#pond? ⇒ Boolean
Is the player on a pond/river ?
121 122 |
# File 'docs/4_Systems_202_Environment.rb', line 121 def pond? end |
#rain? ⇒ Boolean
Is it rainning?
232 233 |
# File 'docs/4_Systems_202_Environment.rb', line 232 def rain? end |
#remove_worldmap_custom_icon(filename, worldmap_id, x, y)
Remove all custom worldmap icons on the coords
195 196 |
# File 'docs/4_Systems_202_Environment.rb', line 195 def remove_worldmap_custom_icon(filename, worldmap_id, x, y) end |
#reset_worldmap_position
Reset the modified worldmap position
204 205 |
# File 'docs/4_Systems_202_Environment.rb', line 204 def reset_worldmap_position end |
#reset_zone
Reset the zone informations to get the zone id with update_zone (Panel display)
46 47 |
# File 'docs/4_Systems_202_Environment.rb', line 46 def reset_zone end |
#sand? ⇒ Boolean
Is the player on sand ?
117 118 |
# File 'docs/4_Systems_202_Environment.rb', line 117 def sand? end |
#sandstorm? ⇒ Boolean
Duuuuuuuuuuuuuuuuuuuuuuun Dun dun dun dun dun dun dun dun dun dun dun dundun dun dundundun dun dun dun dun dun dun dundun dundun
253 254 |
# File 'docs/4_Systems_202_Environment.rb', line 253 def sandstorm? end |
#sea? ⇒ Boolean
Is the player on a sea/ocean ?
125 126 |
# File 'docs/4_Systems_202_Environment.rb', line 125 def sea? end |
#set_event_delete_state(event_id, map_id = @game_state.game_map.map_id, state = true)
Set the delete state of an event
173 174 |
# File 'docs/4_Systems_202_Environment.rb', line 173 def set_event_delete_state(event_id, map_id = @game_state.game_map.map_id, state = true) end |
#set_worldmap_position(new_x, new_y, new_worldmap_id = nil)
Overwrite the zone worldmap position
201 202 |
# File 'docs/4_Systems_202_Environment.rb', line 201 def set_worldmap_position(new_x, new_y, new_worldmap_id = nil) end |
#snow? ⇒ Boolean
Is the player on snow or ice ?
137 138 |
# File 'docs/4_Systems_202_Environment.rb', line 137 def snow? end |
#snowing? ⇒ Boolean
Is it snowing?
261 262 |
# File 'docs/4_Systems_202_Environment.rb', line 261 def snowing? end |
#strong_winds? ⇒ Boolean
Is it Strong Winds ? (Mega Rayquaza)
248 249 |
# File 'docs/4_Systems_202_Environment.rb', line 248 def strong_winds? end |
#sunny? ⇒ Boolean
Is it sunny?
240 241 |
# File 'docs/4_Systems_202_Environment.rb', line 240 def sunny? end |
#sunset? ⇒ Boolean
Is it sunset time ?
163 164 |
# File 'docs/4_Systems_202_Environment.rb', line 163 def sunset? end |
#tall_grass? ⇒ Boolean
Is the player standing in tall grass ?
101 102 |
# File 'docs/4_Systems_202_Environment.rb', line 101 def tall_grass? end |
#under_water? ⇒ Boolean
Is the player underwater ?
129 130 |
# File 'docs/4_Systems_202_Environment.rb', line 129 def under_water? end |
#update_zone ⇒ Integer, false
Update the zone informations, return the ID of the zone when the player enter in an other zone
Add the zone to the visited zone Array if the zone has not been visited yet
38 39 |
# File 'docs/4_Systems_202_Environment.rb', line 38 def update_zone end |
#very_tall_grass? ⇒ Boolean
Is the player standing in taller grass ?
105 106 |
# File 'docs/4_Systems_202_Environment.rb', line 105 def very_tall_grass? end |
#visited_worldmap?(worldmap) ⇒ Boolean
Test if the given world map has been visited
93 94 |
# File 'docs/4_Systems_202_Environment.rb', line 93 def visited_worldmap?(worldmap) end |
#visited_zone?(zone) ⇒ Boolean
Check if a zone has been visited
83 84 |
# File 'docs/4_Systems_202_Environment.rb', line 83 def visited_zone?(zone) end |
#warp_zone ⇒ Integer Also known as: get_warp_zone
Return the warp zone ID (where the player will teleport with skills)
64 65 |
# File 'docs/4_Systems_202_Environment.rb', line 64 def warp_zone end |
#weather_duration ⇒ Numeric Also known as: get_weather_duration
Return the current weather duration
215 216 |
# File 'docs/4_Systems_202_Environment.rb', line 215 def weather_duration end |