166 {
167 int currentHealthLevel;
168 int suffixIndex;
169 string base;
170
171 if (healthLevel == -1)
172 currentHealthLevel = GetHealthLevel();
173 else
174 currentHealthLevel = healthLevel;
175
176 if (glowing)
178 else
180
181 suffixIndex = base.
IndexOf(
".rvmat");
182 if (suffixIndex == -1)
183 {
184 Error(
"Error - no valid rvmat found for chemlight");
185 return "";
186 }
188
189 if (currentHealthLevel == GameConstants.STATE_BADLY_DAMAGED || currentHealthLevel == GameConstants.STATE_DAMAGED)
190 {
191 base = base + "_damage";
192 }
193 else if (currentHealthLevel == GameConstants.STATE_RUINED)
194 {
195 base = base + "_destruct";
196 }
197
198 return base + ".rvmat";
199 }
void Error(string err)
Messagebox with error message.
proto string Substring(int start, int len)
Substring of 'str' from 'start' position 'len' number of characters.
proto native int IndexOf(string sample)
Finds 'sample' in 'str'. Returns -1 when not found.