diff --git a/code/controllers/subsystem/job.dm b/code/controllers/subsystem/job.dm index 5983fa3ae5..a0d9226e14 100644 --- a/code/controllers/subsystem/job.dm +++ b/code/controllers/subsystem/job.dm @@ -116,7 +116,7 @@ SUBSYSTEM_DEF(job) if(player.mind && job.title in player.mind.restricted_roles) JobDebug("FOC incompatible with antagonist role, Player: [player]") continue - if(player.client.prefs.job_preferences[job.title] == level) + if(player.client.prefs.job_preferences["[job.title]"] == level) JobDebug("FOC pass, Player: [player], Level:[level]") candidates += player return candidates @@ -182,7 +182,7 @@ SUBSYSTEM_DEF(job) if((job.current_positions >= job.total_positions) && job.total_positions != -1) continue var/list/candidates = FindOccupationCandidates(job, level) - if(!candidates.len) + if(!candidates?.len) continue var/mob/dead/new_player/candidate = pick(candidates) if(AssignRole(candidate, command_position)) @@ -200,7 +200,7 @@ SUBSYSTEM_DEF(job) if((job.current_positions >= job.total_positions) && job.total_positions != -1) continue var/list/candidates = FindOccupationCandidates(job, level) - if(!candidates.len) + if(!candidates?.len) continue var/mob/dead/new_player/candidate = pick(candidates) AssignRole(candidate, command_position) @@ -246,7 +246,7 @@ SUBSYSTEM_DEF(job) initial_players_to_assign = unassigned.len - JobDebug("DO, Len: [unassigned.len]") + JobDebug("DO, Len: [unassigned?.len]") if(unassigned.len == 0) return validate_required_jobs(required_jobs) @@ -270,7 +270,7 @@ SUBSYSTEM_DEF(job) JobDebug("DO, Running Overflow Check 1") var/datum/job/overflow = GetJob(SSjob.overflow_role) var/list/overflow_candidates = FindOccupationCandidates(overflow, JP_LOW) - JobDebug("AC1, Candidates: [overflow_candidates.len]") + JobDebug("AC1, Candidates: [overflow_candidates?.len]") for(var/mob/dead/new_player/player in overflow_candidates) JobDebug("AC1 pass, Player: [player]") AssignRole(player, SSjob.overflow_role) @@ -333,7 +333,7 @@ SUBSYSTEM_DEF(job) continue // If the player wants that job on this level, then try give it to him. - if(player.client.prefs.job_preferences[job.title] == level) + if(player.client.prefs.job_preferences["[job.title]"] == level) // If the job isn't filled if((job.current_positions < job.spawn_positions) || job.spawn_positions == -1) JobDebug("DO pass, Player: [player], Level:[level], Job:[job.title]") @@ -540,7 +540,7 @@ SUBSYSTEM_DEF(job) if(job.required_playtime_remaining(player.client)) young++ continue - switch(player.client.prefs.job_preferences[job.title]) + switch(player.client.prefs.job_preferences["[job.title]"]) if(JP_HIGH) high++ if(JP_MEDIUM) diff --git a/code/game/objects/items/melee/misc.dm b/code/game/objects/items/melee/misc.dm index f9affc230d..10b84917bb 100644 --- a/code/game/objects/items/melee/misc.dm +++ b/code/game/objects/items/melee/misc.dm @@ -180,8 +180,13 @@ slot_flags = ITEM_SLOT_BELT force = 12 //9 hit crit w_class = WEIGHT_CLASS_NORMAL - var/cooldown = 0 + var/cooldown = 13 var/on = TRUE + var/last_hit = 0 + var/stun_stam_cost_coeff = 1.25 + var/hardstun_ds = 1 + var/softstun_ds = 0 + var/stam_dmg = 30 /obj/item/melee/classic_baton/attack(mob/living/target, mob/living/user) if(!on) @@ -207,12 +212,10 @@ if(!isliving(target)) return if (user.a_intent == INTENT_HARM) - if(!..()) - return - if(!iscyborg(target)) + if(!..() || !iscyborg(target)) return else - if(cooldown <= world.time) + if(last_hit < world.time) if(ishuman(target)) var/mob/living/carbon/human/H = target if (H.check_shields(src, 0, "[user]'s [name]", MELEE_ATTACK)) @@ -220,7 +223,7 @@ if(check_martial_counter(H, user)) return playsound(get_turf(src), 'sound/effects/woodhit.ogg', 75, 1, -1) - target.Knockdown(60) + target.Knockdown(softstun_ds, TRUE, FALSE, hardstun_ds, stam_dmg) log_combat(user, target, "stunned", src) src.add_fingerprint(user) target.visible_message("[user] has knocked down [target] with [src]!", \ @@ -229,7 +232,7 @@ target.LAssailant = null else target.LAssailant = user - cooldown = world.time + last_hit = world.time + cooldown user.adjustStaminaLossBuffered(getweight())//CIT CHANGE - makes swinging batons cost stamina /obj/item/melee/classic_baton/telescopic @@ -245,7 +248,7 @@ item_flags = NONE force = 0 on = FALSE - total_mass = TOTAL_MASS_SMALL_ITEM + total_mass = TOTAL_MASS_NORMAL_ITEM /obj/item/melee/classic_baton/telescopic/suicide_act(mob/user) var/mob/living/carbon/human/H = user diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index 686d5d3572..f9fc7b9221 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -1039,7 +1039,7 @@ GLOBAL_LIST_EMPTY(preferences_datums) var/available_in_days = job.available_in_days(user.client) HTML += "[rank] \[IN [(available_in_days)] DAYS\]" continue - if((job_preferences[SSjob.overflow_role] == JP_LOW) && (rank != SSjob.overflow_role) && !jobban_isbanned(user, SSjob.overflow_role)) + if((job_preferences["[SSjob.overflow_role]"] == JP_LOW) && (rank != SSjob.overflow_role) && !jobban_isbanned(user, SSjob.overflow_role)) HTML += "[rank]" continue if((rank in GLOB.command_positions) || (rank == "AI"))//Bold head jobs @@ -1054,7 +1054,7 @@ GLOBAL_LIST_EMPTY(preferences_datums) var/prefUpperLevel = -1 // level to assign on left click var/prefLowerLevel = -1 // level to assign on right click - switch(job_preferences[job.title]) + switch(job_preferences["[job.title]"]) if(JP_HIGH) prefLevelLabel = "High" prefLevelColor = "slateblue" @@ -1079,7 +1079,7 @@ GLOBAL_LIST_EMPTY(preferences_datums) HTML += "" if(rank == SSjob.overflow_role)//Overflow is special - if(job_preferences[SSjob.overflow_role] == JP_LOW) + if(job_preferences["[SSjob.overflow_role]"] == JP_LOW) HTML += "Yes" else HTML += "No" @@ -1115,11 +1115,11 @@ GLOBAL_LIST_EMPTY(preferences_datums) if (level == JP_HIGH) // to high //Set all other high to medium for(var/j in job_preferences) - if(job_preferences[j] == JP_HIGH) - job_preferences[j] = JP_MEDIUM + if(job_preferences["[j]"] == JP_HIGH) + job_preferences["[j]"] = JP_MEDIUM //technically break here - job_preferences[job.title] = level + job_preferences["[job.title]"] = level return TRUE /datum/preferences/proc/UpdateJobPreference(mob/user, role, desiredLvl) @@ -1147,7 +1147,7 @@ GLOBAL_LIST_EMPTY(preferences_datums) jpval = JP_HIGH if(role == SSjob.overflow_role) - if(job_preferences[job.title] == JP_LOW) + if(job_preferences["[job.title]"] == JP_LOW) jpval = null else jpval = JP_LOW diff --git a/code/modules/client/preferences_savefile.dm b/code/modules/client/preferences_savefile.dm index c900349843..84db999325 100644 --- a/code/modules/client/preferences_savefile.dm +++ b/code/modules/client/preferences_savefile.dm @@ -5,7 +5,7 @@ // You do not need to raise this if you are adding new values that have sane defaults. // Only raise this value when changing the meaning/format/name/layout of an existing value // where you would want the updater procs below to run -#define SAVEFILE_VERSION_MAX 22 +#define SAVEFILE_VERSION_MAX 23 /* SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Carn @@ -49,8 +49,12 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car pda_style = "mono" if(current_version < 20) pda_color = "#808000" - if(current_version < 21) + if((current_version < 21) && features["meat_type"] && (features["meat_type"] == null)) + features["meat_type"] = "Mammalian" + if(current_version < 22) + job_preferences = list() //It loaded null from nonexistant savefile field. + var/job_civilian_high = 0 var/job_civilian_med = 0 var/job_civilian_low = 0 @@ -101,9 +105,9 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car else if(job_engsec_low & fval) new_value = JP_LOW if(new_value) - job_preferences[initial(J.title)] = new_value - if((current_version < 22) && features["meat_type"] && (features["meat_type"] == null)) - features["meat_type"] = "Mammalian" + job_preferences["[initial(J.title)]"] = new_value + else if(current_version < 23) // we are fixing a gamebreaking bug. + job_preferences = list() //It loaded null from nonexistant savefile field. /datum/preferences/proc/load_path(ckey,filename="preferences.sav") if(!ckey) @@ -485,7 +489,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car joblessrole = sanitize_integer(joblessrole, 1, 3, initial(joblessrole)) //Validate job prefs for(var/j in job_preferences) - if(job_preferences[j] != JP_LOW && job_preferences[j] != JP_MEDIUM && job_preferences[j] != JP_HIGH) + if(job_preferences["[j]"] != JP_LOW && job_preferences["[j]"] != JP_MEDIUM && job_preferences["[j]"] != JP_HIGH) job_preferences -= j all_quirks = SANITIZE_LIST(all_quirks) diff --git a/code/modules/mob/dead/new_player/preferences_setup.dm b/code/modules/mob/dead/new_player/preferences_setup.dm index b08fadefcb..994d082585 100644 --- a/code/modules/mob/dead/new_player/preferences_setup.dm +++ b/code/modules/mob/dead/new_player/preferences_setup.dm @@ -28,9 +28,9 @@ var/datum/job/previewJob var/highest_pref = 0 for(var/job in job_preferences) - if(job_preferences[job] > highest_pref) + if(job_preferences["[job]"] > highest_pref) previewJob = SSjob.GetJob(job) - highest_pref = job_preferences[job] + highest_pref = job_preferences["[job]"] if(previewJob) // Silicons only need a very basic preview since there is no customization for them. diff --git a/html/changelogs/AutoChangeLog-pr-9295.yml b/html/changelogs/AutoChangeLog-pr-9295.yml new file mode 100644 index 0000000000..a96540c11b --- /dev/null +++ b/html/changelogs/AutoChangeLog-pr-9295.yml @@ -0,0 +1,4 @@ +author: "Ghommie" +delete-after: True +changes: + - balance: "Slowed down police baton and tele baton speed by 75%, should be still be faster than the legacy speed (2 seconds) by 0.6 seconds. Telescopic batons' stamina cost per swing is now on par with police batons, ergo more expensive." diff --git a/html/changelogs/AutoChangeLog-pr-9302.yml b/html/changelogs/AutoChangeLog-pr-9302.yml new file mode 100644 index 0000000000..4f6ed4d336 --- /dev/null +++ b/html/changelogs/AutoChangeLog-pr-9302.yml @@ -0,0 +1,4 @@ +author: "deathride58" +delete-after: True +changes: + - bugfix: "Things that access job_preferences now explicitly access keys, which means it no longer attempts to access invalid indices and runtimes as a result." diff --git a/modular_citadel/code/game/objects/items/melee/misc.dm b/modular_citadel/code/game/objects/items/melee/misc.dm deleted file mode 100644 index 48c221696e..0000000000 --- a/modular_citadel/code/game/objects/items/melee/misc.dm +++ /dev/null @@ -1,57 +0,0 @@ -/obj/item/melee/classic_baton - var/last_hit = 0 - var/stun_stam_cost_coeff = 1.25 - var/hardstun_ds = 1 - var/softstun_ds = 0 - var/stam_dmg = 30 - cooldown = 0 - total_mass = 3.75 - -/obj/item/melee/classic_baton/attack(mob/living/target, mob/living/user) - if(!on) - return ..() - - if(user.getStaminaLoss() >= STAMINA_SOFTCRIT)//CIT CHANGE - makes batons unusuable in stamina softcrit - to_chat(user, "You're too exhausted for that.")//CIT CHANGE - ditto - return //CIT CHANGE - ditto - - add_fingerprint(user) - if((HAS_TRAIT(user, TRAIT_CLUMSY)) && prob(50)) - to_chat(user, "You club yourself over the head.") - user.Knockdown(60 * force) - if(ishuman(user)) - var/mob/living/carbon/human/H = user - H.apply_damage(2*force, BRUTE, BODY_ZONE_HEAD) - else - user.take_bodypart_damage(2*force) - return - if(iscyborg(target)) - ..() - return - if(!isliving(target)) - return - if (user.a_intent == INTENT_HARM) - if(!..()) - return - if(!iscyborg(target)) - return - else - if(last_hit + cooldown < world.time) - if(ishuman(target)) - var/mob/living/carbon/human/H = target - if (H.check_shields(src, 0, "[user]'s [name]", MELEE_ATTACK)) - return - if(check_martial_counter(H, user)) - return - playsound(get_turf(src), 'sound/effects/woodhit.ogg', 75, 1, -1) - target.Knockdown(softstun_ds, TRUE, FALSE, hardstun_ds, stam_dmg) - log_combat(user, target, "stunned", src) - src.add_fingerprint(user) - target.visible_message("[user] has knocked down [target] with [src]!", \ - "[user] has knocked down [target] with [src]!") - if(!iscarbon(user)) - target.LAssailant = null - else - target.LAssailant = user - last_hit = world.time - user.adjustStaminaLossBuffered(getweight())//CIT CHANGE - makes swinging batons cost stamina diff --git a/tgstation.dme b/tgstation.dme index 92d836cfc6..cda8996284 100755 --- a/tgstation.dme +++ b/tgstation.dme @@ -2948,7 +2948,6 @@ #include "modular_citadel\code\game\objects\items\devices\radio\headset.dm" #include "modular_citadel\code\game\objects\items\devices\radio\shockcollar.dm" #include "modular_citadel\code\game\objects\items\melee\eutactic_blades.dm" -#include "modular_citadel\code\game\objects\items\melee\misc.dm" #include "modular_citadel\code\game\objects\items\robot\robot_upgrades.dm" #include "modular_citadel\code\game\objects\items\storage\firstaid.dm" #include "modular_citadel\code\game\objects\structures\tables_racks.dm"