|
124 | 124 | icon_state = "skill_menu" |
125 | 125 | screen_loc = ui_skill_menu |
126 | 126 | var/list/allocated_skills = list( |
127 | | - SKILL_PHYSIOLOGY = 0, |
128 | | - SKILL_MECHANICAL = 0, |
129 | | - SKILL_TECHNICAL = 0, |
130 | | - SKILL_SCIENCE = 0, |
131 | | - SKILL_FITNESS = 0, |
| 127 | + SKILL_PHYSIOLOGY = EXP_NONE, |
| 128 | + SKILL_MECHANICAL = EXP_NONE, |
| 129 | + SKILL_TECHNICAL = EXP_NONE, |
| 130 | + SKILL_SCIENCE = EXP_NONE, |
| 131 | + SKILL_FITNESS = EXP_NONE, |
132 | 132 | ) |
133 | | - var/allocated_points = 0 |
| 133 | + var/allocated_points = EXP_NONE |
134 | 134 |
|
135 | 135 | /atom/movable/screen/skill_menu/Click() |
136 | 136 | ui_interact(usr) |
|
164 | 164 | CRASH("User ([user]) without a mind attempted to allocate skill points!") |
165 | 165 | switch(action) |
166 | 166 | if("confirm") |
| 167 | + if(allocated_points > user.mind.skill_points) |
| 168 | + stack_trace("[user] attempted to allocate [allocated_points] skill points when they only had [user.mind.skill_points] available!") |
| 169 | + message_admins("[key_name_admin(user)] may have attempted an exploit to gain more skill points than intended!") |
| 170 | + qdel(allocated_skills) |
| 171 | + allocated_skills = list( |
| 172 | + SKILL_PHYSIOLOGY = EXP_NONE, |
| 173 | + SKILL_MECHANICAL = EXP_NONE, |
| 174 | + SKILL_TECHNICAL = EXP_NONE, |
| 175 | + SKILL_SCIENCE = EXP_NONE, |
| 176 | + SKILL_FITNESS = EXP_NONE, |
| 177 | + ) |
| 178 | + allocated_points = EXP_NONE |
| 179 | + return TRUE |
167 | 180 | for(var/skill in user.mind.skills) |
168 | 181 | user.adjust_skill(skill, allocated_skills[skill], max_skill = EXP_GENIUS) |
169 | | - allocated_skills[skill] = 0 |
| 182 | + allocated_skills[skill] = EXP_NONE |
170 | 183 | user.mind.skill_points -= allocated_points |
171 | | - allocated_points = 0 |
| 184 | + allocated_points = EXP_NONE |
172 | 185 | if(!user.mind.skill_points) |
173 | 186 | user.clear_alert("skill points") |
174 | 187 | return TRUE |
175 | 188 | if("allocate") |
| 189 | + if(allocated_points + params["amount"] > user.mind.skill_points) |
| 190 | + return TRUE |
176 | 191 | allocated_skills[params["skill"]] += params["amount"] |
177 | 192 | allocated_points += params["amount"] |
178 | 193 | return TRUE |
|
0 commit comments