mirror of
https://github.com/yogstation13/Yogstation.git
synced 2025-02-26 09:04:50 +00:00
Adds Skills (#22683)
* skill issue to do: -chemistry -virology -balance stuff -??? i forgor * this shouldn't be here * more stuff * bit of rebalancing * i hate javascript!!! * more balance * stuff * things * fixed some stuff * hacking * ghost roles * fix * crafting skill requirements * real menu button * cyborg * fixed IPC repair * new skill icons * fix + rebalancing * skill icons 2 * exploit fixed * chem dispenser fix * fix again * clockwork style * genetics * science fix * progress bar indicators * minor refactor + rebalance * dna console fix * exploit fix * progress bar * more like evilscript * remove exploit * fix * why is round ID a string??? * another day, another exploit fixed
This commit is contained in:
@@ -322,6 +322,16 @@ or shoot a gun to move around via Newton's 3rd Law of Motion."
|
||||
var/mob/living/carbon/C = mob_viewer
|
||||
C.take(giver, receiving)
|
||||
|
||||
//SKILLS
|
||||
|
||||
/atom/movable/screen/alert/skill_up
|
||||
name = "Allocate Skill Points"
|
||||
desc = "You have unspent skill points! Click here to allocate them."
|
||||
|
||||
/atom/movable/screen/alert/skill_up/Click(location, control, params)
|
||||
. = ..()
|
||||
mob_viewer.hud_used?.skill_menu?.ui_interact(mob_viewer)
|
||||
|
||||
//ALIENS
|
||||
|
||||
/atom/movable/screen/alert/alien_tox
|
||||
|
||||
@@ -40,6 +40,7 @@ GLOBAL_LIST_INIT(available_ui_styles, list(
|
||||
var/atom/movable/screen/rest_icon
|
||||
var/atom/movable/screen/throw_icon
|
||||
var/atom/movable/screen/module_store_icon
|
||||
var/atom/movable/screen/skill_menu/skill_menu
|
||||
|
||||
var/list/static_inventory = list() //the screen objects which are static
|
||||
var/list/toggleable_inventory = list() //the screen objects which can be hidden
|
||||
|
||||
@@ -101,6 +101,12 @@
|
||||
using.screen_loc = UI_BOXAREA
|
||||
static_inventory += using
|
||||
|
||||
skill_menu = new /atom/movable/screen/skill_menu(src)
|
||||
skill_menu.icon = ui_style
|
||||
if(!widescreen_layout)
|
||||
skill_menu.screen_loc = UI_BOXAREA
|
||||
static_inventory += skill_menu
|
||||
|
||||
action_intent = new /atom/movable/screen/combattoggle/flashy(src)
|
||||
action_intent.icon = ui_style
|
||||
action_intent.screen_loc = ui_combat_toggle
|
||||
|
||||
@@ -118,6 +118,108 @@
|
||||
var/datum/language_holder/H = M.get_language_holder()
|
||||
H.open_language_menu(usr)
|
||||
|
||||
/atom/movable/screen/skill_menu
|
||||
name = "skills menu"
|
||||
icon = 'icons/mob/screen_midnight.dmi'
|
||||
icon_state = "skill_menu"
|
||||
screen_loc = ui_skill_menu
|
||||
var/list/allocated_skills = list(
|
||||
SKILL_PHYSIOLOGY = EXP_NONE,
|
||||
SKILL_MECHANICAL = EXP_NONE,
|
||||
SKILL_TECHNICAL = EXP_NONE,
|
||||
SKILL_SCIENCE = EXP_NONE,
|
||||
SKILL_FITNESS = EXP_NONE,
|
||||
)
|
||||
var/allocated_points = EXP_NONE
|
||||
|
||||
/atom/movable/screen/skill_menu/Click()
|
||||
ui_interact(usr)
|
||||
|
||||
/atom/movable/screen/skill_menu/ui_interact(mob/user, datum/tgui/ui)
|
||||
if(!user.mind)
|
||||
CRASH("[user.type] ([user]) tried to use the skill menu without a mind!")
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if (!ui)
|
||||
ui = new(user, src, "SkillMenu", "Allocate Skill Points")
|
||||
ui.open()
|
||||
|
||||
/atom/movable/screen/skill_menu/ui_data(mob/user)
|
||||
var/list/data = list()
|
||||
var/list/skill_data = list()
|
||||
for(var/skill in user.mind.skills)
|
||||
skill_data.Add(list(list(
|
||||
"base" = user.get_skill(skill),
|
||||
"allocated" = allocated_skills[skill],
|
||||
"exp_progress" = user.mind?.exp_progress[skill],
|
||||
)))
|
||||
data["skills"] = skill_data
|
||||
data["skill_points"] = user.mind.skill_points
|
||||
data["allocated_points"] = allocated_points
|
||||
data["exceptional_skill"] = HAS_MIND_TRAIT(user, TRAIT_EXCEPTIONAL_SKILL)
|
||||
return data
|
||||
|
||||
/atom/movable/screen/skill_menu/ui_static_data(mob/user)
|
||||
var/static/list/data = list(
|
||||
"exp_per_level" = EXPERIENCE_PER_LEVEL
|
||||
)
|
||||
return data
|
||||
|
||||
/atom/movable/screen/skill_menu/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
var/mob/user = usr
|
||||
if(!user.mind)
|
||||
CRASH("User ([user]) without a mind attempted to allocate skill points!")
|
||||
switch(action)
|
||||
if("confirm")
|
||||
if(allocated_points > user.mind.skill_points)
|
||||
stack_trace("[user] attempted to allocate [allocated_points] skill points when they only had [user.mind.skill_points] available!")
|
||||
message_admins("[key_name_admin(user)] may have attempted an exploit to gain more skill points than intended!")
|
||||
qdel(allocated_skills)
|
||||
allocated_skills = list(
|
||||
SKILL_PHYSIOLOGY = EXP_NONE,
|
||||
SKILL_MECHANICAL = EXP_NONE,
|
||||
SKILL_TECHNICAL = EXP_NONE,
|
||||
SKILL_SCIENCE = EXP_NONE,
|
||||
SKILL_FITNESS = EXP_NONE,
|
||||
)
|
||||
allocated_points = EXP_NONE
|
||||
return TRUE
|
||||
for(var/skill in user.mind.skills)
|
||||
user.adjust_skill(skill, allocated_skills[skill], max_skill = EXP_GENIUS)
|
||||
allocated_skills[skill] = EXP_NONE
|
||||
user.mind.skill_points -= allocated_points
|
||||
allocated_points = EXP_NONE
|
||||
if(!user.mind.skill_points)
|
||||
user.clear_alert("skill points")
|
||||
return TRUE
|
||||
if("allocate")
|
||||
if(allocated_points + params["amount"] > user.mind.skill_points)
|
||||
return TRUE
|
||||
if(allocated_points + params["amount"] < 0)
|
||||
return TRUE
|
||||
if(allocated_skills[params["skill"]] + params["amount"] + user.get_skill(params["skill"]) > (4 + HAS_MIND_TRAIT(user, TRAIT_EXCEPTIONAL_SKILL)))
|
||||
return TRUE
|
||||
if(allocated_skills[params["skill"]] + params["amount"] < 0)
|
||||
return TRUE
|
||||
allocated_skills[params["skill"]] += params["amount"]
|
||||
allocated_points += params["amount"]
|
||||
return TRUE
|
||||
|
||||
/atom/movable/screen/skill_menu/ui_status(mob/user)
|
||||
if(!user.mind)
|
||||
return UI_CLOSE
|
||||
return UI_INTERACTIVE
|
||||
|
||||
/atom/movable/screen/skill_menu/ui_state(mob/user)
|
||||
return GLOB.always_state
|
||||
|
||||
/atom/movable/screen/skill_menu/ui_assets(mob/user)
|
||||
return list(
|
||||
get_asset_datum(/datum/asset/spritesheet/crafting),
|
||||
)
|
||||
|
||||
/atom/movable/screen/ghost/pai
|
||||
name = "pAI Candidate"
|
||||
icon = 'icons/mob/screen_midnight.dmi'
|
||||
|
||||
@@ -160,32 +160,32 @@
|
||||
* Called from [/mob/living/proc/attackby]
|
||||
*
|
||||
* Arguments:
|
||||
* * mob/living/M - The mob being hit by this item
|
||||
* * mob/living/target - The mob being hit by this item
|
||||
* * mob/living/user - The mob hitting with this item
|
||||
* * params - Click params of this attack
|
||||
*/
|
||||
/obj/item/proc/attack(mob/living/M, mob/living/user, params)
|
||||
var/signal_return = SEND_SIGNAL(src, COMSIG_ITEM_ATTACK, M, user, params)
|
||||
/obj/item/proc/attack(mob/living/target, mob/living/user, params)
|
||||
var/signal_return = SEND_SIGNAL(src, COMSIG_ITEM_ATTACK, target, user, params)
|
||||
if(signal_return & COMPONENT_CANCEL_ATTACK_CHAIN)
|
||||
return TRUE
|
||||
if(signal_return & COMPONENT_SKIP_ATTACK)
|
||||
return
|
||||
|
||||
SEND_SIGNAL(user, COMSIG_MOB_ITEM_ATTACK, M, user, params)
|
||||
SEND_SIGNAL(user, COMSIG_MOB_ITEM_ATTACK, target, user, params)
|
||||
if(item_flags & NOBLUDGEON)
|
||||
return
|
||||
|
||||
if(tool_behaviour && !user.combat_mode) // checks for combat mode with surgery tool
|
||||
var/list/modifiers = params2list(params)
|
||||
if(attempt_initiate_surgery(src, M, user, modifiers))
|
||||
if(attempt_initiate_surgery(src, target, user, modifiers))
|
||||
return TRUE
|
||||
if(iscarbon(M))
|
||||
var/mob/living/carbon/C = M
|
||||
if(iscarbon(target))
|
||||
var/mob/living/carbon/C = target
|
||||
for(var/i in C.all_wounds)
|
||||
var/datum/wound/W = i
|
||||
if(W.try_treating(src, user))
|
||||
return TRUE
|
||||
to_chat(user, span_warning("You can't perform any surgeries on [M]'s [parse_zone(user.zone_selected)]!")) //yells at you
|
||||
to_chat(user, span_warning("You can't perform any surgeries on [target]'s [parse_zone(user.zone_selected)]!")) //yells at you
|
||||
return TRUE
|
||||
|
||||
if(force && !synth_check(user, SYNTH_ORGANIC_HARM))
|
||||
@@ -199,16 +199,17 @@
|
||||
else if(hitsound)
|
||||
playsound(loc, hitsound, get_clamped_volume(), 1, -1)
|
||||
|
||||
M.lastattacker = user.real_name
|
||||
M.lastattackerckey = user.ckey
|
||||
target.lastattacker = user.real_name
|
||||
target.lastattackerckey = user.ckey
|
||||
|
||||
if(force)
|
||||
M.last_damage = name
|
||||
target.last_damage = name
|
||||
|
||||
user.do_attack_animation(M)
|
||||
M.attacked_by(src, user)
|
||||
user.do_attack_animation(target)
|
||||
user.add_exp(SKILL_FITNESS, target.stat == CONSCIOUS ? force : force / 5) // attacking things that can't move isn't very good experience
|
||||
target.attacked_by(src, user)
|
||||
|
||||
log_combat(user, M, "attacked", src.name, "(COMBAT MODE: [user.combat_mode ? "ON" : "OFF"]) (DAMTYPE: [uppertext(damtype)])")
|
||||
log_combat(user, target, "attacked", src.name, "(COMBAT MODE: [user.combat_mode ? "ON" : "OFF"]) (DAMTYPE: [uppertext(damtype)])")
|
||||
add_fingerprint(user)
|
||||
var/force_multiplier = 1
|
||||
if(ishuman(user))
|
||||
@@ -233,6 +234,7 @@
|
||||
user.changeNext_move(CLICK_CD_MELEE * weapon_stats[SWING_SPEED] * (range_cooldown_mod ? (dist > 0 ? min(dist, weapon_stats[REACH]) * range_cooldown_mod : range_cooldown_mod) : 1)) //range increases attack cooldown by swing speed
|
||||
user.do_attack_animation(attacked_atom)
|
||||
attacked_atom.attacked_by(src, user)
|
||||
user.add_exp(SKILL_FITNESS, force / 5)
|
||||
user.weapon_slow(src)
|
||||
var/force_multiplier = 1
|
||||
if(ishuman(user))
|
||||
|
||||
Reference in New Issue
Block a user