Skip to content

Commit

Permalink
Assault crewman can't controll mech (#827)
Browse files Browse the repository at this point in the history
* fastfix

* uh
  • Loading branch information
MalorMorfin authored Dec 16, 2024
1 parent ca25f4b commit 67c2443
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 10 deletions.
5 changes: 5 additions & 0 deletions code/__DEFINES/skills.dm
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#define SKILL_POLICE "police"
#define SKILL_POWERLOADER "powerloader"
#define SKILL_LARGE_VEHICLE "large_vehicle"
#define SKILL_MECH_PILOT "mech_pilot"
#define SKILL_STAMINA "stamina"
#define SKILL_SWORDPLAY "swordplay"
////////////////////////////////////////////////
Expand Down Expand Up @@ -159,6 +160,10 @@
#define SKILL_LARGE_VEHICLE_EXPERIENCED 2 //transport crew
#define SKILL_LARGE_VEHICLE_VETERAN 3 //mech pilot and assault crew

//Allow mech pilot use mechs
#define SKILL_MECH_PILOT_DEFAULT 0
#define SKILL_MECH_PILOT_TRAINED 1

//stamina skill - you do cardio, right?
//buff stamina related things
#define SKILL_STAMINA_WEAK -1
Expand Down
24 changes: 17 additions & 7 deletions code/datums/skills.dm
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
#define SKILLSID "skills-[cqc]-[melee_weapons]\
-[firearms]-[pistols]-[shotguns]-[rifles]-[smgs]-[heavy_weapons]-[smartgun]\
-[swordplay]\
-[engineer]-[construction]-[leadership]-[medical]-[surgery]-[pilot]-[police]-[powerloader]-[large_vehicle]-[stamina]"
-[engineer]-[construction]-[leadership]-[medical]-[surgery]-[pilot]-[police]-[powerloader]-[large_vehicle]-[mech_pilot]-[stamina]"

#define SKILLSIDSRC(S) "skills-[S.cqc]-[S.melee_weapons]\
-[S.firearms]-[S.pistols]-[S.shotguns]-[S.rifles]-[S.smgs]-[S.heavy_weapons]-[S.smartgun]\
-[S.swordplay]\
-[S.engineer]-[S.construction]-[S.leadership]-[S.medical]-[S.surgery]-[S.pilot]-[S.police]-[S.powerloader]-[S.large_vehicle]-[S.stamina]"
-[S.engineer]-[S.construction]-[S.leadership]-[S.medical]-[S.surgery]-[S.pilot]-[S.police]-[S.powerloader]-[S.large_vehicle]-[mech_pilot]-[S.stamina]"

/proc/getSkills(cqc = 0, melee_weapons = 0,\
firearms = 0, pistols = 0, shotguns = 0, rifles = 0, smgs = 0, heavy_weapons = 0, smartgun = 0,\
swordplay = 0,\
engineer = 0, construction = 0, leadership = 0, medical = 0, surgery = 0, pilot = 0, police = 0, powerloader = 0, large_vehicle = 0, stamina = 0)
engineer = 0, construction = 0, leadership = 0, medical = 0, surgery = 0, pilot = 0, police = 0, powerloader = 0, large_vehicle = 0, mech_pilot = 0, stamina = 0)
. = locate(SKILLSID)
if(!.)
. = new /datum/skills(cqc, melee_weapons,\
firearms, pistols, shotguns, rifles, smgs, heavy_weapons, smartgun,\
swordplay,\
engineer, construction, leadership, medical, surgery, pilot, police, powerloader, large_vehicle, stamina)
engineer, construction, leadership, medical, surgery, pilot, police, powerloader, large_vehicle, mech_pilot, stamina)

/proc/getSkillsType(skills_type = /datum/skills)
var/datum/skills/new_skill = skills_type
Expand All @@ -39,6 +39,7 @@ engineer = 0, construction = 0, leadership = 0, medical = 0, surgery = 0, pilot
var/police = initial(new_skill.police)
var/powerloader = initial(new_skill.powerloader)
var/large_vehicle = initial(new_skill.large_vehicle)
var/mech_pilot = initial(new_skill.mech_pilot)
var/stamina = initial(new_skill.stamina)
//RUTGMC EDIT ADDITION BEGIN - SWORDS
var/swordplay = initial(new_skill.swordplay)
Expand Down Expand Up @@ -70,6 +71,7 @@ engineer = 0, construction = 0, leadership = 0, medical = 0, surgery = 0, pilot
var/police = SKILL_POLICE_DEFAULT
var/powerloader = SKILL_POWERLOADER_DEFAULT
var/large_vehicle = SKILL_LARGE_VEHICLE_DEFAULT
var/mech_pilot = SKILL_MECH_PILOT_DEFAULT
///Effects stamina regen rate and regen delay
var/stamina = SKILL_STAMINA_DEFAULT
//RUTGMC EDIT ADDITION BEGIN - SWORDS
Expand All @@ -79,7 +81,7 @@ engineer = 0, construction = 0, leadership = 0, medical = 0, surgery = 0, pilot

/datum/skills/New(cqc, melee_weapons,\
firearms, pistols, shotguns, rifles, smgs, heavy_weapons, swordplay, smartgun,\
engineer, construction, leadership, medical, surgery, pilot, police, powerloader, large_vehicle, stamina)
engineer, construction, leadership, medical, surgery, pilot, police, powerloader, large_vehicle, mech_pilot, stamina)
if(!isnull(cqc))
src.cqc = cqc
if(!isnull(melee_weapons))
Expand Down Expand Up @@ -116,6 +118,8 @@ engineer, construction, leadership, medical, surgery, pilot, police, powerloader
src.powerloader = powerloader
if(!isnull(large_vehicle))
src.large_vehicle = large_vehicle
if(!isnull(mech_pilot))
src.mech_pilot = mech_pilot
if(!isnull(stamina))
src.stamina = stamina
//RUTGMC EDIT ADDITION BEGIN - SWORDS
Expand All @@ -127,7 +131,7 @@ engineer, construction, leadership, medical, surgery, pilot, police, powerloader
/// returns/gets a new skills datum with values changed according to the args passed
/datum/skills/proc/modifyRating(cqc, melee_weapons,\
firearms, pistols, shotguns, rifles, smgs, heavy_weapons, swordplay, smartgun,\
engineer, construction, leadership, medical, surgery, pilot, police, powerloader, large_vehicle, stamina)
engineer, construction, leadership, medical, surgery, pilot, police, powerloader, large_vehicle, mech_pilot, stamina)
return getSkills(src.cqc+cqc,\
src.melee_weapons+melee_weapons,\
src.firearms+firearms,\
Expand All @@ -147,6 +151,7 @@ engineer, construction, leadership, medical, surgery, pilot, police, powerloader
src.police+police,\
src.powerloader+powerloader,\
src.large_vehicle+large_vehicle,\
src.mech_pilot+mech_pilot,\
src.stamina+stamina)

/// acts as [/proc/modifyRating] but instead modifies all values rather than several specific ones
Expand All @@ -170,12 +175,13 @@ engineer, construction, leadership, medical, surgery, pilot, police, powerloader
src.police+difference,\
src.powerloader+difference,\
src.large_vehicle+difference,\
src.mech_pilot+difference,\
src.stamina+difference)

/// acts as [/proc/modifyRating] but sets the rating directly rather than modify it
/datum/skills/proc/setRating(cqc, melee_weapons,\
firearms, pistols, shotguns, rifles, smgs, heavy_weapons, swordplay, smartgun,\
engineer, construction, leadership, medical, surgery, pilot, police, powerloader, large_vehicle, stamina)
engineer, construction, leadership, medical, surgery, pilot, police, powerloader, large_vehicle, mech_pilot, stamina)
return getSkills((isnull(cqc) ? src.cqc : cqc),\
(isnull(melee_weapons) ? src.melee_weapons : melee_weapons),\
(isnull(firearms) ? src.firearms : firearms),\
Expand All @@ -195,6 +201,7 @@ engineer, construction, leadership, medical, surgery, pilot, police, powerloader
(isnull(police) ? src.police : police),\
(isnull(powerloader) ? src.powerloader : powerloader),\
(isnull(large_vehicle) ? src.large_vehicle : large_vehicle),\
(isnull(mech_pilot) ? src.mech_pilot : mech_pilot),\
(isnull(stamina) ? src.stamina : stamina))

/datum/skills/vv_edit_var(var_name, var_value)
Expand Down Expand Up @@ -235,6 +242,7 @@ engineer, construction, leadership, medical, surgery, pilot, police, powerloader
SKILL_POLICE = police,
SKILL_POWERLOADER = powerloader,
SKILL_LARGE_VEHICLE = large_vehicle,
SKILL_MECH_PILOT = mech_pilot,
SKILL_STAMINA = stamina,
)

Expand Down Expand Up @@ -434,6 +442,7 @@ engineer, construction, leadership, medical, surgery, pilot, police, powerloader
construction = SKILL_CONSTRUCTION_METAL
powerloader = SKILL_POWERLOADER_PRO
large_vehicle = SKILL_LARGE_VEHICLE_VETERAN
mech_pilot = SKILL_MECH_PILOT_TRAINED

/datum/skills/assault_crewman
name = ASSAULT_CREWMAN
Expand Down Expand Up @@ -646,6 +655,7 @@ engineer, construction, leadership, medical, surgery, pilot, police, powerloader
police = SKILL_POLICE_MP
powerloader = SKILL_POWERLOADER_MASTER
large_vehicle = SKILL_LARGE_VEHICLE_VETERAN
mech_pilot = SKILL_MECH_PILOT_TRAINED
swordplay = SKILL_SWORDPLAY_TRAINED

/* Deathsquad */
Expand Down
3 changes: 2 additions & 1 deletion code/game/objects/items/pamphlets.dm
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
var/police
var/powerloader
var/large_vehicle
var/mech_pilot
var/stamina

///assoc list list(SKILL = MAXIMUM_INT) for when we dont want to let them read this
Expand All @@ -38,7 +39,7 @@
if(!do_after(user, 5 SECONDS, NONE, user))
return
user.set_skills(user.skills.modifyRating(cqc, melee_weapons, firearms, pistols, shotguns, rifles, smgs, heavy_weapons, swordplay, smartgun,\
engineer, construction, leadership, medical, surgery, pilot, police, powerloader, large_vehicle, stamina))
engineer, construction, leadership, medical, surgery, pilot, police, powerloader, large_vehicle, mech_pilot, stamina))
user.temporarilyRemoveItemFromInventory(src)
qdel(src)

Expand Down
2 changes: 1 addition & 1 deletion code/modules/vehicles/mecha/combat/greyscale/greyscale.dm
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@


/obj/vehicle/sealed/mecha/combat/greyscale/mob_try_enter(mob/entering_mob, mob/user, loc_override = FALSE)
if((mecha_flags & MECHA_SKILL_LOCKED) && entering_mob.skills.getRating(SKILL_LARGE_VEHICLE) < SKILL_LARGE_VEHICLE_VETERAN)
if((mecha_flags & MECHA_SKILL_LOCKED) && entering_mob.skills.getRating(SKILL_MECH_PILOT) < SKILL_MECH_PILOT_TRAINED)
balloon_alert(entering_mob, "You don't know how to pilot this")
return FALSE
return ..()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ GLOBAL_LIST_INIT(greyscale_weapons_data, generate_greyscale_weapons_data())
. = ..()
if(!.)
return
if(user.skills.getRating(SKILL_LARGE_VEHICLE) < SKILL_LARGE_VEHICLE_VETERAN)
if(user.skills.getRating(SKILL_MECH_PILOT) < SKILL_MECH_PILOT_TRAINED)
return FALSE

/obj/machinery/computer/mech_builder/ui_interact(mob/user, datum/tgui/ui)
Expand Down

0 comments on commit 67c2443

Please sign in to comment.