diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index e8b3a8264a1..dbfcdec4ddf 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -716,4 +716,14 @@ else ..() /obj/item/proc/pwr_drain() - return 0 // Process Kill \ No newline at end of file + return 0 // Process Kill + +/obj/item/proc/remove_item_from_storage(atom/newLoc) //please use this if you're going to snowflake an item out of a obj/item/weapon/storage + if(!newLoc) + return 0 + if(istype(loc,/obj/item/weapon/storage)) + var/obj/item/weapon/storage/S = loc + S.remove_from_storage(src,newLoc) + return 1 + return 0 + \ No newline at end of file diff --git a/code/game/objects/items/weapons/storage/backpack.dm b/code/game/objects/items/weapons/storage/backpack.dm index a19c240849e..dde656589d9 100644 --- a/code/game/objects/items/weapons/storage/backpack.dm +++ b/code/game/objects/items/weapons/storage/backpack.dm @@ -8,6 +8,8 @@ desc = "You wear this on your back and put items into it." icon_state = "backpack" item_state = "backpack" + lefthand_file = 'icons/mob/inhands/clothing_lefthand.dmi' + righthand_file = 'icons/mob/inhands/clothing_righthand.dmi' w_class = 4.0 slot_flags = SLOT_BACK //ERROOOOO max_w_class = 3 diff --git a/code/game/objects/items/weapons/storage/boxes.dm b/code/game/objects/items/weapons/storage/boxes.dm index d360ecf9bb7..d22ca34cffa 100644 --- a/code/game/objects/items/weapons/storage/boxes.dm +++ b/code/game/objects/items/weapons/storage/boxes.dm @@ -30,7 +30,6 @@ name = "large box" desc = "You could build a fort with this." icon_state = "largebox" - item_state = "largebox" w_class = 42 // Big, bulky. foldable = /obj/item/stack/sheet/cardboard //BubbleWrap storage_slots = 21 diff --git a/code/game/objects/items/weapons/tools.dm b/code/game/objects/items/weapons/tools.dm index af98d810510..5fe5efcca85 100644 --- a/code/game/objects/items/weapons/tools.dm +++ b/code/game/objects/items/weapons/tools.dm @@ -136,15 +136,16 @@ name = "welding tool" icon = 'icons/obj/items.dmi' icon_state = "welder" + item_state = "welder" flags = CONDUCT slot_flags = SLOT_BELT //Amount of OUCH when it's thrown - force = 3.0 - throwforce = 5.0 + force = 3 + throwforce = 5 throw_speed = 3 throw_range = 5 - w_class = 2.0 + w_class = 2 //Cost to make in the autolathe materials = list(MAT_METAL=70, MAT_GLASS=30) @@ -156,132 +157,137 @@ var/welding = 0 //Whether or not the welding tool is off(0), on(1) or currently welding(2) var/status = 1 //Whether the welder is secured or unsecured (able to attach rods to it to make a flamethrower) var/max_fuel = 20 //The max amount of fuel the welder can hold + var/change_icons = 1 + var/can_off_process = 0 + var/light_intensity = 2 //how powerful the emitted light is when used. /obj/item/weapon/weldingtool/New() -// var/random_fuel = min(rand(10,20),max_fuel) - var/datum/reagents/R = new/datum/reagents(max_fuel) - reagents = R - R.my_atom = src - R.add_reagent("fuel", max_fuel) - return - - -/obj/item/weapon/weldingtool/examine() - set src in usr - usr << text("\icon[] [] contains []/[] units of fuel!", src, src.name, get_fuel(),src.max_fuel ) - return - - -/obj/item/weapon/weldingtool/attackby(obj/item/W as obj, mob/user as mob, params) - if(istype(W,/obj/item/weapon/screwdriver)) - if(welding) - user << "\red Stop welding first!" - return - status = !status - if(status) - user << "\blue You resecure the welder." - else - user << "\blue The welder can now be attached and modified." - src.add_fingerprint(user) - return - - if((!status) && (istype(W,/obj/item/stack/rods))) - var/obj/item/stack/rods/R = W - R.use(1) - var/obj/item/weapon/flamethrower/F = new/obj/item/weapon/flamethrower(user.loc) - src.loc = F - F.weldtool = src - if (user.client) - user.client.screen -= src - if (user.r_hand == src) - user.unEquip(src) - else - user.unEquip(src) - src.master = F - src.layer = initial(src.layer) - user.unEquip(src) - if (user.client) - user.client.screen -= src - src.loc = F - src.add_fingerprint(user) - return - ..() + create_reagents(max_fuel) + reagents.add_reagent("fuel", max_fuel) + update_icon() + return + +/obj/item/weapon/weldingtool/examine(mob/user) + ..() + user << "It contains [get_fuel()] unit\s of fuel out of [max_fuel]." + +/obj/item/weapon/weldingtool/suicide_act(mob/user) + user.visible_message("[user] welds \his every orifice closed! It looks like \he's trying to commit suicide..") + return (FIRELOSS) + +/obj/item/weapon/weldingtool/proc/update_torch() + overlays.Cut() + if(welding) + overlays += "[initial(icon_state)]-on" + item_state = "[initial(item_state)]1" + else + item_state = "[initial(item_state)]" + +/obj/item/weapon/weldingtool/update_icon() + if(change_icons) + var/ratio = get_fuel() / max_fuel + ratio = Ceiling(ratio*4) * 25 + if(ratio == 100) + icon_state = initial(icon_state) + else + icon_state = "[initial(icon_state)][ratio]" + update_torch() return +/obj/item/weapon/weldingtool/attackby(obj/item/I as obj, mob/user as mob, params) + if(istype(I, /obj/item/weapon/screwdriver)) + flamethrower_screwdriver(I, user) + if(istype(I, /obj/item/stack/rods)) + flamethrower_rods(I, user) + ..() /obj/item/weapon/weldingtool/process() switch(welding) - //If off if(0) - if(src.icon_state != "welder") //Check that the sprite is correct, if it isnt, it means toggle() was not called - src.force = 3 - src.damtype = "brute" - src.icon_state = "welder" - src.welding = 0 - processing_objects.Remove(src) + force = 3 + damtype = "brute" + update_icon() + if(!can_off_process) + processing_objects.Remove(src) return - //Welders left on now use up fuel, but lets not have them run out quite that fast + //Welders left on now use up fuel, but lets not have them run out quite that fast if(1) - if(src.icon_state != "welder1") //Check that the sprite is correct, if it isnt, it means toggle() was not called - src.force = 15 - src.damtype = "fire" - src.icon_state = "welder1" + force = 15 + damtype = "fire" if(prob(5)) remove_fuel(1) + update_icon() - //If you're actually actively welding, use fuel faster. - //Is this actually used or set anywhere? - Nodrak - if(2) - if(prob(75)) - remove_fuel(1) - - - //I'm not sure what this does. I assume it has to do with starting fires... - //...but it doesnt check to see if the welder is on or not. - var/turf/location = src.loc - if(istype(location, /mob/)) + //This is to start fires. process() is only called if the welder is on. + var/turf/location = loc + if(ismob(location)) var/mob/M = location if(M.l_hand == src || M.r_hand == src) location = get_turf(M) - if (istype(location, /turf)) + if(isturf(location)) location.hotspot_expose(700, 5) +/obj/item/weapon/weldingtool/attack(mob/M as mob, mob/user as mob) + if(ishuman(M)) + var/mob/living/carbon/human/H = M + var/obj/item/organ/external/S = H.organs_by_name[user.zone_sel.selecting] + if (!S) + return + + if(!(S.status & ORGAN_ROBOT) || user.a_intent != I_HELP || S.open == 2) + return ..() + + if(S.brute_dam) + if(S.brute_dam < ROBOLIMB_SELF_REPAIR_CAP) + if (remove_fuel(0,null)) + playsound(src.loc, 'sound/items/Welder2.ogg', 50, 1) + S.heal_damage(15,0,0,1) + user.visible_message("\The [user] patches some dents on \the [M]'s [S.name] with \the [src].") + else if(S.open != 2) + user << "Need more welding fuel!" + return 1 + else + user << "The damage is far too severe to patch over externally." + return 1 + else if(S.open != 2) + user << "Nothing to fix!" + else + return ..() /obj/item/weapon/weldingtool/afterattack(obj/O as obj, mob/user as mob, proximity) if(!proximity) return - if (istype(O, /obj/structure/reagent_dispensers/fueltank) && get_dist(src,O) <= 1 && !src.welding) - O.reagents.trans_to(src, max_fuel) - user << "\blue Welder refueled" - playsound(src.loc, 'sound/effects/refill.ogg', 50, 1, -6) - return - else if (istype(O, /obj/structure/reagent_dispensers/fueltank) && get_dist(src,O) <= 1 && src.welding) - msg_admin_attack("[key_name_admin(user)] triggered a fueltank explosion.") - log_game("[key_name(user)] triggered a fueltank explosion.") - user << "\red That was stupid of you." - var/obj/structure/reagent_dispensers/fueltank/tank = O - tank.explode() - return - if (src.welding) + if(istype(O, /obj/structure/reagent_dispensers/fueltank) && in_range(src, O)) + if(!welding) + O.reagents.trans_to(src, max_fuel) + user << "[src] refueled." + playsound(src.loc, 'sound/effects/refill.ogg', 50, 1, -6) + update_icon() + return + else + message_admins("[key_name_admin(user)] triggered a fueltank explosion.") + log_game("[key_name(user)] triggered a fueltank explosion.") + user << "That was stupid of you." + O.ex_act() + return + + if(welding) remove_fuel(1) var/turf/location = get_turf(user) - if (istype(location, /turf)) - location.hotspot_expose(700, 50, 1) + location.hotspot_expose(700, 50, 1) + if(isliving(O)) var/mob/living/L = O L.IgniteMob() - return - -/obj/item/weapon/weldingtool/attack_self(mob/user as mob) - toggle() - return +/obj/item/weapon/weldingtool/attack_self(mob/user) + toggle(user) + update_icon() //Returns the amount of fuel in the welder /obj/item/weapon/weldingtool/proc/get_fuel() return reagents.get_reagent_amount("fuel") - //Removes fuel from the welding tool. If a mob is passed, it will perform an eyecheck on the mob. This should probably be renamed to use() /obj/item/weapon/weldingtool/proc/remove_fuel(var/amount = 1, var/mob/M = null) if(!welding || !check_fuel()) @@ -299,67 +305,48 @@ //Returns whether or not the welding tool is currently on. /obj/item/weapon/weldingtool/proc/isOn() - return src.welding - -//Sets the welding state of the welding tool. If you see W.welding = 1 anywhere, please change it to W.setWelding(1) -//so that the welding tool updates accordingly -/obj/item/weapon/weldingtool/proc/setWelding(var/temp_welding) - //If we're turning it on - if(temp_welding > 0) - if (get_fuel() > 0) - usr << "\blue The [src] switches on." - src.force = 15 - src.damtype = "fire" - src.icon_state = "welder1" - processing_objects.Add(src) - else - usr << "\blue Need more fuel!" - src.welding = 0 - return - //Otherwise - else - usr << "\blue The [src] switches off." - src.force = 3 - src.damtype = "brute" - src.icon_state = "welder" - src.welding = 0 + return welding //Turns off the welder if there is no more fuel (does this really need to be its own proc?) -/obj/item/weapon/weldingtool/proc/check_fuel() - if((get_fuel() <= 0) && welding) - toggle(1) +/obj/item/weapon/weldingtool/proc/check_fuel(mob/user) + if(get_fuel() <= 0 && welding) + toggle(user, 1) + update_icon() + //mob icon update + if(ismob(loc)) + var/mob/M = loc + M.update_inv_r_hand(0) + M.update_inv_l_hand(0) + return 0 return 1 - //Toggles the welder off and on -/obj/item/weapon/weldingtool/proc/toggle(var/message = 0) - if(!status) return - src.welding = !( src.welding ) - if (src.welding) - if (remove_fuel(1)) - usr << "\blue You switch the [src] on." - src.w_class = 4 - src.force = 15 - src.damtype = "fire" - hitsound = "sound/items/welder.ogg" - src.icon_state = "welder1" - processing_objects.Add(src) +/obj/item/weapon/weldingtool/proc/toggle(mob/user, message = 0) + if(!status) + user << "[src] can't be turned on while unsecured!" + return + welding = !welding + if(welding) + if(get_fuel() >= 1) + user << "You switch [src] on." + force = 15 + damtype = "fire" + hitsound = 'sound/items/welder.ogg' + update_icon() + processing_objects |= src else - usr << "\blue Need more fuel!" - src.welding = 0 - return + user << "You need more fuel!" + welding = 0 else if(!message) - usr << "\blue You switch the [src] off." + user << "You switch [src] off." else - usr << "\blue The [src] shuts off!" - src.w_class = 2 - src.force = 3 - src.damtype = "brute" + user << "[src] shuts off!" + force = 3 + damtype = "brute" hitsound = "swing_hit" - src.icon_state = "welder" - src.welding = 0 + update_icon() //Decides whether or not to damage a player's eyes based on what they're wearing as protection //Note: This should probably be moved to mob @@ -387,10 +374,8 @@ user.eye_blurry += rand(12,20) E.damage += rand(12, 16) if(safety<2) - if(E.damage > 10) user << "Your eyes are really starting to hurt. This can't be good for you!" - if (E.damage >= E.min_broken_damage) user << "You go blind!" user.sdisabilities |= BLIND @@ -402,16 +387,56 @@ spawn(100) user.disabilities &= ~NEARSIGHTED return + +/obj/item/weapon/weldingtool/proc/flamethrower_screwdriver(obj/item/I, mob/user) + if(welding) + user << "Turn it off first!" + return + status = !status + if(status) + user << "You resecure [src]." + else + user << "[src] can now be attached and modified." + add_fingerprint(user) + +/obj/item/weapon/weldingtool/proc/flamethrower_rods(obj/item/I, mob/user) + if(!status) + var/obj/item/stack/rods/R = I + if (R.use(1)) + var/obj/item/weapon/flamethrower/F = new /obj/item/weapon/flamethrower(user.loc) + if(!remove_item_from_storage(F)) + user.unEquip(src) + loc = F + F.weldtool = src + add_fingerprint(user) + user << "You add a rod to a welder, starting to build a flamethrower." + user.put_in_hands(F) + else + user << "You need one rod to start building a flamethrower!" + return /obj/item/weapon/weldingtool/largetank name = "Industrial Welding Tool" + desc = "A slightly larger welder with a larger tank." + icon_state = "indwelder" max_fuel = 40 materials = list(MAT_METAL=70, MAT_GLASS=60) origin_tech = "engineering=2" + +/obj/item/weapon/weldingtool/mini + name = "emergency welding tool" + desc = "A miniature welder used during emergencies." + icon_state = "miniwelder" + max_fuel = 10 + w_class = 1 + materials = list(MAT_METAL=30, MAT_GLASS=10) /obj/item/weapon/weldingtool/hugetank name = "Upgraded Welding Tool" + desc = "An upgraded welder based of the industrial welder." + icon_state = "upindwelder" + item_state = "upindwelder" max_fuel = 80 w_class = 3.0 materials = list(MAT_METAL=70, MAT_GLASS=120) @@ -419,20 +444,26 @@ /obj/item/weapon/weldingtool/experimental name = "Experimental Welding Tool" + desc = "An experimental welder capable of self-fuel generation and less harmful to the eyes." + icon_state = "exwelder" + item_state = "exwelder" max_fuel = 40 w_class = 3.0 materials = list(MAT_METAL=70, MAT_GLASS=120) origin_tech = "engineering=4;plasma=3" - icon_state = "ewelder" var/last_gen = 0 +/obj/item/weapon/weldingtool/experimental/proc/fuel_gen() + if(!welding && !last_gen) + last_gen = 1 + reagents.add_reagent("welding_fuel",1) + spawn(10) + last_gen = 0 - -/obj/item/weapon/weldingtool/experimental/proc/fuel_gen()//Proc to make the experimental welder generate fuel, optimized as fuck -Sieve - var/gen_amount = ((world.time-last_gen)/25) - reagents += (gen_amount) - if(reagents > max_fuel) - reagents = max_fuel +/obj/item/weapon/weldingtool/experimental/process() + ..() + if(reagents.total_volume < max_fuel) + fuel_gen() /* * Crowbar @@ -468,35 +499,6 @@ materials = list(MAT_METAL=70) icon_state = "crowbar_large" -/obj/item/weapon/weldingtool/attack(mob/M as mob, mob/user as mob) - if(ishuman(M)) - var/mob/living/carbon/human/H = M - var/obj/item/organ/external/S = H.organs_by_name[user.zone_sel.selecting] - - if (!S) - return - if(!(S.status & ORGAN_ROBOT) || user.a_intent != I_HELP || S.open == 2) - return ..() - - if(S.brute_dam) - if(S.brute_dam < ROBOLIMB_SELF_REPAIR_CAP) - if (remove_fuel(0,null)) - playsound(src.loc, 'sound/items/Welder2.ogg', 50, 1) - S.heal_damage(15,0,0,1) - user.visible_message("\The [user] patches some dents on \the [M]'s [S.name] with \the [src].") - else if(S.open != 2) - user << "Need more welding fuel!" - return 1 - else - user << "The damage is far too severe to patch over externally." - return 1 - else if(S.open != 2) - user << "Nothing to fix!" - - else - return ..() - - /obj/item/weapon/conversion_kit name = "\improper Revolver Conversion Kit" desc = "A professional conversion kit used to convert any knock off revolver into the real deal capable of shooting lethal .357 rounds without the possibility of catastrophic failure" diff --git a/code/modules/mob/living/carbon/human/update_icons.dm b/code/modules/mob/living/carbon/human/update_icons.dm index e55ee2d1149..b32dcd649b6 100644 --- a/code/modules/mob/living/carbon/human/update_icons.dm +++ b/code/modules/mob/living/carbon/human/update_icons.dm @@ -868,7 +868,7 @@ var/global/list/damage_icon_parts = list() var/t_state = r_hand.item_state if(!t_state) t_state = r_hand.icon_state - var/image/I = image("icon" = r_hand.righthand_file, "icon_state"="[t_state]", "layer"=-R_HAND_LAYER) + var/image/I = image("icon" = r_hand.righthand_file, "icon_state"="[t_state]") I = center_image(I, r_hand.inhand_x_dimension, r_hand.inhand_y_dimension) overlays_standing[R_HAND_LAYER] = I @@ -884,7 +884,7 @@ var/global/list/damage_icon_parts = list() var/t_state = l_hand.item_state if(!t_state) t_state = l_hand.icon_state - var/image/I = image("icon" = l_hand.lefthand_file, "icon_state"="[t_state]", "layer"=-L_HAND_LAYER) + var/image/I = image("icon" = l_hand.lefthand_file, "icon_state"="[t_state]") I = center_image(I, l_hand.inhand_x_dimension, l_hand.inhand_y_dimension) overlays_standing[L_HAND_LAYER] = I diff --git a/icons/mob/inhands/guns_lefthand.dmi b/icons/mob/inhands/guns_lefthand.dmi index f3209d8c047..78f6918e029 100644 Binary files a/icons/mob/inhands/guns_lefthand.dmi and b/icons/mob/inhands/guns_lefthand.dmi differ diff --git a/icons/mob/inhands/guns_righthand.dmi b/icons/mob/inhands/guns_righthand.dmi index 25ac8d3c072..cce966fddc6 100644 Binary files a/icons/mob/inhands/guns_righthand.dmi and b/icons/mob/inhands/guns_righthand.dmi differ diff --git a/icons/mob/inhands/items_lefthand.dmi b/icons/mob/inhands/items_lefthand.dmi index 2e0181bab59..f85ee8c3453 100644 Binary files a/icons/mob/inhands/items_lefthand.dmi and b/icons/mob/inhands/items_lefthand.dmi differ diff --git a/icons/mob/inhands/items_righthand.dmi b/icons/mob/inhands/items_righthand.dmi index aa1bb8522af..f051cc0a5c5 100644 Binary files a/icons/mob/inhands/items_righthand.dmi and b/icons/mob/inhands/items_righthand.dmi differ diff --git a/icons/obj/items.dmi b/icons/obj/items.dmi index 09ae246998e..36b08f19a09 100644 Binary files a/icons/obj/items.dmi and b/icons/obj/items.dmi differ