Planeshift
pssectorinfo.h
Go to the documentation of this file.
1 /*
2  * pssectorinfo.h
3  *
4  * Copyright (C) 2001 Atomic Blue (info@planeshift.it, http://www.atomicblue.org)
5  *
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation (version 2 of the License)
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17  *
18  */
19 
20 
21 
22 #ifndef __PSSECTORINFO_H__
23 #define __PSSECTORINFO_H__
24 //=============================================================================
25 // Crystal Space Includes
26 //=============================================================================
27 #include <csutil/csstring.h>
28 #include <csgeom/vector3.h>
29 #include "util/scriptvar.h"
30 
31 //=============================================================================
32 // Project Includes
33 //=============================================================================
34 
35 #include "net/messages.h"
36 
37 //=============================================================================
38 // Local Includes
39 //=============================================================================
40 
41 
47 {
48 public:
49  psSectorInfo();
50  ~psSectorInfo();
51 
53  double GetProperty(MathEnvironment* env, const char* ptr);
55  double CalcFunction(MathEnvironment* env, const char* functionName, const double* params);
56  const char* ToString()
57  {
58  return name.GetDataSafe();
59  }
60 
62  {
63  return is_colliding;
64  }
66  {
67  return is_non_transient;
68  }
76  {
77  return is_teleporting;
78  }
84  {
85  return has_penalty;
86  }
87 
93  {
94  return deathRestoreHP;
95  }
96 
102  {
103  return deathRestoreMana;
104  }
105 
110  {
111  return teleportingSector;
112  }
116  csVector3 GetTeleportingCord()
117  {
118  return teleportingCords;
119  }
124  {
125  return teleportingRot;
126  }
127 
131  csString GetDeathSector()
132  {
133  return deathSector;
134  }
138  csVector3 GetDeathCord()
139  {
140  return deathCords;
141  }
145  float GetDeathRot()
146  {
147  return deathRot;
148  }
149 
150  unsigned int uid;
151  csString name;
152 
153 
156  {
157  bool enabled;
158  unsigned int min_gap;
159  unsigned int max_gap;
160  unsigned int min_duration;
161  unsigned int max_duration;
162  unsigned int min_density;
163  unsigned int max_density;
164  unsigned int min_fade_in;
165  unsigned int max_fade_in;
166  unsigned int min_fade_out;
167  unsigned int max_fade_out;
168  };
169 
171  csHash<weatherTypeData, unsigned int> weatherData;
172 
177  void SetWeatherEnabled(unsigned int id, bool newStatus);
178 
183  bool GetWeatherEnabled(unsigned int id);
184 
189  unsigned int GetRandomWeatherGap(unsigned int id);
190 
195  unsigned int GetRandomWeatherDuration(unsigned int id);
196 
201  unsigned int GetRandomWeatherDensity(unsigned int id);
202 
207  unsigned int GetRandomWeatherFadeIn(unsigned int id);
208 
213  unsigned int GetRandomWeatherFadeOut(unsigned int id);
214 
219  void AddWeatherTypeData(weatherTypeData newWeatherData, unsigned int id);
220 
221  unsigned int current_rain_drops;
222 
227 
232 
240  csVector3 teleportingCords;
244  csString deathSector;
246  csVector3 deathCords;
248  float deathRot;
249 
250 
251 
252  // Fog
255  unsigned int fogFade;
256  int r,g,b;
257 
258  float say_range;
259 
260  csString god_name;
261 };
262 
263 
264 
265 #endif
266 
267 
double CalcFunction(MathEnvironment *env, const char *functionName, const double *params)
This is used by the math scripting engine to get calculated values.
Structure used to store informations for various weather types in this sector.
Definition: pssectorinfo.h:155
unsigned int GetRandomWeatherDensity(unsigned int id)
Gets a random value between the max and min density for this weather type.
unsigned int GetRandomWeatherDuration(unsigned int id)
Gets a random value between the max and min Duration for this weather type.
bool GetIsTeleporting()
Checks if this is set as a teleporting sector.
Definition: pssectorinfo.h:75
unsigned int max_duration
The maximum duration of the weather events.
Definition: pssectorinfo.h:161
csVector3 GetTeleportingCord()
Gets the sector cordinates we will teleport to when entering this sector.
Definition: pssectorinfo.h:116
csString name
Definition: pssectorinfo.h:151
unsigned int GetRandomWeatherFadeOut(unsigned int id)
Gets a random value between the max and min Fade Out for this weather type.
csString teleportingSector
The destination sector when this sector is a teleporting sector. Note if empty it will be spawn...
Definition: pssectorinfo.h:238
A specific MathEnvironment to be used in a MathScript.
Definition: mathscript.h:188
bool GetDeathRestoreHP()
Checks if a teleporting sector will trigger the death penalty when used.
Definition: pssectorinfo.h:92
bool GetIsNonTransient()
Definition: pssectorinfo.h:65
unsigned int min_gap
The minimum gap between two of these weather events.
Definition: pssectorinfo.h:158
unsigned int GetRandomWeatherFadeIn(unsigned int id)
Gets a random value between the max and min Fade In for this weather type.
unsigned int fog_density_old
Definition: pssectorinfo.h:253
unsigned int min_density
The minimum density of the weather event. (drops, flakes...).
Definition: pssectorinfo.h:162
csString deathSector
The sector where to teleport on death from this sector. Note if empty it will be the default one...
Definition: pssectorinfo.h:244
csString GetDeathSector()
Gets the sector name we will teleport to when dieing in this sector.
Definition: pssectorinfo.h:131
bool has_penalty
This sector will apply the death penalty if it&#39;s a teleporting sector.
Definition: pssectorinfo.h:236
void SetWeatherEnabled(unsigned int id, bool newStatus)
Sets the enabled status of a weather event type for this sector.
unsigned int max_fade_out
The maximum time to fade out.
Definition: pssectorinfo.h:167
float GetTeleportingRot()
Gets the rotation we will teleport to when entering this sector.
Definition: pssectorinfo.h:123
unsigned int GetRandomWeatherGap(unsigned int id)
Gets a random value between the max and min Gap for this weather type.
bool deathRestoreHP
Sets if this sector will restore hp when the player dies in it.
Definition: pssectorinfo.h:231
bool enabled
Will run automatic weather when true.
Definition: pssectorinfo.h:157
csVector3 GetDeathCord()
Gets the sector cordinates we will teleport to when dieing in this sector.
Definition: pssectorinfo.h:138
unsigned int uid
Definition: pssectorinfo.h:150
unsigned int min_fade_in
The minimum time to fade in.
Definition: pssectorinfo.h:164
float GetDeathRot()
Gets the rotation we will teleport to when dieing in this sector.
Definition: pssectorinfo.h:145
bool is_non_transient
Definition: pssectorinfo.h:226
float deathRot
The destination rotation where to teleport on death from this sector.
Definition: pssectorinfo.h:248
csString GetTeleportingSector()
Gets the sector name we will teleport to when entering this sector.
Definition: pssectorinfo.h:109
bool is_teleporting
This sector will immediately teleport the player somewhere else when entered if true.
Definition: pssectorinfo.h:234
bool GetIsColliding()
Definition: pssectorinfo.h:61
bool GetHasPenalty()
Checks if a teleporting sector will trigger the death penalty when used.
Definition: pssectorinfo.h:83
csVector3 teleportingCords
The destination cordinates when this sector is a teleporting sector.
Definition: pssectorinfo.h:240
bool GetDeathRestoreMana()
Checks if a teleporting sector will trigger the death penalty when used.
Definition: pssectorinfo.h:101
const char * ToString()
Definition: pssectorinfo.h:56
unsigned int min_duration
The minimum duration of the weather events.
Definition: pssectorinfo.h:160
float teleportingRot
The destination rotation when this sector is a teleporting sector.
Definition: pssectorinfo.h:242
unsigned int min_fade_out
The minimum time to fade out.
Definition: pssectorinfo.h:166
unsigned int max_density
The maximum density of the weather event. (drops, flakes...).
Definition: pssectorinfo.h:163
unsigned int current_rain_drops
Drops.
Definition: pssectorinfo.h:221
csString god_name
Definition: pssectorinfo.h:260
unsigned int fogFade
Definition: pssectorinfo.h:255
unsigned int fog_density
Definition: pssectorinfo.h:253
unsigned int max_fade_in
The maximum time to fade in.
Definition: pssectorinfo.h:165
bool GetWeatherEnabled(unsigned int id)
Gets the enabled status of a weather event type for this sector.
double GetProperty(MathEnvironment *env, const char *ptr)
This is used by the math scripting engine to get various values.
Contains information about sectors from the server perspective.
Definition: pssectorinfo.h:46
csVector3 deathCords
the destination cordinates where to teleport on death from this sector
Definition: pssectorinfo.h:246
csHash< weatherTypeData, unsigned int > weatherData
An hash containing all the various possible weather data.
Definition: pssectorinfo.h:171
bool deathRestoreMana
Sets if this sector will restore mana when the player dies in it.
Definition: pssectorinfo.h:229
void AddWeatherTypeData(weatherTypeData newWeatherData, unsigned int id)
Adds informations about a weather type defined by id.
unsigned int max_gap
The maximum gap between two of these weather events.
Definition: pssectorinfo.h:159