[MIRROR] Fix skill related runtimes in mindless mobs. (#965)

* Fix skill related runtimes in mindless mobs. (#53691)

Fixes related to mindless mobs using skills

* Fix skill related runtimes in mindless mobs.

Co-authored-by: Timberpoes <silent_insomnia_pp@hotmail.co.uk>
This commit is contained in:
SkyratBot
2020-09-24 20:33:19 +02:00
committed by GitHub
parent bb7f23fa99
commit 18f4fb5029
10 changed files with 103 additions and 67 deletions
+12 -11
View File
@@ -22,17 +22,18 @@
/datum/skill_panel/ui_data(mob/user) //Sends info about the skills to UI
. = list()
for (var/type in GLOB.skill_types)
var/datum/skill/S = GetSkillRef(type)
var/lvl_num = targetmind.get_skill_level(type)
var/lvl_name = uppertext(targetmind.get_skill_level_name(type))
var/exp = targetmind.get_skill_exp(type)
var/xp_prog_to_level = targetmind.exp_needed_to_level_up(type)
var/xp_req_to_level = 0
if (xp_prog_to_level)//is it even possible to level up?
xp_req_to_level = SKILL_EXP_LIST[lvl_num+1] - SKILL_EXP_LIST[lvl_num]
var/exp_percent = exp / SKILL_EXP_LIST[SKILL_LEVEL_LEGENDARY]
.["skills"] += list(list("playername" = targetmind.current, "path" = type, "name" = S.name, "desc" = S.desc, "lvlnum" = lvl_num, "lvl" = lvl_name, "exp" = exp, "exp_prog" = xp_req_to_level - xp_prog_to_level, "exp_req" = xp_req_to_level, "exp_percent" = exp_percent, "max_exp" = SKILL_EXP_LIST[length(SKILL_EXP_LIST)]))
if(user?.mind)
for (var/type in GLOB.skill_types)
var/datum/skill/S = GetSkillRef(type)
var/lvl_num = targetmind.get_skill_level(type)
var/lvl_name = uppertext(targetmind.get_skill_level_name(type))
var/exp = targetmind.get_skill_exp(type)
var/xp_prog_to_level = targetmind.exp_needed_to_level_up(type)
var/xp_req_to_level = 0
if (xp_prog_to_level)//is it even possible to level up?
xp_req_to_level = SKILL_EXP_LIST[lvl_num+1] - SKILL_EXP_LIST[lvl_num]
var/exp_percent = exp / SKILL_EXP_LIST[SKILL_LEVEL_LEGENDARY]
.["skills"] += list(list("playername" = targetmind.current, "path" = type, "name" = S.name, "desc" = S.desc, "lvlnum" = lvl_num, "lvl" = lvl_name, "exp" = exp, "exp_prog" = xp_req_to_level - xp_prog_to_level, "exp_req" = xp_req_to_level, "exp_percent" = exp_percent, "max_exp" = SKILL_EXP_LIST[length(SKILL_EXP_LIST)]))
/datum/skill_panel/ui_act(action, params)
. = ..()