diff --git a/code/game/objects/items/melee/baton.dm b/code/game/objects/items/melee/baton.dm index 205e17d64ee..924d77712fd 100644 --- a/code/game/objects/items/melee/baton.dm +++ b/code/game/objects/items/melee/baton.dm @@ -277,13 +277,14 @@ else attack_self(user) - sleep(3) - if (!QDELETED(human_user)) - if(!QDELETED(our_brain)) - human_user.internal_organs -= our_brain - qdel(our_brain) - new /obj/effect/gibspawner/generic(human_user.drop_location(), human_user) - return (BRUTELOSS) + sleep(0.3 SECONDS) + if (QDELETED(human_user)) + return + if(!QDELETED(our_brain)) + human_user.internal_organs -= our_brain + qdel(our_brain) + new /obj/effect/gibspawner/generic(human_user.drop_location(), human_user) + return (BRUTELOSS) /* * Signal proc for [COMSIG_TRANSFORMING_ON_TRANSFORM]. @@ -362,7 +363,7 @@ /obj/item/melee/baton/security/Initialize(mapload) . = ..() if(preload_cell_type) - if(!ispath(preload_cell_type,/obj/item/stock_parts/cell)) + if(!ispath(preload_cell_type, /obj/item/stock_parts/cell)) log_mapping("[src] at [AREACOORD(src)] had an invalid preload_cell_type: [preload_cell_type].") else cell = new preload_cell_type(src) @@ -376,7 +377,7 @@ if(cell?.charge && active) user.visible_message(span_suicide("[user] is putting the live [name] in [user.p_their()] mouth! It looks like [user.p_theyre()] trying to commit suicide!")) . = (FIRELOSS) - attack(user,user) + attack(user, user) else user.visible_message(span_suicide("[user] is shoving the [name] down their throat! It looks like [user.p_theyre()] trying to commit suicide!")) . = (OXYLOSS) @@ -387,18 +388,19 @@ UnregisterSignal(src, COMSIG_PARENT_ATTACKBY) return ..() -/obj/item/melee/baton/security/proc/convert(datum/source, obj/item/I, mob/user) +/obj/item/melee/baton/security/proc/convert(datum/source, obj/item/item, mob/user) SIGNAL_HANDLER - if(istype(I,/obj/item/conversion_kit) && convertible) - var/turf/source_turf = get_turf(src) - var/obj/item/melee/baton/baton = new (source_turf) - baton.alpha = 20 - playsound(source_turf, 'sound/items/drill_use.ogg', 80, TRUE, -1) - animate(src, alpha = 0, time = 10) - animate(baton, alpha = 255, time = 10) - qdel(I) - qdel(src) + if(!istype(item, /obj/item/conversion_kit) || !convertible) + return + var/turf/source_turf = get_turf(src) + var/obj/item/melee/baton/baton = new (source_turf) + baton.alpha = 20 + playsound(source_turf, 'sound/items/drill_use.ogg', 80, TRUE, -1) + animate(src, alpha = 0, time = 1 SECONDS) + animate(baton, alpha = 255, time = 1 SECONDS) + qdel(item) + qdel(src) /obj/item/melee/baton/security/Exited(atom/movable/mov_content) . = ..() @@ -425,22 +427,22 @@ else . += span_warning("\The [src] does not have a power source installed.") -/obj/item/melee/baton/security/attackby(obj/item/W, mob/user, params) - if(istype(W, /obj/item/stock_parts/cell)) - var/obj/item/stock_parts/cell/C = W +/obj/item/melee/baton/security/attackby(obj/item/item, mob/user, params) + if(istype(item, /obj/item/stock_parts/cell)) + var/obj/item/stock_parts/cell/active_cell = item if(cell) to_chat(user, span_warning("[src] already has a cell!")) else - if(C.maxcharge < cell_hit_cost) + if(active_cell.maxcharge < cell_hit_cost) to_chat(user, span_notice("[src] requires a higher capacity cell.")) return - if(!user.transferItemToLoc(W, src)) + if(!user.transferItemToLoc(item, src)) return - cell = W + cell = item to_chat(user, span_notice("You install a cell in [src].")) update_appearance() - else if(W.tool_behaviour == TOOL_SCREWDRIVER) + else if(item.tool_behaviour == TOOL_SCREWDRIVER) tryremovecell(user) else return ..() @@ -497,8 +499,8 @@ /obj/item/melee/baton/security/baton_effect(mob/living/target, mob/living/user, modifiers, stun_override) if(iscyborg(loc)) - var/mob/living/silicon/robot/R = loc - if(!R || !R.cell || !R.cell.use(cell_hit_cost)) + var/mob/living/silicon/robot/robot = loc + if(!robot || !robot.cell || !robot.cell.use(cell_hit_cost)) return FALSE else if(!deductcharge(cell_hit_cost)) return FALSE @@ -552,8 +554,8 @@ if (cell.charge >= cell_hit_cost) var/scramble_time scramble_mode() - for(var/loops in 1 to rand(6,12)) - scramble_time = rand(5,15)/10 + for(var/loops in 1 to rand(6, 12)) + scramble_time = rand(5, 15) / (1 SECONDS) addtimer(CALLBACK(src, .proc/scramble_mode), scramble_time*loops * (1 SECONDS)) /obj/item/melee/baton/security/proc/scramble_mode() @@ -587,19 +589,18 @@ sparkler = new (src) /obj/item/melee/baton/security/cattleprod/attackby(obj/item/item, mob/user, params)//handles sticking a crystal onto a stunprod to make a teleprod - if(istype(item, /obj/item/stack/ore/bluespace_crystal)) - if(!cell) - var/obj/item/stack/ore/bluespace_crystal/crystal = item - var/obj/item/melee/baton/security/cattleprod/teleprod/prod = new - remove_item_from_storage(user) - qdel(src) - crystal.use(1) - user.put_in_hands(prod) - to_chat(user, span_notice("You place the bluespace crystal firmly into the igniter.")) - else - user.visible_message(span_warning("You can't put the crystal onto the stunprod while it has a power cell installed!")) - else + if(!istype(item, /obj/item/stack/ore/bluespace_crystal)) return ..() + if(!cell) + var/obj/item/stack/ore/bluespace_crystal/crystal = item + var/obj/item/melee/baton/security/cattleprod/teleprod/prod = new + remove_item_from_storage(user) + qdel(src) + crystal.use(1) + user.put_in_hands(prod) + to_chat(user, span_notice("You place the bluespace crystal firmly into the igniter.")) + else + user.visible_message(span_warning("You can't put the crystal onto the stunprod while it has a power cell installed!")) /obj/item/melee/baton/security/cattleprod/baton_effect() if(!sparkler.activate()) @@ -625,23 +626,22 @@ convertible = FALSE custom_materials = list(/datum/material/iron = 10000, /datum/material/glass = 4000, /datum/material/silver = 10000, /datum/material/gold = 2000) -/obj/item/melee/baton/security/boomerang/throw_at(atom/target, range, speed, mob/thrower, spin=1, diagonals_first = 0, datum/callback/callback, force, gentle = FALSE, quickstart = TRUE) +/obj/item/melee/baton/security/boomerang/throw_at(atom/target, range, speed, mob/thrower, spin = 1, diagonals_first = 0, datum/callback/callback, force, gentle = FALSE, quickstart = TRUE) if(active) if(ishuman(thrower)) - var/mob/living/carbon/human/H = thrower - H.throw_mode_off(THROW_MODE_TOGGLE) //so they can catch it on the return. + var/mob/living/carbon/human/human_thrower = thrower + human_thrower.throw_mode_off(THROW_MODE_TOGGLE) //so they can catch it on the return. return ..() /obj/item/melee/baton/security/boomerang/throw_impact(atom/hit_atom, datum/thrownthing/throwingdatum) - if(active) - var/caught = hit_atom.hitby(src, FALSE, FALSE, throwingdatum=throwingdatum) - var/mob/thrown_by = thrownby?.resolve() - if(isliving(hit_atom) && !iscyborg(hit_atom) && !caught && prob(throw_stun_chance))//if they are a living creature and they didn't catch it - finalize_baton_attack(hit_atom, thrown_by, in_attack_chain = FALSE) - if(thrown_by && !caught) - addtimer(CALLBACK(src, /atom/movable.proc/throw_at, thrown_by, throw_range+2, throw_speed, null, TRUE), 1) - else + if(!active) return ..() + var/caught = hit_atom.hitby(src, skipcatch = FALSE, hitpush = FALSE, throwingdatum = throwingdatum) + var/mob/thrown_by = thrownby?.resolve() + if(isliving(hit_atom) && !iscyborg(hit_atom) && !caught && prob(throw_stun_chance))//if they are a living creature and they didn't catch it + finalize_baton_attack(hit_atom, thrown_by, in_attack_chain = FALSE) + if(thrown_by && !caught) + addtimer(CALLBACK(src, /atom/movable.proc/throw_at, thrown_by, throw_range+2, throw_speed, null, TRUE), 1) /obj/item/melee/baton/security/boomerang/loaded //Same as above, comes with a cell. preload_cell_type = /obj/item/stock_parts/cell/high diff --git a/code/game/objects/items/melee/energy.dm b/code/game/objects/items/melee/energy.dm index b0dcfd58abb..3876f62e4d3 100644 --- a/code/game/objects/items/melee/energy.dm +++ b/code/game/objects/items/melee/energy.dm @@ -67,16 +67,16 @@ if(heat) open_flame() -/obj/item/melee/energy/ignition_effect(atom/A, mob/user) +/obj/item/melee/energy/ignition_effect(atom/atom, mob/user) if(!heat && !blade_active) return "" var/in_mouth = "" if(iscarbon(user)) - var/mob/living/carbon/C = user - if(C.wear_mask) - in_mouth = ", barely missing [C.p_their()] nose" - . = span_warning("[user] swings [user.p_their()] [name][in_mouth]. [user.p_they(TRUE)] light[user.p_s()] [user.p_their()] [A.name] in the process.") + var/mob/living/carbon/carbon_user = user + if(carbon_user.wear_mask) + in_mouth = ", barely missing [carbon_user.p_their()] nose" + . = span_warning("[user] swings [user.p_their()] [name][in_mouth]. [user.p_they(TRUE)] light[user.p_s()] [user.p_their()] [atom.name] in the process.") playsound(loc, hitsound, get_clamped_volume(), TRUE, -1) add_fingerprint(user) @@ -249,19 +249,16 @@ /obj/item/melee/energy/sword/saber/purple sword_color_icon = "purple" -/obj/item/melee/energy/sword/saber/attackby(obj/item/weapon, mob/living/user, params) - if(weapon.tool_behaviour == TOOL_MULTITOOL) - if(hacked) - to_chat(user, span_warning("It's already fabulous!")) - else - hacked = TRUE - sword_color_icon = "rainbow" - to_chat(user, span_warning("RNBW_ENGAGE")) - if(force >= active_force) - icon_state = "[initial(icon_state)]_on_rainbow" - user.update_inv_hands() - else - return ..() +/obj/item/melee/energy/sword/saber/multitool_act(mob/living/user, obj/item/tool) + if(hacked) + to_chat(user, span_warning("It's already fabulous!")) + return + hacked = TRUE + sword_color_icon = "rainbow" + to_chat(user, span_warning("RNBW_ENGAGE")) + if(force >= active_force) + icon_state = "[initial(icon_state)]_on_rainbow" + user.update_inv_hands() /obj/item/melee/energy/sword/pirate name = "energy cutlass" diff --git a/code/game/objects/items/melee/misc.dm b/code/game/objects/items/melee/misc.dm index 0a4a452c947..371a2eeb34f 100644 --- a/code/game/objects/items/melee/misc.dm +++ b/code/game/objects/items/melee/misc.dm @@ -84,15 +84,15 @@ final_block_chance = 0 //Don't bring a sword to a gunfight return ..() -/obj/item/melee/sabre/on_exit_storage(datum/component/storage/concrete/S) - var/obj/item/storage/belt/sabre/B = S.real_location() - if(istype(B)) - playsound(B, 'sound/items/unsheath.ogg', 25, TRUE) +/obj/item/melee/sabre/on_exit_storage(datum/component/storage/concrete/container) + var/obj/item/storage/belt/sabre/sabre = container.real_location() + if(istype(sabre)) + playsound(sabre, 'sound/items/unsheath.ogg', 25, TRUE) -/obj/item/melee/sabre/on_enter_storage(datum/component/storage/concrete/S) - var/obj/item/storage/belt/sabre/B = S.real_location() - if(istype(B)) - playsound(B, 'sound/items/sheath.ogg', 25, TRUE) +/obj/item/melee/sabre/on_enter_storage(datum/component/storage/concrete/container) + var/obj/item/storage/belt/sabre/sabre = container.real_location() + if(istype(sabre)) + playsound(sabre, 'sound/items/sheath.ogg', 25, TRUE) /obj/item/melee/sabre/suicide_act(mob/living/user) user.visible_message(span_suicide("[user] is trying to cut off all [user.p_their()] limbs with [src]! it looks like [user.p_theyre()] trying to commit suicide!")) @@ -163,8 +163,8 @@ return user.changeNext_move(CLICK_CD_RAPID) if(iscarbon(target)) - var/mob/living/carbon/H = target - H.reagents.add_reagent(/datum/reagent/toxin, 4) + var/mob/living/carbon/carbon_target = target + carbon_target.reagents.add_reagent(/datum/reagent/toxin, 4) /obj/item/melee/beesword/suicide_act(mob/living/user) user.visible_message(span_suicide("[user] is stabbing [user.p_them()]self in the throat with [src]! It looks like [user.p_theyre()] trying to commit suicide!")) @@ -183,9 +183,9 @@ w_class = WEIGHT_CLASS_BULKY force = 0.001 armour_penetration = 1000 + force_string = "INFINITE" var/obj/machinery/power/supermatter_crystal/shard var/balanced = 1 - force_string = "INFINITE" /obj/item/melee/supermatter_sword/Initialize(mapload) . = ..() @@ -203,9 +203,9 @@ forceMove(target.loc) consume_everything(target) else - var/turf/T = get_turf(src) - if(!isspaceturf(T)) - consume_turf(T) + var/turf/turf = get_turf(src) + if(!isspaceturf(turf)) + consume_turf(turf) /obj/item/melee/supermatter_sword/afterattack(target, mob/user, proximity_flag) . = ..() @@ -217,9 +217,9 @@ /obj/item/melee/supermatter_sword/throw_impact(atom/hit_atom, datum/thrownthing/throwingdatum) ..() if(ismob(hit_atom)) - var/mob/M = hit_atom - if(src.loc == M) - M.dropItemToGround(src) + var/mob/mob = hit_atom + if(src.loc == mob) + mob.dropItemToGround(src) consume_everything(hit_atom) /obj/item/melee/supermatter_sword/pickup(user) @@ -239,10 +239,10 @@ consume_everything() return TRUE -/obj/item/melee/supermatter_sword/bullet_act(obj/projectile/P) - visible_message(span_danger("[P] smacks into [src] and rapidly flashes to ash."),\ +/obj/item/melee/supermatter_sword/bullet_act(obj/projectile/projectile) + visible_message(span_danger("[projectile] smacks into [src] and rapidly flashes to ash."),\ span_hear("You hear a loud crack as you are washed with a wave of heat.")) - consume_everything(P) + consume_everything(projectile) return BULLET_ACT_HIT /obj/item/melee/supermatter_sword/suicide_act(mob/user) @@ -258,14 +258,16 @@ else consume_turf(target) -/obj/item/melee/supermatter_sword/proc/consume_turf(turf/T) - var/oldtype = T.type - var/turf/newT = T.ScrapeAway(flags = CHANGETURF_INHERIT_AIR) +/obj/item/melee/supermatter_sword/proc/consume_turf(turf/turf) + var/oldtype = turf.type + var/turf/newT = turf.ScrapeAway(flags = CHANGETURF_INHERIT_AIR) if(newT.type == oldtype) return - playsound(T, 'sound/effects/supermatter.ogg', 50, TRUE) - T.visible_message(span_danger("[T] smacks into [src] and rapidly flashes to ash."),\ - span_hear("You hear a loud crack as you are washed with a wave of heat.")) + playsound(turf, 'sound/effects/supermatter.ogg', 50, TRUE) + turf.visible_message( + span_danger("[turf] smacks into [src] and rapidly flashes to ash."), + span_hear("You hear a loud crack as you are washed with a wave of heat."), + ) shard.Consume() /obj/item/melee/supermatter_sword/add_blood_DNA(list/blood_dna) @@ -289,9 +291,9 @@ /obj/item/melee/curator_whip/afterattack(target, mob/user, proximity_flag) . = ..() if(ishuman(target) && proximity_flag) - var/mob/living/carbon/human/H = target - H.drop_all_held_items() - H.visible_message(span_danger("[user] disarms [H]!"), span_userdanger("[user] disarmed you!")) + var/mob/living/carbon/human/human_target = target + human_target.drop_all_held_items() + human_target.visible_message(span_danger("[user] disarms [human_target]!"), span_userdanger("[user] disarmed you!")) /obj/item/melee/roastingstick name = "advanced roasting stick" @@ -386,25 +388,24 @@ . = ..() if (!extended) return - if (is_type_in_typecache(target, ovens)) - if (istype(target, /obj/singularity) && get_dist(user, target) < 10) - to_chat(user, span_notice("You send [held_sausage] towards [target].")) - playsound(src, 'sound/items/rped.ogg', 50, TRUE) - beam = user.Beam(target,icon_state="rped_upgrade", time = 10 SECONDS) - else if (user.Adjacent(target)) - to_chat(user, span_notice("You extend [src] towards [target].")) - playsound(src.loc, 'sound/weapons/batonextend.ogg', 50, TRUE) - finish_roasting(user, target) - return - else - return - finish_roasting(user, target) + if (!is_type_in_typecache(target, ovens)) + return + if (istype(target, /obj/singularity) && get_dist(user, target) < 10) + to_chat(user, span_notice("You send [held_sausage] towards [target].")) + playsound(src, 'sound/items/rped.ogg', 50, TRUE) + beam = user.Beam(target, icon_state = "rped_upgrade", time = 10 SECONDS) + else if (user.Adjacent(target)) + to_chat(user, span_notice("You extend [src] towards [target].")) + playsound(src.loc, 'sound/weapons/batonextend.ogg', 50, TRUE) + else + return + finish_roasting(user, target) /obj/item/melee/roastingstick/proc/finish_roasting(user, atom/target) if(do_after(user, 100, target = user)) to_chat(user, span_notice("You finish roasting [held_sausage].")) - playsound(src,'sound/items/welder2.ogg',50,TRUE) - held_sausage.add_atom_colour(rgb(103,63,24), FIXED_COLOUR_PRIORITY) + playsound(src, 'sound/items/welder2.ogg', 50, TRUE) + held_sausage.add_atom_colour(rgb(103, 63, 24), FIXED_COLOUR_PRIORITY) held_sausage.name = "[target.name]-roasted [held_sausage.name]" held_sausage.desc = "[held_sausage.desc] It has been cooked to perfection on \a [target]." update_appearance() diff --git a/code/game/objects/items/tcg/tcg.dm b/code/game/objects/items/tcg/tcg.dm index b6ffa4b3726..9a495cd9d56 100644 --- a/code/game/objects/items/tcg/tcg.dm +++ b/code/game/objects/items/tcg/tcg.dm @@ -32,10 +32,10 @@ GLOBAL_LIST_EMPTY(cached_cards) datum_series = series if(!datum_id) datum_id = id - var/list/L = GLOB.cached_cards[datum_series] - if(!L) + var/list/temp_list = GLOB.cached_cards[datum_series] + if(!temp_list) return - var/datum/card/temp = L["ALL"][datum_id] + var/datum/card/temp = temp_list["ALL"][datum_id] if(!temp) return name = temp.name @@ -125,17 +125,17 @@ GLOBAL_LIST_EMPTY(tcgcard_radial_choices) icon_state = template.icon_state return ..() -/obj/item/tcgcard/attackby(obj/item/I, mob/living/user, params) - if(istype(I, /obj/item/tcgcard)) - var/obj/item/tcgcard/second_card = I +/obj/item/tcgcard/attackby(obj/item/item, mob/living/user, params) + if(istype(item, /obj/item/tcgcard)) + var/obj/item/tcgcard/second_card = item var/obj/item/tcgcard_deck/new_deck = new /obj/item/tcgcard_deck(drop_location()) new_deck.flipped = flipped user.transferItemToLoc(second_card, new_deck)//Start a new pile with both cards, in the order of card placement. user.transferItemToLoc(src, new_deck) new_deck.update_icon_state() user.put_in_hands(new_deck) - if(istype(I, /obj/item/tcgcard_deck)) - var/obj/item/tcgcard_deck/old_deck = I + if(istype(item, /obj/item/tcgcard_deck)) + var/obj/item/tcgcard_deck/old_deck = item if(length(old_deck.contents) >= 30) to_chat(user, span_notice("This pile has too many cards for a regular deck!")) return @@ -249,13 +249,13 @@ GLOBAL_LIST_EMPTY(tcgcard_radial_choices) return FALSE return TRUE -/obj/item/tcgcard_deck/attackby(obj/item/I, mob/living/user, params) +/obj/item/tcgcard_deck/attackby(obj/item/item, mob/living/user, params) . = ..() - if(istype(I, /obj/item/tcgcard)) + if(istype(item, /obj/item/tcgcard)) if(contents.len > 30) to_chat(user, span_notice("This pile has too many cards for a regular deck!")) return FALSE - var/obj/item/tcgcard/new_card = I + var/obj/item/tcgcard/new_card = item new_card.flipped = flipped new_card.forceMove(src) @@ -306,8 +306,7 @@ GLOBAL_LIST_EMPTY(tcgcard_radial_choices) var/list/temp_deck = contents.Copy() contents = reverse_range(temp_deck) //Now flip the cards to their opposite positions. - for(var/a in 1 to contents.len) - var/obj/item/tcgcard/nu_card = contents[a] + for (var/obj/item/tcgcard/nu_card as anything in contents) nu_card.flipped = flipped nu_card.update_icon_state() update_icon_state() @@ -526,9 +525,9 @@ GLOBAL_LIST_EMPTY(tcgcard_radial_choices) toReturn += "[pack.type] has a rarity [template.rarity] on the card [template.id] that does not exist\n" continue //Lets run a check to see if all the rarities exist that we want to exist exist - for(var/I in pack.rarity_table) - if(!GLOB.cached_cards[pack.series][I]) - toReturn += "[pack.type] does not have the required rarity [I]\n" + for(var/pack_rarity in pack.rarity_table) + if(!GLOB.cached_cards[pack.series][pack_rarity]) + toReturn += "[pack.type] does not have the required rarity [pack_rarity]\n" qdel(pack) return toReturn @@ -542,12 +541,12 @@ GLOBAL_LIST_EMPTY(tcgcard_radial_choices) var/datum/card/target = GLOB.cached_cards[series]["ALL"][card] var/toAdd = "The card [target.id] in [series] has the following default variables:" var/shouldAdd = FALSE - for(var/a in (target.vars ^ thing.vars)) - if(a == "icon" && target.vars[a] == DEFAULT_TCG_DMI) + for(var/current_var in (target.vars ^ thing.vars)) + if(current_var == "icon" && target.vars[current_var] == DEFAULT_TCG_DMI) continue - if(target.vars[a] == initial(target.vars[a])) + if(target.vars[current_var] == initial(target.vars[current_var])) shouldAdd = TRUE - toAdd += "\n[a] with a value of [target.vars[a]]" + toAdd += "\n[current_var] with a value of [target.vars[current_var]]" if(shouldAdd) toReturn += toAdd qdel(thing) @@ -591,16 +590,16 @@ GLOBAL_LIST_EMPTY(tcgcard_radial_choices) for(var/list/data in json["templates"]) templates[data["template"]] = data for(var/list/data in cards) - var/datum/card/c = new(data, templates) + var/datum/card/card = new(data, templates) //Lets cache the id by rarity, for top speed lookup later - if(!GLOB.cached_cards[c.series]) - GLOB.cached_cards[c.series] = list() - GLOB.cached_cards[c.series]["ALL"] = list() - if(!GLOB.cached_cards[c.series][c.rarity]) - GLOB.cached_cards[c.series][c.rarity] = list() - GLOB.cached_cards[c.series][c.rarity] += c.id + if(!GLOB.cached_cards[card.series]) + GLOB.cached_cards[card.series] = list() + GLOB.cached_cards[card.series]["ALL"] = list() + if(!GLOB.cached_cards[card.series][card.rarity]) + GLOB.cached_cards[card.series][card.rarity] = list() + GLOB.cached_cards[card.series][card.rarity] += card.id //Let's actually store the datum here - GLOB.cached_cards[c.series]["ALL"][c.id] = c + GLOB.cached_cards[card.series]["ALL"][card.id] = card #undef DEFAULT_TCG_DMI_ICON #undef DEFAULT_TCG_DMI