From 0480790b0a007b9dd8be9f71ba8124bbd545d2b9 Mon Sep 17 00:00:00 2001 From: phil235 Date: Sun, 24 Apr 2016 20:38:33 +0200 Subject: [PATCH] Same things but with structures now. --- code/datums/martial.dm | 59 ++--- code/game/gamemodes/handofgod/structures.dm | 95 ++++--- .../gamemodes/miniantags/bot_swarm/swarmer.dm | 49 ++-- code/game/mecha/mech_fabricator.dm | 20 +- code/game/mecha/mecha_defense.dm | 35 +-- code/game/objects/effects/aliens.dm | 164 +++++------- code/game/objects/effects/spiders.dm | 51 ++-- code/game/objects/items/devices/PDA/PDA.dm | 28 +- .../objects/items/devices/laserpointer.dm | 17 +- code/game/objects/items/robot/robot_parts.dm | 58 ++-- code/game/objects/items/toys.dm | 97 ++++--- code/game/objects/items/weapons/RSF.dm | 207 +++------------ .../objects/items/weapons/holosign_creator.dm | 50 ++-- .../objects/items/weapons/pneumaticCannon.dm | 43 ++- code/game/objects/structures/ai_core.dm | 22 +- .../structures/beds_chairs/alien_nest.dm | 24 +- .../structures/crates_lockers/closets.dm | 38 +-- .../crates_lockers/closets/secure/personal.dm | 37 ++- .../crates_lockers/closets/statue.dm | 26 +- code/game/objects/structures/displaycase.dm | 135 ++++++---- code/game/objects/structures/false_walls.dm | 39 +-- code/game/objects/structures/fireaxe.dm | 83 +++--- code/game/objects/structures/grille.dm | 101 +++---- code/game/objects/structures/guncase.dm | 9 +- code/game/objects/structures/mineral_doors.dm | 17 +- code/game/objects/structures/mirror.dm | 104 ++++---- code/game/objects/structures/signs.dm | 26 +- code/game/objects/structures/statues.dm | 77 +++--- code/game/objects/structures/tables_racks.dm | 249 ++++++++++-------- .../structures/transit_tubes/station.dm | 28 +- code/game/objects/structures/watercloset.dm | 70 ++--- code/game/objects/structures/window.dm | 137 ++++------ code/modules/vehicles/pimpin_ride.dm | 25 +- 33 files changed, 1050 insertions(+), 1170 deletions(-) diff --git a/code/datums/martial.dm b/code/datums/martial.dm index d69b28cd0b1..d1b498f5070 100644 --- a/code/datums/martial.dm +++ b/code/datums/martial.dm @@ -540,38 +540,35 @@ if(C.stat) user << "It would be dishonorable to attack a foe while they cannot retaliate." return - switch(user.a_intent) - if("disarm") - if(!wielded) - return ..() - if(!ishuman(target)) - return ..() - var/mob/living/carbon/human/H = target - var/list/fluffmessages = list("[user] clubs [H] with [src]!", \ - "[user] smacks [H] with the butt of [src]!", \ - "[user] broadsides [H] with [src]!", \ - "[user] smashes [H]'s head with [src]!", \ - "[user] beats [H] with front of [src]!", \ - "[user] twirls and slams [H] with [src]!") - H.visible_message("[pick(fluffmessages)]", \ - "[pick(fluffmessages)]") - playsound(get_turf(user), 'sound/effects/woodhit.ogg', 75, 1, -1) - H.adjustStaminaLoss(rand(13,20)) - if(prob(10)) - H.visible_message("[H] collapses!", \ - "Your legs give out!") - H.Weaken(4) - if(H.staminaloss && !H.sleeping) - var/total_health = (H.health - H.staminaloss) - if(total_health <= config.health_threshold_crit && !H.stat) - H.visible_message("[user] delivers a heavy hit to [H]'s head, knocking them out cold!", \ - "[user] knocks you unconscious!") - H.SetSleeping(30) - H.adjustBrainLoss(25) - return - else + if(user.a_intent == "disarm") + if(!wielded) return ..() - return ..() + if(!ishuman(target)) + return ..() + var/mob/living/carbon/human/H = target + var/list/fluffmessages = list("[user] clubs [H] with [src]!", \ + "[user] smacks [H] with the butt of [src]!", \ + "[user] broadsides [H] with [src]!", \ + "[user] smashes [H]'s head with [src]!", \ + "[user] beats [H] with front of [src]!", \ + "[user] twirls and slams [H] with [src]!") + H.visible_message("[pick(fluffmessages)]", \ + "[pick(fluffmessages)]") + playsound(get_turf(user), 'sound/effects/woodhit.ogg', 75, 1, -1) + H.adjustStaminaLoss(rand(13,20)) + if(prob(10)) + H.visible_message("[H] collapses!", \ + "Your legs give out!") + H.Weaken(4) + if(H.staminaloss && !H.sleeping) + var/total_health = (H.health - H.staminaloss) + if(total_health <= config.health_threshold_crit && !H.stat) + H.visible_message("[user] delivers a heavy hit to [H]'s head, knocking them out cold!", \ + "[user] knocks you unconscious!") + H.SetSleeping(30) + H.adjustBrainLoss(25) + else + return ..() /obj/item/weapon/twohanded/bostaff/hit_reaction(mob/living/carbon/human/owner, attack_text, final_block_chance) if(wielded) diff --git a/code/game/gamemodes/handofgod/structures.dm b/code/game/gamemodes/handofgod/structures.dm index 309efa87a89..f86f4630683 100644 --- a/code/game/gamemodes/handofgod/structures.dm +++ b/code/game/gamemodes/handofgod/structures.dm @@ -52,15 +52,8 @@ return ..() -/obj/structure/divine/proc/healthcheck() - if(!health) - visible_message("\The [src] was destroyed!") - qdel(src) - /obj/structure/divine/attackby(obj/item/I, mob/user) - if(!I || (I.flags & ABSTRACT)) - return 0 //Structure conversion/capture if(istype(I, /obj/item/weapon/godstaff)) @@ -71,35 +64,52 @@ if(G.god && deity != G.god) assign_deity(G.god, alert_old_deity = TRUE) visible_message("\The [src] has been captured by [user]!") - return + else + return ..() +/obj/structure/divine/attacked_by(obj/item/I, mob/living/user) + ..() + take_damage(I.force, I.damtype, 1) + +/obj/structure/divine/proc/take_damage(damage, damage_type = BRUTE, sound_effect = 1) + switch(damage_type) + if(BRUTE) + if(sound_effect) + if(damage) + playsound(loc, 'sound/weapons/smash.ogg', 50, 1) + else + playsound(loc, 'sound/weapons/tap.ogg', 50, 1) + if(BURN) + if(sound_effect) + playsound(src.loc, 'sound/items/Welder.ogg', 100, 1) + else + return + health -= damage + if(!health) + visible_message("\The [src] was destroyed!") + qdel(src) + + +/obj/structure/divine/bullet_act(obj/item/projectile/P) + . = ..() + take_damage(P.damage, P.damage_type, 0) + + +/obj/structure/divine/attack_alien(mob/living/carbon/alien/humanoid/user) user.changeNext_move(CLICK_CD_MELEE) user.do_attack_animation(src) - playsound(get_turf(src), I.hitsound, 50, 1) - visible_message("\The [src] has been attacked with \the [I][(user ? " by [user]" : ".")]!") - health = max(0, health-I.force) - healthcheck() + add_hiddenprint(user) + visible_message("\The [user] slashes at [src]!") + playsound(src.loc, 'sound/weapons/slash.ogg', 100, 1) + take_damage(20, BRUTE, 0) - -/obj/structure/divine/bullet_act(obj/item/projectile/Proj) - if(!Proj) - return 0 - - if(Proj.damage_type == BRUTE || Proj.damage_type == BURN) - health = max(0, health-Proj.damage) - healthcheck() - - -/obj/structure/divine/attack_animal(mob/living/simple_animal/M) - if(!M) - return 0 - - visible_message("\The [src] has been attacked by \the [M]!") - var/damage = rand(M.melee_damage_lower, M.melee_damage_upper) - if(!damage) - return - health = max(0, health-damage) - healthcheck() +/obj/machinery/attack_animal(mob/living/simple_animal/M) + M.changeNext_move(CLICK_CD_MELEE) + M.do_attack_animation(src) + if(M.melee_damage_upper > 0) + M.visible_message("[M.name] smashes against \the [src.name].",\ + "You smash against the [src.name].") + take_damage(rand(M.melee_damage_lower,M.melee_damage_upper), M.melee_damage_type, 1) /obj/structure/divine/proc/assign_deity(mob/camera/god/new_deity, alert_old_deity = TRUE) @@ -199,7 +209,8 @@ user << "\The [src] does not require any more greater gems!" return - ..() + else + return ..() /obj/structure/divine/construction_holder/proc/check_completion() @@ -239,11 +250,22 @@ /obj/structure/divine/nexus/ex_act() return - -/obj/structure/divine/nexus/healthcheck() +/obj/structure/divine/nexus/take_damage(damage, damage_type = BRUTE, sound_effect = 1) + switch(damage_type) + if(BRUTE) + if(sound_effect) + if(damage) + playsound(loc, 'sound/weapons/smash.ogg', 50, 1) + else + playsound(loc, 'sound/weapons/tap.ogg', 50, 1) + if(BURN) + if(sound_effect) + playsound(src.loc, 'sound/items/Welder.ogg', 100, 1) + else + return + health -= damage if(deity) deity.update_health_hud() - if(!health) if(!qdeleted(deity) && deity.nexus_required) deity << "Your nexus was destroyed. You feel yourself fading..." @@ -257,7 +279,6 @@ /obj/structure/divine/nexus/process() - healthcheck() if(deity) deity.update_followers() deity.add_faith(faith_regen_rate + (powerpylons.len / 5) + (deity.alive_followers / 3)) diff --git a/code/game/gamemodes/miniantags/bot_swarm/swarmer.dm b/code/game/gamemodes/miniantags/bot_swarm/swarmer.dm index f0c72d39e2a..4bebddd1564 100644 --- a/code/game/gamemodes/miniantags/bot_swarm/swarmer.dm +++ b/code/game/gamemodes/miniantags/bot_swarm/swarmer.dm @@ -371,44 +371,47 @@ mouse_opacity = 1 var/health = 30 -/obj/effect/swarmer/destructible/proc/TakeDamage(damage) +/obj/effect/swarmer/destructible/proc/take_damage(damage, damage_type = BRUTE, sound_effect = 1) + switch(damage_type) + if(BRUTE) + if(sound_effect) + playsound(loc, 'sound/weapons/Egloves.ogg', 80, 1) + if(BURN) + if(sound_effect) + playsound(src.loc, 'sound/items/Welder.ogg', 100, 1) + else + return health -= damage if(health <= 0) qdel(src) -/obj/effect/swarmer/destructible/bullet_act(obj/item/projectile/Proj) - if(Proj.damage) - if((Proj.damage_type == BRUTE || Proj.damage_type == BURN)) - TakeDamage(Proj.damage) - ..() +/obj/effect/swarmer/destructible/bullet_act(obj/item/projectile/P) + . = ..() + take_damage(P.damage, P.damage_type) -/obj/effect/swarmer/destructible/attackby(obj/item/weapon/I, mob/living/user, params) - if(istype(I, /obj/item/weapon)) - user.changeNext_move(CLICK_CD_MELEE) - user.do_attack_animation(src) - TakeDamage(I.force) - return +/obj/effect/swarmer/destructible/attacked_by(obj/item/I, mob/living/user) + ..() + take_damage(I.force, I.damtype) /obj/effect/swarmer/destructible/ex_act() qdel(src) - return /obj/effect/swarmer/destructible/blob_act() qdel(src) - return /obj/effect/swarmer/destructible/emp_act() qdel(src) - return -/obj/effect/swarmer/destructible/attack_animal(mob/living/user) - if(isanimal(user)) - var/mob/living/simple_animal/S = user - S.do_attack_animation(src) - user.changeNext_move(CLICK_CD_MELEE) - if(S.melee_damage_type == BRUTE || S.melee_damage_type == BURN) - TakeDamage(rand(S.melee_damage_lower, S.melee_damage_upper)) - return +/obj/effect/swarmer/destructible/attack_alien(mob/living/user) + user.do_attack_animation(src) + user.changeNext_move(CLICK_CD_MELEE) + take_damage(rand(20,30)) + +/obj/effect/swarmer/destructible/attack_animal(mob/living/simple_animal/S) + S.do_attack_animation(src) + S.changeNext_move(CLICK_CD_MELEE) + if(S.melee_damage_upper) + take_damage(rand(S.melee_damage_lower, S.melee_damage_upper), S.melee_damage_type) /mob/living/simple_animal/hostile/swarmer/proc/CreateTrap() set name = "Create trap" diff --git a/code/game/mecha/mech_fabricator.dm b/code/game/mecha/mech_fabricator.dm index 5ef0cfdb794..5748be75618 100644 --- a/code/game/mecha/mech_fabricator.dm +++ b/code/game/mecha/mech_fabricator.dm @@ -459,6 +459,9 @@ return result +/obj/machinery/mecha_part_fabricator/deconstruction() + for(var/material in resources) + remove_material(material, resources[material]/MINERAL_MATERIAL_AMOUNT) /obj/machinery/mecha_part_fabricator/attackby(obj/W, mob/user, params) if(default_deconstruction_screwdriver(user, "fab-o", "fab-idle", W)) @@ -467,17 +470,13 @@ if(exchange_parts(user, W)) return - if(panel_open) - if(istype(W, /obj/item/weapon/crowbar)) - for(var/material in resources) - remove_material(material, resources[material]/MINERAL_MATERIAL_AMOUNT) - default_deconstruction_crowbar(W) - return 1 - else - user << "You can't load \the [name] while it's opened!" - return 1 + if(default_deconstruction_crowbar(W)) + return 1 if(istype(W, /obj/item/stack)) + if(panel_open) + user << "You can't load \the [name] while it's opened!" + return 1 var/material switch(W.type) if(/obj/item/stack/sheet/mineral/gold) @@ -519,7 +518,8 @@ overlays -= "fab-load-[material2name(material)]" //No matter what the overlay shall still be deleted else user << "\The [src] cannot hold any more [sname] sheet\s!" - return + else + return ..() /obj/machinery/mecha_part_fabricator/proc/material2name(ID) return copytext(ID,2) diff --git a/code/game/mecha/mecha_defense.dm b/code/game/mecha/mecha_defense.dm index 9b0fc6d69e6..badf0ee4804 100644 --- a/code/game/mecha/mecha_defense.dm +++ b/code/game/mecha/mecha_defense.dm @@ -183,7 +183,7 @@ else user << "You were unable to attach [W] to [src]!" return - if(istype(W, /obj/item/weapon/card/id)||istype(W, /obj/item/device/pda)) + if(W.GetID()) if(add_req_access || maint_access) if(internals_access_allowed(user)) var/obj/item/weapon/card/id/id_card @@ -223,7 +223,7 @@ else user << "You need two lengths of cable to fix this mech!" return - else if(istype(W, /obj/item/weapon/screwdriver)) + else if(istype(W, /obj/item/weapon/screwdriver) && user.a_intent != "harm") if(internal_damage & MECHA_INT_TEMP_CONTROL) clearInternalDamage(MECHA_INT_TEMP_CONTROL) user << "You repair the damaged temperature controller." @@ -278,22 +278,25 @@ W.forceMove(src) user.visible_message("[user] attaches [W] to [src].", "You attach [W] to [src].") return + else + return ..() - else if(!(W.flags&NOBLUDGEON)) - user.changeNext_move(CLICK_CD_MELEE) // Ugh. Ideally we shouldn't be setting cooldowns outside of click code. - user.do_attack_animation(src) - log_message("Attacked by [W]. Attacker - [user]") - var/deflection = 1 - var/dam_coeff = 1 - for(var/obj/item/mecha_parts/mecha_equipment/anticcw_armor_booster/B in equipment) - if(B.attack_react(user)) - deflection *= B.deflect_coeff - dam_coeff *= B.damage_coeff - break - user.visible_message("[user] hits [src] with [W].", "You hit [src] with [W].") - take_damage(round(W.force*dam_coeff),W.damtype, user.dir, deflection, dam_coeff) +/obj/mecha/attacked_by(obj/item/I, mob/living/user) + log_message("Attacked by [I]. Attacker - [user]") + var/deflection = deflect_chance + var/dam_coeff = 1 + for(var/obj/item/mecha_parts/mecha_equipment/anticcw_armor_booster/B in equipment) + if(B.attack_react(user)) + deflection *= B.deflect_coeff + dam_coeff *= B.damage_coeff + break + if(prob(deflection)) + user << "\The [I.name] bounces off [name]'s armor." + log_append_to_last("Armor saved.") + else + user.visible_message("[user] hits [src] with [I].", "You hit [src] with [I].") + take_damage(round(I.force*dam_coeff),I.damtype) check_for_internal_damage(list(MECHA_INT_TEMP_CONTROL,MECHA_INT_TANK_BREACH,MECHA_INT_CONTROL_LOST)) - return 1 /obj/mecha/proc/mech_toxin_damage(mob/living/target) diff --git a/code/game/objects/effects/aliens.dm b/code/game/objects/effects/aliens.dm index cc816f1d8f1..21ae2c75996 100644 --- a/code/game/objects/effects/aliens.dm +++ b/code/game/objects/effects/aliens.dm @@ -9,6 +9,40 @@ /obj/structure/alien icon = 'icons/mob/alien.dmi' + var/health = 100 + +/obj/structure/alien/attacked_by(obj/item/I, mob/user) + ..() + var/damage = I.force + switch(I.damtype) + if(BRUTE) + damage *= 0.25 + if(BURN) + damage *= 2 + else + damage = 0 //stamina damage does no damage + take_damage(damage, I.damtype) + +/obj/structure/alien/proc/take_damage(amount, damage_type = BRUTE, sound_effect = 1) + switch(damage_type) + if(BRUTE) + if(sound_effect) + playsound(loc, 'sound/effects/attackblob.ogg', 100, 1) + if(BURN) + if(sound_effect) + playsound(loc, 'sound/items/Welder.ogg', 100, 1) + else + return + health = max(health - amount, 0) + if(!health) + Break() + +/obj/structure/alien/proc/Break() + qdel(src) + +/obj/structure/alien/bullet_act(obj/item/projectile/P) + . = ..() + take_damage(P.damage, P.damage_type) /* * Resin @@ -22,9 +56,10 @@ opacity = 1 anchored = 1 canSmoothWith = list(/obj/structure/alien/resin) - var/health = 200 - var/resintype = null + health = 200 smooth = SMOOTH_TRUE + var/resintype = null + /obj/structure/alien/resin/New(location) @@ -66,32 +101,17 @@ resintype = "membrane" canSmoothWith = list(/obj/structure/alien/resin/wall, /obj/structure/alien/resin/membrane) -/obj/structure/alien/resin/proc/healthcheck() - if(health <=0) - qdel(src) - - -/obj/structure/alien/resin/bullet_act(obj/item/projectile/Proj) - health -= Proj.damage - ..() - healthcheck() - - /obj/structure/alien/resin/ex_act(severity, target) switch(severity) if(1) - health -= 150 + take_damage(150, BRUTE, 0) if(2) - health -= 100 + take_damage(100, BRUTE, 0) if(3) - health -= 50 - healthcheck() - - -/obj/structure/alien/resin/blob_act() - health -= 50 - healthcheck() + take_damage(50, BRUTE, 0) +/obj/structure/alien/blob_act() + take_damage(50, BRUTE, 0) /obj/structure/alien/resin/hitby(atom/movable/AM) ..() @@ -101,16 +121,12 @@ else var/obj/O = AM tforce = O.throwforce - playsound(loc, 'sound/effects/attackblob.ogg', 100, 1) - health -= tforce - healthcheck() + take_damage(tforce) /obj/structure/alien/resin/attack_hulk(mob/living/carbon/human/user) ..(user, 1) - user.do_attack_animation(src) user.visible_message("[user] destroys [src]!") - health = 0 - healthcheck() + take_damage(200) /obj/structure/alien/resin/attack_paw(mob/user) return attack_hand(user) @@ -119,23 +135,16 @@ /obj/structure/alien/resin/attack_alien(mob/living/user) user.changeNext_move(CLICK_CD_MELEE) user.do_attack_animation(src) - if(islarva(user)) - return user.visible_message("[user] claws at the resin!") - playsound(loc, 'sound/effects/attackblob.ogg', 100, 1) - health -= 50 - if(health <= 0) - user.visible_message("[user] slices the [name] apart!") - healthcheck() - - -/obj/structure/alien/resin/attackby(obj/item/I, mob/living/user, params) - user.changeNext_move(CLICK_CD_MELEE) - health -= I.force - playsound(loc, 'sound/effects/attackblob.ogg', 100, 1) - healthcheck() - ..() + take_damage(50) +/obj/structure/alien/resin/attack_animal(mob/living/simple_animal/M) + M.changeNext_move(CLICK_CD_MELEE) + M.do_attack_animation(src) + if(M.melee_damage_upper == 0 || (M.melee_damage_type != BRUTE && M.melee_damage_type != BURN)) + return + visible_message("[M] [M.attacktext] [src]!") + take_damage(M.melee_damage_upper, M.melee_damage_type) /obj/structure/alien/resin/CanPass(atom/movable/mover, turf/target, height=0) return !density @@ -155,7 +164,7 @@ density = 0 layer = TURF_LAYER + 0.09 icon_state = "weeds" - var/health = 15 + health = 15 var/obj/structure/alien/weeds/node/linked_node = null canSmoothWith = list(/obj/structure/alien/weeds, /turf/closed/wall) smooth = SMOOTH_MORE @@ -208,33 +217,9 @@ qdel(src) -/obj/structure/alien/weeds/attackby(obj/item/I, mob/user, params) - user.changeNext_move(CLICK_CD_MELEE) - if(I.attack_verb.len) - visible_message("[user] has [pick(I.attack_verb)] [src] with [I]!") - else - visible_message("[user] has attacked [src] with [I]!") - - var/damage = I.force / 4 - if(istype(I, /obj/item/weapon/weldingtool)) - var/obj/item/weapon/weldingtool/WT = I - if(WT.remove_fuel(0, user)) - damage = 15 - playsound(loc, 'sound/items/Welder.ogg', 100, 1) - - health -= damage - healthcheck() - - -/obj/structure/alien/weeds/proc/healthcheck() - if(health <= 0) - qdel(src) - - /obj/structure/alien/weeds/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume) if(exposed_temperature > 300) - health -= 5 - healthcheck() + take_damage(5, BURN, 0) //Weed nodes @@ -271,7 +256,7 @@ icon_state = "egg_growing" density = 0 anchored = 1 - var/health = 100 + health = 100 var/status = GROWING //can be GROWING, GROWN or BURST; all mutually exclusive layer = MOB_LAYER @@ -340,43 +325,16 @@ remove_from_proximity_list(src, 1) ..() -/obj/structure/alien/egg/bullet_act(obj/item/projectile/Proj) - health -= Proj.damage - ..() - healthcheck() - - -/obj/structure/alien/egg/attackby(obj/item/I, mob/user, params) - if(I.attack_verb.len) - visible_message("[user] has [pick(I.attack_verb)] [src] with [I]!") - else - visible_message("[user] has attacked [src] with [I]!") - - var/damage = I.force / 4 - if(istype(I, /obj/item/weapon/weldingtool)) - var/obj/item/weapon/weldingtool/WT = I - - if(WT.remove_fuel(0, user)) - damage = 15 - playsound(loc, 'sound/items/Welder.ogg', 100, 1) - - health -= damage - user.changeNext_move(CLICK_CD_MELEE) - healthcheck() - - -/obj/structure/alien/egg/proc/healthcheck() - if(health <= 0) - if(status != BURST && status != BURSTING) - Burst() - else if(status == BURST && prob(50)) - qdel(src) //Remove the egg after it has been hit after bursting. +/obj/structure/alien/egg/Break() + if(status != BURST && status != BURSTING) + Burst() + else if(status == BURST) + qdel(src) //Remove the egg after it has been hit after bursting. /obj/structure/alien/egg/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume) if(exposed_temperature > 500) - health -= 5 - healthcheck() + take_damage(5, BURN, 0) /obj/structure/alien/egg/HasProximity(atom/movable/AM) diff --git a/code/game/objects/effects/spiders.dm b/code/game/objects/effects/spiders.dm index 528ccafa5b9..b8d0a99bba9 100644 --- a/code/game/objects/effects/spiders.dm +++ b/code/game/objects/effects/spiders.dm @@ -19,37 +19,32 @@ qdel(src) return -/obj/effect/spider/attackby(obj/item/weapon/W, mob/user, params) - if(W.attack_verb.len) - visible_message("[user] has [pick(W.attack_verb)] \the [src] with \the [W]!") - else - visible_message("[user] has attacked \the [src] with \the [W]!") - - var/damage = W.force / 4 - - if(istype(W, /obj/item/weapon/weldingtool)) - var/obj/item/weapon/weldingtool/WT = W - - if(WT.remove_fuel(0, user)) - damage = 15 - playsound(loc, 'sound/items/Welder.ogg', 100, 1) - - health -= damage - healthcheck() - -/obj/effect/spider/bullet_act(obj/item/projectile/Proj) +/obj/effect/spider/attacked_by(obj/item/I, mob/user) ..() - health -= Proj.damage - healthcheck() + var/damage = I.force + take_damage(damage, I.damtype, 1) -/obj/effect/spider/proc/healthcheck() +/obj/effect/spider/bullet_act(obj/item/projectile/P) + . = ..() + take_damage(P.damage, P.damage_type, 0) + +/obj/effect/spider/proc/take_damage(damage, damage_type = BRUTE, sound_effect = 1) + switch(damage_type) + if(BURN) + damage *= 2 + if(sound_effect) + playsound(loc, 'sound/items/Welder.ogg', 100, 1) + if(BRUTE)//the stickiness of the web mutes all attack sounds except fire damage type + damage *= 0.25 + else + return + health -= damage if(health <= 0) qdel(src) /obj/effect/spider/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume) if(exposed_temperature > 300) - health -= 5 - healthcheck() + take_damage(5, BURN, 0) /obj/effect/spider/stickyweb icon_state = "stickyweb1" @@ -125,14 +120,6 @@ else ..() -/obj/effect/spider/spiderling/proc/die() - visible_message("[src] dies!") - qdel(src) - -/obj/effect/spider/spiderling/healthcheck() - if(health <= 0) - die() - /obj/effect/spider/spiderling/process() if(travelling_in_vent) if(istype(src.loc, /turf)) diff --git a/code/game/objects/items/devices/PDA/PDA.dm b/code/game/objects/items/devices/PDA/PDA.dm index 33760586938..ebd6e3d05c1 100644 --- a/code/game/objects/items/devices/PDA/PDA.dm +++ b/code/game/objects/items/devices/PDA/PDA.dm @@ -10,6 +10,7 @@ var/global/list/obj/item/device/pda/PDAs = list() icon = 'icons/obj/pda.dmi' icon_state = "pda" item_state = "electronic" + flags = NOBLUDGEON //phil235 test it w_class = 1 slot_flags = SLOT_ID | SLOT_BELT origin_tech = "programming=2" @@ -728,7 +729,6 @@ var/global/list/obj/item/device/pda/PDAs = list() // access to status display signals /obj/item/device/pda/attackby(obj/item/C, mob/user, params) - ..() if(istype(C, /obj/item/weapon/cartridge) && !cartridge) cartridge = C if(!user.unEquip(C)) @@ -777,7 +777,8 @@ var/global/list/obj/item/device/pda/PDAs = list() var/obj/item/weapon/photo/P = C photo = P.img user << "You scan \the [C]." - return + else + return ..() /obj/item/device/pda/attack(mob/living/carbon/C, mob/living/user) if(istype(C)) @@ -821,23 +822,26 @@ var/global/list/obj/item/device/pda/PDAs = list() var/obj/item/weapon/tank/T = A atmosanalyzer_scan(T.air_contents, user, T) else if (istype(A, /obj/machinery/portable_atmospherics)) - var/obj/machinery/portable_atmospherics/T = A - atmosanalyzer_scan(T.air_contents, user, T) + var/obj/machinery/portable_atmospherics/PA = A + atmosanalyzer_scan(PA.air_contents, user, PA) else if (istype(A, /obj/machinery/atmospherics/pipe)) - var/obj/machinery/atmospherics/pipe/T = A - atmosanalyzer_scan(T.parent.air, user, T) + var/obj/machinery/atmospherics/pipe/P = A + atmosanalyzer_scan(P.parent.air, user, P) else if (istype(A, /obj/machinery/power/rad_collector)) - var/obj/machinery/power/rad_collector/T = A - if(T.P) atmosanalyzer_scan(T.P.air_contents, user, T) + var/obj/machinery/power/rad_collector/RC = A + if(RC.loaded_tank) + atmosanalyzer_scan(RC.loaded_tank.air_contents, user, RC) else if (istype(A, /obj/item/weapon/flamethrower)) - var/obj/item/weapon/flamethrower/T = A - if(T.ptank) atmosanalyzer_scan(T.ptank.air_contents, user, T) + var/obj/item/weapon/flamethrower/F = A + if(F.ptank) + atmosanalyzer_scan(F.ptank.air_contents, user, F) if (!scanmode && istype(A, /obj/item/weapon/paper) && owner) - if (!A:info) + var/obj/item/weapon/paper/PP = A + if (!PP.info) user << "Unable to scan! Paper is blank." return - notehtml = A:info + notehtml = PP.info note = replacetext(notehtml, "
", "\[br\]") note = replacetext(note, "
  • ", "\[*\]") note = replacetext(note, "
      ", "\[list\]") diff --git a/code/game/objects/items/devices/laserpointer.dm b/code/game/objects/items/devices/laserpointer.dm index a5a5e2f5d0b..6ec1518cd18 100644 --- a/code/game/objects/items/devices/laserpointer.dm +++ b/code/game/objects/items/devices/laserpointer.dm @@ -5,7 +5,7 @@ icon_state = "pointer" item_state = "pen" var/pointer_icon_state - flags = CONDUCT + flags = CONDUCT | NOBLUDGEON slot_flags = SLOT_BELT materials = list(MAT_METAL=500, MAT_GLASS=500) w_class = 2 //Increased to 2, because diodes are w_class 2. Conservation of matter. @@ -38,11 +38,6 @@ ..() diode = new /obj/item/weapon/stock_parts/micro_laser/ultra - - -/obj/item/device/laser_pointer/attack(mob/living/M, mob/user) - laser_act(M, user) - /obj/item/device/laser_pointer/attackby(obj/item/W, mob/user, params) if(istype(W, /obj/item/weapon/stock_parts/micro_laser)) if(!diode) @@ -53,20 +48,16 @@ user << "You install a [diode.name] in [src]." else user << "[src] already has a diode installed." - return else if(istype(W, /obj/item/weapon/screwdriver)) if(diode) user << "You remove the [diode.name] from \the [src]." diode.loc = get_turf(src.loc) diode = null - return - ..() - return + else + return ..() /obj/item/device/laser_pointer/afterattack(atom/target, mob/living/user, flag, params) - if(flag) //we're placing the object on a table or in backpack - return laser_act(target, user, params) /obj/item/device/laser_pointer/proc/laser_act(atom/target, mob/living/user, params) @@ -165,7 +156,7 @@ recharging = 1 SSobj.processing |= src if(energy <= 0) - user << "The [src]'s battery is overused, it needs time to recharge!" + user << "[src]'s battery is overused, it needs time to recharge!" recharge_locked = 1 flick_overlay(I, showto, 10) diff --git a/code/game/objects/items/robot/robot_parts.dm b/code/game/objects/items/robot/robot_parts.dm index d33c5a274e2..3be12d0b94f 100644 --- a/code/game/objects/items/robot/robot_parts.dm +++ b/code/game/objects/items/robot/robot_parts.dm @@ -86,21 +86,22 @@ return 0 /obj/item/robot_parts/robot_suit/attackby(obj/item/W, mob/user, params) - ..() - if(istype(W, /obj/item/stack/sheet/metal) && !l_arm && !r_arm && !l_leg && !r_leg && !chest && !head) + + if(istype(W, /obj/item/stack/sheet/metal)) var/obj/item/stack/sheet/metal/M = W - if (M.use(1)) - var/obj/item/weapon/ed209_assembly/B = new /obj/item/weapon/ed209_assembly - B.loc = get_turf(src) - user << "You arm the robot frame." - if (user.get_inactive_hand()==src) - user.unEquip(src) - user.put_in_inactive_hand(B) - qdel(src) - else - user << "You need one sheet of metal to start building ED-209!" - return - if(istype(W, /obj/item/robot_parts/l_leg)) + if(!l_arm && !r_arm && !l_leg && !r_leg && !chest && !head) + if (M.use(1)) + var/obj/item/weapon/ed209_assembly/B = new /obj/item/weapon/ed209_assembly + B.loc = get_turf(src) + user << "You arm the robot frame." + if (user.get_inactive_hand()==src) + user.unEquip(src) + user.put_in_inactive_hand(B) + qdel(src) + else + user << "You need one sheet of metal to start building ED-209!" + return + else if(istype(W, /obj/item/robot_parts/l_leg)) if(src.l_leg) return if(!user.unEquip(W)) @@ -109,7 +110,7 @@ src.l_leg = W src.updateicon() - if(istype(W, /obj/item/robot_parts/r_leg)) + else if(istype(W, /obj/item/robot_parts/r_leg)) if(src.r_leg) return if(!user.unEquip(W)) @@ -118,7 +119,7 @@ src.r_leg = W src.updateicon() - if(istype(W, /obj/item/robot_parts/l_arm)) + else if(istype(W, /obj/item/robot_parts/l_arm)) if(src.l_arm) return if(!user.unEquip(W)) @@ -127,7 +128,7 @@ src.l_arm = W src.updateicon() - if(istype(W, /obj/item/robot_parts/r_arm)) + else if(istype(W, /obj/item/robot_parts/r_arm)) if(src.r_arm) return if(!user.unEquip(W)) @@ -136,7 +137,7 @@ src.r_arm = W src.updateicon() - if(istype(W, /obj/item/robot_parts/chest)) + else if(istype(W, /obj/item/robot_parts/chest)) if(src.chest) return if(W:wired && W:cell) @@ -150,7 +151,7 @@ else user << "You need to attach a cell to it first!" - if(istype(W, /obj/item/robot_parts/head)) + else if(istype(W, /obj/item/robot_parts/head)) if(src.head) return if(W:flash2 && W:flash1) @@ -162,13 +163,13 @@ else user << "You need to attach a flash to it first!" - if (istype(W, /obj/item/device/multitool)) + else if (istype(W, /obj/item/device/multitool)) if(check_completion()) Interact(user) else user << "The endoskeleton must be assembled before debugging can begin!" - if(istype(W, /obj/item/device/mmi)) + else if(istype(W, /obj/item/device/mmi)) var/obj/item/device/mmi/M = W if(check_completion()) if(!istype(loc,/turf)) @@ -254,9 +255,10 @@ else user << "The MMI must go in after everything else!" - if(istype(W,/obj/item/weapon/pen)) + else if(istype(W,/obj/item/weapon/pen)) user << "You need to use a multitool to name [src]!" - return + else + return ..() /obj/item/robot_parts/robot_suit/proc/Interact(mob/user) var/t1 = text("Designation: [(created_name ? "[created_name]" : "Default Cyborg")]
      \n",src) @@ -308,7 +310,6 @@ return /obj/item/robot_parts/chest/attackby(obj/item/W, mob/user, params) - ..() if(istype(W, /obj/item/weapon/stock_parts/cell)) if(src.cell) user << "You have already inserted a cell!" @@ -319,7 +320,7 @@ W.loc = src src.cell = W user << "You insert the cell." - if(istype(W, /obj/item/stack/cable_coil)) + else if(istype(W, /obj/item/stack/cable_coil)) if(src.wired) user << "You have already inserted wire!" return @@ -329,10 +330,10 @@ user << "You insert the wire." else user << "You need one length of coil to wire it!" - return + else + return ..() /obj/item/robot_parts/head/attackby(obj/item/W, mob/user, params) - ..() if(istype(W, /obj/item/device/assembly/flash/handheld)) var/obj/item/device/assembly/flash/handheld/F = W if(src.flash1 && src.flash2) @@ -350,5 +351,6 @@ else src.flash1 = F user << "You insert the flash into the eye socket." - return + else + return ..() diff --git a/code/game/objects/items/toys.dm b/code/game/objects/items/toys.dm index 1a4cea9c3b1..3b13f07ac98 100755 --- a/code/game/objects/items/toys.dm +++ b/code/game/objects/items/toys.dm @@ -60,28 +60,40 @@ desc = "A translucent balloon with some form of liquid sloshing around in it." update_icon() -/obj/item/toy/balloon/attackby(obj/O, mob/user, params) - if(istype(O, /obj/item/weapon/reagent_containers/glass)) - if(O.reagents) - if(O.reagents.total_volume <= 0) - user << "[O] is empty." +/obj/item/toy/balloon/attackby(obj/item/I, mob/user, params) + if(istype(I, /obj/item/weapon/reagent_containers/glass)) + if(I.reagents) + if(I.reagents.total_volume <= 0) + user << "[I] is empty." else if(reagents.total_volume >= 10) user << "[src] is full." else desc = "A translucent balloon with some form of liquid sloshing around in it." - user << "You fill the balloon with the contents of [O]." - O.reagents.trans_to(src, 10) + user << "You fill the balloon with the contents of [I]." + I.reagents.trans_to(src, 10) update_icon() + else if(is_sharp(I)) + balloon_burst() + else + return ..() /obj/item/toy/balloon/throw_impact(atom/hit_atom) if(!..()) //was it caught by a mob? - if(reagents.total_volume >= 1) - visible_message("[src] bursts!","You hear a pop and a splash.") - reagents.reaction(get_turf(hit_atom)) - for(var/atom/A in get_turf(hit_atom)) - reagents.reaction(A) - icon_state = "burst" - qdel(src) + balloon_burst(hit_atom) + +/obj/item/toy/balloon/proc/balloon_burst(atom/AT) + if(reagents.total_volume >= 1) + var/turf/T + if(AT) + T = get_turf(AT) + else + T = get_turf(src) + T.visible_message("[src] bursts!","You hear a pop and a splash.") + reagents.reaction(T) + for(var/atom/A in T) + reagents.reaction(A) + icon_state = "burst" + qdel(src) /obj/item/toy/balloon/update_icon() if(src.reagents.total_volume >= 1) @@ -136,7 +148,7 @@ /obj/item/toy/gun/attackby(obj/item/toy/ammo/gun/A, mob/user, params) - if (istype(A, /obj/item/toy/ammo/gun)) + if(istype(A, /obj/item/toy/ammo/gun)) if (src.bullets >= 7) user << "It's already fully loaded!" return 1 @@ -153,7 +165,8 @@ src.bullets = 7 A.update_icon() return 1 - return + else + return ..() /obj/item/toy/gun/afterattack(atom/target as mob|obj|turf|area, mob/user, flag) if (flag) @@ -221,11 +234,9 @@ item_state = "sword0" w_class = 2 add_fingerprint(user) - return // Copied from /obj/item/weapon/melee/energy/sword/attackby /obj/item/toy/sword/attackby(obj/item/weapon/W, mob/living/user, params) - ..() if(istype(W, /obj/item/toy/sword)) if(W == src) user << "You try to attach the end of the plastic sword to... itself. You're not very smart, are you?" @@ -259,6 +270,8 @@ user.update_inv_l_hand(0) else user << "It's already fabulous!" + else + return ..() /* * Foam armblade @@ -816,44 +829,43 @@ user.visible_message("[user] shuffles the deck.", "You shuffle the deck.") cooldown = world.time -/obj/item/toy/cards/deck/attackby(obj/item/toy/cards/singlecard/C, mob/living/user, params) - ..() - if(istype(C)) - if(C.parentdeck == src) - if(!user.unEquip(C)) +/obj/item/toy/cards/deck/attackby(obj/item/I, mob/living/user, params) + if(istype(I, /obj/item/toy/cards/singlecard)) + var/obj/item/toy/cards/singlecard/SC = I + if(SC.parentdeck == src) + if(!user.unEquip(SC)) user << "The card is stuck to your hand, you can't add it to the deck!" return - src.cards += C.cardname + cards += SC.cardname user.visible_message("[user] adds a card to the bottom of the deck.","You add the card to the bottom of the deck.") - qdel(C) + qdel(SC) else user << "You can't mix cards from other decks!" if(cards.len > 26) - src.icon_state = "deck_[deckstyle]_full" + icon_state = "deck_[deckstyle]_full" else if(cards.len > 10) - src.icon_state = "deck_[deckstyle]_half" + icon_state = "deck_[deckstyle]_half" else if(cards.len > 1) - src.icon_state = "deck_[deckstyle]_low" - - -/obj/item/toy/cards/deck/attackby(obj/item/toy/cards/cardhand/C, mob/living/user, params) - ..() - if(istype(C)) - if(C.parentdeck == src) - if(!user.unEquip(C)) + icon_state = "deck_[deckstyle]_low" + else if(istype(I, /obj/item/toy/cards/cardhand)) + var/obj/item/toy/cards/cardhand/CH = I + if(CH.parentdeck == src) + if(!user.unEquip(CH)) user << "The hand of cards is stuck to your hand, you can't add it to the deck!" return - src.cards += C.currenthand + cards += CH.currenthand user.visible_message("[user] puts their hand of cards in the deck.", "You put the hand of cards in the deck.") - qdel(C) + qdel(CH) else user << "You can't mix cards from other decks!" if(cards.len > 26) - src.icon_state = "deck_[deckstyle]_full" + icon_state = "deck_[deckstyle]_full" else if(cards.len > 10) - src.icon_state = "deck_[deckstyle]_half" + icon_state = "deck_[deckstyle]_half" else if(cards.len > 1) - src.icon_state = "deck_[deckstyle]_low" + icon_state = "deck_[deckstyle]_low" + else + return ..() /obj/item/toy/cards/deck/MouseDrop(atom/over_object) var/mob/M = usr @@ -960,6 +972,8 @@ qdel(C) else user << "You can't mix cards from other decks!" + else + return ..() /obj/item/toy/cards/cardhand/apply_card_vars(obj/item/toy/cards/newobj,obj/item/toy/cards/sourceobj) ..() @@ -1049,7 +1063,8 @@ qdel(src) else user << "You can't mix cards from other decks!" - + else + return ..() /obj/item/toy/cards/singlecard/attack_self(mob/user) if(usr.stat || !ishuman(usr) || !usr.canmove || usr.restrained()) diff --git a/code/game/objects/items/weapons/RSF.dm b/code/game/objects/items/weapons/RSF.dm index 8b34ab841b5..38ba595e717 100644 --- a/code/game/objects/items/weapons/RSF.dm +++ b/code/game/objects/items/weapons/RSF.dm @@ -11,6 +11,7 @@ RSF opacity = 0 density = 0 anchored = 0 + flags = NOBLUDGEON var/matter = 0 var/mode = 1 w_class = 3 @@ -20,8 +21,7 @@ RSF return /obj/item/weapon/rsf/attackby(obj/item/weapon/W, mob/user, params) - ..() - if (istype(W, /obj/item/weapon/rcd_ammo)) + if(istype(W, /obj/item/weapon/rcd_ammo)) if ((matter + 10) > 30) user << "The RSF can't hold any more matter." return @@ -30,7 +30,8 @@ RSF playsound(src.loc, 'sound/machines/click.ogg', 10, 1) user << "The RSF now holds [matter]/30 fabrication-units." desc = "A RSF. It currently holds [matter]/30 fabrication-units." - return + else + return ..() /obj/item/weapon/rsf/attack_self(mob/user) playsound(src.loc, 'sound/effects/pop.ogg', 50, 0) @@ -60,175 +61,53 @@ RSF return // Change mode -/obj/item/weapon/rsf/afterattack(atom/A, mob/user, proximity) +/obj/item/weapon/rsf/afterattack(atom/A, mob/user, proximity) //phil235 shitty proc, rewrite. if(!proximity) return if (!(istype(A, /obj/structure/table) || istype(A, /turf/open/floor))) return - if (istype(A, /obj/structure/table) && mode == 1) - if (istype(A, /obj/structure/table) && matter >= 1) + if(matter < 1) + user << "\The [src] doesn't have enough matter left." + return + if(isrobot(user)) + var/mob/living/silicon/robot/R = user + if(!R.cell || R.cell.charge < 200) + user << "You do not have enough power to use [src]." + return + + var/turf/T = get_turf(A) + playsound(src.loc, 'sound/machines/click.ogg', 10, 1) + switch(mode) + if(1) user << "Dispensing Dosh..." - playsound(src.loc, 'sound/machines/click.ogg', 10, 1) - new /obj/item/stack/spacecash/c10( A.loc ) - if (isrobot(user)) - var/mob/living/silicon/robot/engy = user - engy.cell.charge -= 200 //once money becomes useful, I guess changing this to a high ammount, like 500 units a kick, till then, enjoy dosh! - else - matter-- - user << "The RSF now holds [matter]/30 fabrication-units." - desc = "A RSF. It currently holds [matter]/30 fabrication-units." - return - - else if (istype(A, /turf/open/floor) && mode == 1) - if (istype(A, /turf/open/floor) && matter >= 1) - user << "Dispensing Dosh..." - playsound(src.loc, 'sound/machines/click.ogg', 10, 1) - new /obj/item/stack/spacecash/c10( A ) - if (isrobot(user)) - var/mob/living/silicon/robot/engy = user - engy.cell.charge -= 200 //once money becomes useful, I guess changing this to a high ammount, like 500 units a kick, till then, enjoy dosh! - else - matter-- - user << "The RSF now holds [matter]/30 fabrication-units." - desc = "A RSF. It currently holds [matter]/30 fabrication-units." - return - - else if (istype(A, /obj/structure/table) && mode == 2) - if (istype(A, /obj/structure/table) && matter >= 1) + new /obj/item/stack/spacecash/c10(T) + use_matter(200, user) + if(2) user << "Dispensing Drinking Glass..." - playsound(src.loc, 'sound/machines/click.ogg', 10, 1) - new /obj/item/weapon/reagent_containers/food/drinks/drinkingglass( A.loc ) - if (isrobot(user)) - var/mob/living/silicon/robot/engy = user - engy.cell.charge -= 50 - else - matter-- - user << "The RSF now holds [matter]/30 fabrication-units." - desc = "A RSF. It currently holds [matter]/30 fabrication-units." - return - - else if (istype(A, /turf/open/floor) && mode == 2) - if (istype(A, /turf/open/floor) && matter >= 1) - user << "Dispensing Drinking Glass..." - playsound(src.loc, 'sound/machines/click.ogg', 10, 1) - new /obj/item/weapon/reagent_containers/food/drinks/drinkingglass( A ) - if (isrobot(user)) - var/mob/living/silicon/robot/engy = user - engy.cell.charge -= 50 - else - matter-- - user << "The RSF now holds [matter]/30 fabrication-units." - desc = "A RSF. It currently holds [matter]/30 fabrication-units." - return - - else if (istype(A, /obj/structure/table) && mode == 3) - if (istype(A, /obj/structure/table) && matter >= 1) + new /obj/item/weapon/reagent_containers/food/drinks/drinkingglass(T) + use_matter(20, user) + if(3) user << "Dispensing Paper Sheet..." - playsound(src.loc, 'sound/machines/click.ogg', 10, 1) - new /obj/item/weapon/paper( A.loc ) - if (isrobot(user)) - var/mob/living/silicon/robot/engy = user - engy.cell.charge -= 10 - else - matter-- - user << "The RSF now holds [matter]/30 fabrication-units." - desc = "A RSF. It currently holds [matter]/30 fabrication-units." - return - - else if (istype(A, /turf/open/floor) && mode == 3) - if (istype(A, /turf/open/floor) && matter >= 1) - user << "Dispensing Paper Sheet..." - playsound(src.loc, 'sound/machines/click.ogg', 10, 1) - new /obj/item/weapon/paper( A ) - if (isrobot(user)) - var/mob/living/silicon/robot/engy = user - engy.cell.charge -= 10 - else - matter-- - user << "The RSF now holds [matter]/30 fabrication-units." - desc = "A RSF. It currently holds [matter]/30 fabrication-units." - return - - else if (istype(A, /obj/structure/table) && mode == 4) - if (istype(A, /obj/structure/table) && matter >= 1) + new /obj/item/weapon/paper(T) + use_matter(10, user) + if(4) user << "Dispensing Pen..." - playsound(src.loc, 'sound/machines/click.ogg', 10, 1) - new /obj/item/weapon/pen( A.loc ) - if (isrobot(user)) - var/mob/living/silicon/robot/engy = user - engy.cell.charge -= 50 - else - matter-- - user << "The RSF now holds [matter]/30 fabrication-units." - desc = "A RSF. It currently holds [matter]/30 fabrication-units." - return - - else if (istype(A, /turf/open/floor) && mode == 4) - if (istype(A, /turf/open/floor) && matter >= 1) - user << "Dispensing Pen..." - playsound(src.loc, 'sound/machines/click.ogg', 10, 1) - new /obj/item/weapon/pen( A ) - if (isrobot(user)) - var/mob/living/silicon/robot/engy = user - engy.cell.charge -= 50 - else - matter-- - user << "The RSF now holds [matter]/30 fabrication-units." - desc = "A RSF. It currently holds [matter]/30 fabrication-units." - return - - else if (istype(A, /obj/structure/table) && mode == 5) - if (istype(A, /obj/structure/table) && matter >= 1) + new /obj/item/weapon/pen(T) + use_matter(50, user) + if(5) user << "Dispensing Dice Pack..." - playsound(src.loc, 'sound/machines/click.ogg', 10, 1) - new /obj/item/weapon/storage/pill_bottle/dice( A.loc ) - if (isrobot(user)) - var/mob/living/silicon/robot/engy = user - engy.cell.charge -= 200 - else - matter-- - user << "The RSF now holds [matter]/30 fabrication-units." - desc = "A RSF. It currently holds [matter]/30 fabrication-units." - return - - else if (istype(A, /turf/open/floor) && mode == 5) - if (istype(A, /turf/open/floor) && matter >= 1) - user << "Dispensing Dice Pack..." - playsound(src.loc, 'sound/machines/click.ogg', 10, 1) - new /obj/item/weapon/storage/pill_bottle/dice( A ) - if (isrobot(user)) - var/mob/living/silicon/robot/engy = user - engy.cell.charge -= 200 - else - matter-- - user << "The RSF now holds [matter]/30 fabrication-units." - desc = "A RSF. It currently holds [matter]/30 fabrication-units." - return - - else if (istype(A, /obj/structure/table) && mode == 6) - if (istype(A, /obj/structure/table) && matter >= 1) + new /obj/item/weapon/storage/pill_bottle/dice(T) + use_matter(200, user) + if(6) user << "Dispensing Cigarette..." - playsound(src.loc, 'sound/machines/click.ogg', 10, 1) - new /obj/item/clothing/mask/cigarette( A.loc ) - if (isrobot(user)) - var/mob/living/silicon/robot/engy = user - engy.cell.charge -= 10 - else - matter-- - user << "The RSF now holds [matter]/30 fabrication-units." - desc = "A RSF. It currently holds [matter]/30 fabrication-units." - return + new /obj/item/clothing/mask/cigarette(T) + use_matter(10, user) - else if (istype(A, /turf/open/floor) && mode == 6) - if (istype(A, /turf/open/floor) && matter >= 1) - user << "Dispensing Cigarette..." - playsound(src.loc, 'sound/machines/click.ogg', 10, 1) - new /obj/item/clothing/mask/cigarette( A ) - if (isrobot(user)) - var/mob/living/silicon/robot/engy = user - engy.cell.charge -= 10 - else - matter-- - user << "The RSF now holds [matter]/30 fabrication-units." - desc = "A RSF. It currently holds [matter]/30 fabrication-units." - return \ No newline at end of file +/obj/item/weapon/rsf/proc/use_matter(charge, mob/user) + if (isrobot(user)) + var/mob/living/silicon/robot/R = user + R.cell.charge -= charge + else + matter-- + user << "The RSF now holds [matter]/30 fabrication-units." + desc = "A RSF. It currently holds [matter]/30 fabrication-units." \ No newline at end of file diff --git a/code/game/objects/items/weapons/holosign_creator.dm b/code/game/objects/items/weapons/holosign_creator.dm index e33bb121435..4c2288041bb 100644 --- a/code/game/objects/items/weapons/holosign_creator.dm +++ b/code/game/objects/items/weapons/holosign_creator.dm @@ -84,25 +84,23 @@ anchored = 1 var/holo_integrity = 1 -/obj/effect/overlay/holograph/attackby(obj/item/weapon/W, mob/user, params) - if(!W.force || (W.flags & (ABSTRACT|NOBLUDGEON))) - return - if(W.force >= 10) - take_damage(3, user) - else - take_damage(1, user) +/obj/effect/overlay/holograph/attacked_by(obj/item/I, mob/user) + ..() + take_damage(I.force * 0.5, I.damtype) /obj/effect/overlay/holograph/blob_act() qdel(src) /obj/effect/overlay/holograph/attack_animal(mob/living/simple_animal/M) - take_damage(5, M) + if(!M.melee_damage_upper) + return + attack_generic(5, M) /obj/effect/overlay/holograph/attack_alien(mob/living/carbon/alien/A) - take_damage(5, A) + attack_generic(5, A) /obj/effect/overlay/holograph/attack_hand(mob/living/user) - take_damage(1, user) + attack_generic(1, user) /obj/effect/overlay/holograph/mech_melee_attack(obj/mecha/M) playsound(loc, 'sound/weapons/Egloves.ogg', 80, 1) @@ -111,17 +109,28 @@ /obj/effect/overlay/holograph/attack_slime(mob/living/simple_animal/slime/S) if(S.is_adult) - take_damage(5, S) + attack_generic(5, S) else - take_damage(2, S) + attack_generic(2, S) -/obj/effect/overlay/holograph/proc/take_damage(amount, mob/living/user) +/obj/effect/overlay/holograph/proc/attack_generic(damage_amount, mob/user) user.changeNext_move(CLICK_CD_MELEE) user.do_attack_animation(src) - playsound(loc, 'sound/weapons/Egloves.ogg', 80, 1) user.visible_message("[user] hits [src].", \ "You hit [src]." ) - holo_integrity -= amount + take_damage(damage_amount) + +/obj/effect/overlay/holograph/proc/take_damage(damage, damage_type = BRUTE, sound_effect = 1) + switch(damage_type) + if(BRUTE) + if(damage && sound_effect) + playsound(loc, 'sound/weapons/Egloves.ogg', 80, 1) + if(BURN) + if(damage && sound_effect) + playsound(loc, 'sound/weapons/Egloves.ogg', 80, 1) + else + return + holo_integrity -= damage if(holo_integrity <= 0) qdel(src) @@ -133,16 +142,11 @@ else if(isobj(AM)) var/obj/item/I = AM tforce = max(1, I.throwforce * 0.2) - playsound(loc, 'sound/weapons/Egloves.ogg', 80, 1) - holo_integrity -= tforce - if(holo_integrity <= 0) - qdel(src) + take_damage(tforce) /obj/effect/overlay/holograph/bullet_act(obj/item/projectile/P) - if((P.damage_type == BRUTE || P.damage_type == BURN)) - holo_integrity -= P.damage * 0.5 - if(holo_integrity <= 0) - qdel(src) + . = ..() + take_damage(P.damage * 0.5, P.damage_type) /obj/effect/overlay/holograph/wetsign name = "wet floor sign" diff --git a/code/game/objects/items/weapons/pneumaticCannon.dm b/code/game/objects/items/weapons/pneumaticCannon.dm index a3fee8b4079..3937889f8c1 100644 --- a/code/game/objects/items/weapons/pneumaticCannon.dm +++ b/code/game/objects/items/weapons/pneumaticCannon.dm @@ -29,17 +29,16 @@ /obj/item/weapon/pneumatic_cannon/attackby(obj/item/weapon/W, mob/user, params) - ..() - if(istype(W, /obj/item/weapon/tank/internals/) && !tank) - if(istype(W, /obj/item/weapon/tank/internals/emergency_oxygen)) - user << "\The [W] is too small for \the [src]." - return - updateTank(W, 0, user) - return - if(W.type == type) + if(istype(W, /obj/item/weapon/tank/internals)) + if(!tank) + var/obj/item/weapon/tank/internals/IT = W + if(IT.volume <= 3) + user << "\The [IT] is too small for \the [src]." + return + updateTank(W, 0, user) + else if(W.type == type) user << "You're fairly certain that putting a pneumatic cannon inside another pneumatic cannon would cause a spacetime disruption." - return - if(istype(W, /obj/item/weapon/wrench)) + else if(istype(W, /obj/item/weapon/wrench)) switch(pressureSetting) if(1) pressureSetting = 2 @@ -48,14 +47,12 @@ if(3) pressureSetting = 1 user << "You tweak \the [src]'s pressure output to [pressureSetting]." - return - if(istype(W, /obj/item/weapon/screwdriver) && tank) - updateTank(tank, 1, user) - return - if(loadedWeightClass >= maxWeightClass) + else if(istype(W, /obj/item/weapon/screwdriver)) + if(tank) + updateTank(tank, 1, user) + else if(loadedWeightClass >= maxWeightClass) user << "\The [src] can't hold any more items!" - return - if(istype(W, /obj/item)) + else if(istype(W, /obj/item)) var/obj/item/IW = W if((loadedWeightClass + IW.w_class) > maxWeightClass) user << "\The [IW] won't fit into \the [src]!" @@ -69,18 +66,14 @@ loadedItems.Add(IW) loadedWeightClass += IW.w_class IW.loc = src - return + /obj/item/weapon/pneumatic_cannon/afterattack(atom/target, mob/living/carbon/human/user, flag, params) - if(istype(target, /obj/item/weapon/storage)) //So you can store it in backpacks - return ..() - if(istype(target, /obj/structure/closet)) //So you can store it in closets - return ..() - if(istype(target, /obj/structure/rack)) //So you can store it on racks - return ..() + if(flag && user.a_intent == "harm") //melee attack + return if(!istype(user)) - return ..() + return Fire(user, target) diff --git a/code/game/objects/structures/ai_core.dm b/code/game/objects/structures/ai_core.dm index 383a065041b..ef533fe16a1 100644 --- a/code/game/objects/structures/ai_core.dm +++ b/code/game/objects/structures/ai_core.dm @@ -20,6 +20,7 @@ user << "You wrench the frame into place." anchored = 1 state = 1 + return if(istype(P, /obj/item/weapon/weldingtool)) var/obj/item/weapon/weldingtool/WT = P if(!WT.isOn()) @@ -32,6 +33,7 @@ user << "You deconstruct the frame." new /obj/item/stack/sheet/plasteel( loc, 4) qdel(src) + return if(1) if(istype(P, /obj/item/weapon/wrench)) playsound(loc, 'sound/items/Ratchet.ogg', 50, 1) @@ -40,6 +42,7 @@ user << "You unfasten the frame." anchored = 0 state = 0 + return if(istype(P, /obj/item/weapon/circuitboard/aicore) && !circuit) if(!user.drop_item()) return @@ -48,11 +51,13 @@ icon_state = "1" circuit = P P.loc = src + return if(istype(P, /obj/item/weapon/screwdriver) && circuit) playsound(loc, 'sound/items/Screwdriver.ogg', 50, 1) user << "You screw the circuit board into place." state = 2 icon_state = "2" + return if(istype(P, /obj/item/weapon/crowbar) && circuit) playsound(loc, 'sound/items/Crowbar.ogg', 50, 1) user << "You remove the circuit board." @@ -60,12 +65,14 @@ icon_state = "0" circuit.loc = loc circuit = null + return if(2) if(istype(P, /obj/item/weapon/screwdriver) && circuit) playsound(loc, 'sound/items/Screwdriver.ogg', 50, 1) user << "You unfasten the circuit board." state = 1 icon_state = "1" + return if(istype(P, /obj/item/stack/cable_coil)) var/obj/item/stack/cable_coil/C = P if(C.get_amount() >= 5) @@ -79,7 +86,7 @@ icon_state = "3" else user << "You need five lengths of cable to wire the AI core!" - return + return if(3) if(istype(P, /obj/item/weapon/wirecutters)) if (brain) @@ -91,6 +98,7 @@ icon_state = "2" var/obj/item/stack/cable_coil/A = new /obj/item/stack/cable_coil( loc ) A.amount = 5 + return if(istype(P, /obj/item/stack/sheet/rglass)) var/obj/item/stack/sheet/rglass/G = P @@ -105,11 +113,12 @@ icon_state = "4" else user << "You need two sheets of reinforced glass to insert them into AI core!" - return + return if(istype(P, /obj/item/weapon/aiModule)) var/obj/item/weapon/aiModule/module = P module.install(laws, user) + return if(istype(P, /obj/item/device/mmi)) var/obj/item/device/mmi/M = P @@ -148,6 +157,7 @@ brain = M user << "Added a brain." icon_state = "3b" + return if(istype(P, /obj/item/weapon/crowbar) && brain) playsound(loc, 'sound/items/Crowbar.ogg', 50, 1) @@ -155,6 +165,7 @@ brain.loc = loc brain = null icon_state = "3" + return if(4) if(istype(P, /obj/item/weapon/crowbar)) @@ -176,6 +187,8 @@ new /mob/living/silicon/ai (loc, laws, brain) feedback_inc("cyborg_ais_created",1) qdel(src) + return + return ..() /obj/structure/AIcore/deactivated name = "inactive AI" @@ -187,7 +200,7 @@ /obj/structure/AIcore/deactivated/attackby(obj/item/A, mob/user, params) if(istype(A, /obj/item/device/aicard))//Is it? A.transfer_ai("INACTIVE","AICARD",src,user) - if(istype(A, /obj/item/weapon/wrench)) + else if(istype(A, /obj/item/weapon/wrench)) playsound(loc, 'sound/items/Ratchet.ogg', 50, 1) user.visible_message("[user] [anchored ? "fastens" : "unfastens"] [src].", \ "You start to [anchored ? "fasten [src] to" : "unfasten [src] from"] the floor...") @@ -200,7 +213,8 @@ if(do_after(user, 20, target = src)) user << "You unfasten the core." anchored = 0 - return + else + return ..() /* This is a good place for AI-related object verbs so I'm sticking it here. diff --git a/code/game/objects/structures/beds_chairs/alien_nest.dm b/code/game/objects/structures/beds_chairs/alien_nest.dm index 56f0ac6b166..c196e946244 100644 --- a/code/game/objects/structures/beds_chairs/alien_nest.dm +++ b/code/game/objects/structures/beds_chairs/alien_nest.dm @@ -10,6 +10,7 @@ can_be_unanchored = 0 canSmoothWith = null buildstacktype = null + flags = NODECONSTRUCT var/image/nest_overlay /obj/structure/bed/nest/New() @@ -80,15 +81,22 @@ M.layer = initial(M.layer) overlays -= nest_overlay -/obj/structure/bed/nest/attackby(obj/item/weapon/W, mob/user, params) - var/aforce = W.force - health = max(0, health - aforce) - playsound(loc, 'sound/effects/attackblob.ogg', 100, 1) - visible_message("[user] hits [src] with [W]!") - healthcheck() +/obj/structure/bed/nest/attacked_by(obj/item/I, mob/user) + ..() + take_damage(I.force, I.damtype) -/obj/structure/bed/nest/proc/healthcheck() +/obj/structure/bed/nest/proc/take_damage(damage, damage_type = BRUTE, sound_effect = 1) + switch(damage_type) + if(BRUTE) + if(sound_effect) + playsound(loc, 'sound/effects/attackblob.ogg', 100, 1) + if(BURN) + if(sound_effect) + playsound(loc, 'sound/items/Welder.ogg', 100, 1) + else + return + health -= damage if(health <=0) density = 0 qdel(src) - return + diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm index 3b70fd76585..a22be184b38 100644 --- a/code/game/objects/structures/crates_lockers/closets.dm +++ b/code/game/objects/structures/crates_lockers/closets.dm @@ -215,28 +215,30 @@ var/turf/T = get_turf(src) new material_drop(T) qdel(src) + return 0 else if(user.drop_item()) W.Move(loc) - else - if(istype(W, /obj/item/stack/packageWrap)) + return 1 + else if(istype(W, /obj/item/weapon/weldingtool) && can_weld_shut) + var/obj/item/weapon/weldingtool/WT = W + if(!WT.remove_fuel(0, user)) return - else if(istype(W, /obj/item/weapon/weldingtool) && can_weld_shut) - var/obj/item/weapon/weldingtool/WT = W - if(!WT.remove_fuel(0, user)) + user << "You begin [welded ? "unwelding":"welding"] \the [src]..." + playsound(loc, 'sound/items/Welder2.ogg', 40, 1) + if(do_after(user, 40/WT.toolspeed, 1, target = src)) + if(opened || !WT.isOn()) return - user << "You begin [welded ? "unwelding":"welding"] \the [src]..." - playsound(loc, 'sound/items/Welder2.ogg', 40, 1) - if(do_after(user, 40/WT.toolspeed, 1, target = src)) - if(opened || !WT.isOn()) - return - playsound(loc, 'sound/items/welder.ogg', 50, 1) - welded = !welded - visible_message("[user] [welded ? "welds shut" : "unweldeds"] \the [src].", - "You [welded ? "weld" : "unwelded"] \the [src] with \the [WT].", - "You hear welding.") - update_icon() - else - togglelock(user) + playsound(loc, 'sound/items/welder.ogg', 50, 1) + welded = !welded + visible_message("[user] [welded ? "welds shut" : "unweldeds"] \the [src].", + "You [welded ? "weld" : "unwelded"] \the [src] with \the [WT].", + "You hear welding.") + update_icon() + else if(user.a_intent != "harm" && !(W.flags & NOBLUDGEON)) + togglelock(user) + return 1 + else + return ..() /obj/structure/closet/MouseDrop_T(atom/movable/O, mob/living/user) if(!istype(O) || O.anchored || istype(O, /obj/screen)) diff --git a/code/game/objects/structures/crates_lockers/closets/secure/personal.dm b/code/game/objects/structures/crates_lockers/closets/secure/personal.dm index aa5e743cbc2..b0e80393e4a 100644 --- a/code/game/objects/structures/crates_lockers/closets/secure/personal.dm +++ b/code/game/objects/structures/crates_lockers/closets/secure/personal.dm @@ -35,27 +35,22 @@ new /obj/item/device/radio/headset( src ) /obj/structure/closet/secure_closet/personal/attackby(obj/item/W, mob/user, params) + var/obj/item/weapon/card/id/I = W.GetID() + if(istype(I)) + if(broken) + user << "It appears to be broken." + return + if(!I || !I.registered_name) + return + if(allowed(user) || !registered_name || (istype(I) && (registered_name == I.registered_name))) + //they can open all lockers, or nobody owns this, or they own this locker + locked = !locked + update_icon() - if(istype(W)) - var/obj/item/weapon/card/id/I = W.GetID() - if(istype(I)) - if(src.broken) - user << "It appears to be broken." - return - if(!I || !I.registered_name) - return - if(src.allowed(user) || !src.registered_name || (istype(I) && (src.registered_name == I.registered_name))) - //they can open all lockers, or nobody owns this, or they own this locker - src.locked = !( src.locked ) - update_icon() - - if(!src.registered_name) - src.registered_name = I.registered_name - src.desc = "Owned by [I.registered_name]." - else - user << "Access Denied." + if(!registered_name) + registered_name = I.registered_name + desc = "Owned by [I.registered_name]." else - ..() + user << "Access Denied." else - ..() - return \ No newline at end of file + return ..() \ No newline at end of file diff --git a/code/game/objects/structures/crates_lockers/closets/statue.dm b/code/game/objects/structures/crates_lockers/closets/statue.dm index 936ad5713f2..69c639694f2 100644 --- a/code/game/objects/structures/crates_lockers/closets/statue.dm +++ b/code/game/objects/structures/crates_lockers/closets/statue.dm @@ -114,27 +114,21 @@ /obj/structure/closet/statue/bullet_act(obj/item/projectile/Proj) health -= Proj.damage if(health <= 0) - for(var/mob/M in src) - shatter(M) - - return + shatter() /obj/structure/closet/statue/attack_animal(mob/living/simple_animal/user) if(user.environment_smash) - for(var/mob/M in src) - shatter(M) + shatter() /obj/structure/closet/statue/blob_act() - for(var/mob/M in src) - shatter(M) + shatter() -/obj/structure/closet/statue/attackby(obj/item/I, mob/user, params) - user.changeNext_move(CLICK_CD_MELEE) - health -= I.force +/obj/structure/closet/statue/attacked_by(obj/item/I, mob/living/user) + if(I.damtype != STAMINA) + health -= I.force visible_message("[user] strikes [src] with [I].") if(health <= 0) - for(var/mob/M in src) - shatter(M) + shatter() /obj/structure/closet/statue/MouseDrop_T() return @@ -151,9 +145,9 @@ /obj/structure/closet/statue/update_icon() return -/obj/structure/closet/statue/proc/shatter(mob/user) - if(user) - user.dust() +/obj/structure/closet/statue/proc/shatter() + for(var/mob/living/M in src) + M.dust() dump_contents() visible_message("[src] shatters!.") qdel(src) diff --git a/code/game/objects/structures/displaycase.dm b/code/game/objects/structures/displaycase.dm index c83ffc2513c..6ca97bb58a3 100644 --- a/code/game/objects/structures/displaycase.dm +++ b/code/game/objects/structures/displaycase.dm @@ -27,13 +27,9 @@ dump() qdel(src) if (2) - if (prob(50)) - src.health -= 15 - src.healthcheck() + take_damage(rand(10,20), BRUTE, 0) if (3) - if (prob(50)) - src.health -= 5 - src.healthcheck() + take_damage(5, BRUTE, 0) /obj/structure/displaycase/examine(mob/user) ..() @@ -43,12 +39,9 @@ user << "Hooked up with an anti-theft system." -/obj/structure/displaycase/bullet_act(obj/item/projectile/Proj) - if((Proj.damage_type == BRUTE || Proj.damage_type == BURN)) - health -= Proj.damage - ..() - src.healthcheck() - return +/obj/structure/displaycase/bullet_act(obj/item/projectile/P) + . = ..() + take_damage(P.damage, P.damage_type, 0) /obj/structure/displaycase/proc/dump() if (showpiece) @@ -61,24 +54,36 @@ dump() qdel(src) -/obj/structure/displaycase/proc/healthcheck() - if (src.health <= 0) - if (!( src.destroyed )) - src.density = 0 - src.destroyed = 1 - new /obj/item/weapon/shard( src.loc ) - playsound(src, "shatter", 70, 1) - update_icon() +/obj/structure/displaycase/hitby(atom/movable/AM) + ..() + if(isobj(AM)) + var/obj/item/I = AM + take_damage(I.throwforce * 0.2) - //Activate Anti-theft - if(alert) - var/area/alarmed = get_area(src) - alarmed.burglaralert(src) - playsound(src, "sound/effects/alert.ogg", 50, 1) +/obj/structure/displaycase/proc/take_damage(damage, damage_type = BRUTE, sound_effect = 1) + switch(damage_type) + if(BRUTE) + if(sound_effect) + playsound(src.loc, 'sound/effects/Glasshit.ogg', 75, 1) + if(BURN) + if(sound_effect) + playsound(src.loc, 'sound/items/Welder.ogg', 100, 1) + else + return + health = max( health - damage, 0) + if(!health && !destroyed) + density = 0 + destroyed = 1 + new /obj/item/weapon/shard( src.loc ) + playsound(src, "shatter", 70, 1) + update_icon() + + //Activate Anti-theft + if(alert) + var/area/alarmed = get_area(src) + alarmed.burglaralert(src) + playsound(src, "sound/effects/alert.ogg", 50, 1) - else - playsound(src.loc, 'sound/effects/Glasshit.ogg', 75, 1) - return /obj/structure/displaycase/proc/is_directional(atom/A) try @@ -115,23 +120,28 @@ return /obj/structure/displaycase/attackby(obj/item/weapon/W, mob/user, params) - if(istype(W, /obj/item/weapon/card) && electronics && !destroyed && allowed(user)) - user << "You [open ? "close":"open"] the [src]" - open = !open - update_icon() - return - if(!alert && istype(W,/obj/item/weapon/crowbar)) - if(destroyed && !showpiece) - user << "You remove the destroyed case" - qdel(src) - return - user << "You start to [open ? "close":"open"] the [src]" - if(do_after(user, 20/W.toolspeed, target = src)) + if(W.GetID() && electronics && !destroyed) + if(allowed(user)) user << "You [open ? "close":"open"] the [src]" open = !open update_icon() + else + user << "Access denied." + else if(!alert && istype(W,/obj/item/weapon/crowbar)) + if(destroyed) + if(showpiece) + user << "Remove the displayed object first." + else + user << "You remove the destroyed case" + qdel(src) + else + user << "You start to [open ? "close":"open"] the [src]" + if(do_after(user, 20/W.toolspeed, target = src)) + user << "You [open ? "close":"open"] the [src]" + open = !open + update_icon() else if(open && !showpiece) - if(user.unEquip(W)) + if(user.drop_item()) W.loc = src showpiece = W user << "You put [W] on display" @@ -148,15 +158,30 @@ health = initial(health) update_icon() else - user.changeNext_move(CLICK_CD_MELEE) - src.health -= W.force - src.healthcheck() - ..() - return + return ..() + +/obj/structure/displaycase/attacked_by(obj/item/weapon/W, mob/living/user) + ..() + take_damage(W.force, W.damtype) /obj/structure/displaycase/attack_paw(mob/user) return src.attack_hand(user) +/obj/structure/displaycase/attack_alien(mob/living/carbon/alien/humanoid/user) + user.changeNext_move(CLICK_CD_MELEE) + user.do_attack_animation(src) + visible_message("\The [user] slashes at [src]!") + playsound(src.loc, 'sound/weapons/slash.ogg', 100, 1) + take_damage(20, BRUTE, 0) + +/obj/structure/displaycase/attack_animal(mob/living/simple_animal/M) + M.changeNext_move(CLICK_CD_MELEE) + M.do_attack_animation(src) + if(M.melee_damage_upper > 0) + M.visible_message("[M.name] smashes against \the [src.name].",\ + "You smash against the [src.name].") + take_damage(M.melee_damage_upper, M.melee_damage_type, 1) + /obj/structure/displaycase/attack_hand(mob/user) user.changeNext_move(CLICK_CD_MELEE) if (showpiece && (destroyed || open)) @@ -166,11 +191,11 @@ update_icon() return else + user.do_attack_animation(src) user.visible_message("[user] kicks the display case.", \ "You kick the display case.") - src.health -= 2 - healthcheck() - return + take_damage(2) + /obj/structure/displaycase_chassis @@ -191,16 +216,16 @@ playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1) new /obj/item/stack/sheet/mineral/wood(get_turf(src)) qdel(src) - return - if(istype(I, /obj/item/weapon/electronics/airlock)) + + else if(istype(I, /obj/item/weapon/electronics/airlock)) user << "You start installing the electronics into [src]..." playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1) if(user.unEquip(I) && do_after(user, 30, target = src)) I.loc = src electronics = I user << "You install the airlock electronics." - return - if(istype(I, /obj/item/stack/sheet/glass)) + + else if(istype(I, /obj/item/stack/sheet/glass)) var/obj/item/stack/sheet/glass/G = I if(G.get_amount() < 10) user << "You need ten glass sheets to do this!" @@ -217,8 +242,8 @@ else display.req_access = electronics.accesses qdel(src) - return - return + else + return ..() /obj/structure/displaycase/captain diff --git a/code/game/objects/structures/false_walls.dm b/code/game/objects/structures/false_walls.dm index d150c78f75d..09fbd8a08d4 100644 --- a/code/game/objects/structures/false_walls.dm +++ b/code/game/objects/structures/false_walls.dm @@ -79,31 +79,32 @@ user << "You must wait until the door has stopped moving!" return - if(density) - var/turf/T = get_turf(src) - if(T.density) - user << "[src] is blocked!" - return - if(istype(W, /obj/item/weapon/screwdriver)) - if (!istype(T, /turf/open/floor)) + if(istype(W, /obj/item/weapon/screwdriver)) + if(density) + var/turf/T = get_turf(src) + if(T.density) + user << "[src] is blocked!" + return + if(!istype(T, /turf/open/floor)) user << "[src] bolts must be tightened on the floor!" return user.visible_message("[user] tightens some bolts on the wall.", "You tighten the bolts on the wall.") ChangeToWall() - if(istype(W, /obj/item/weapon/weldingtool)) - var/obj/item/weapon/weldingtool/WT = W - if(WT.remove_fuel(0,user)) - dismantle(user) - else - user << "You can't reach, close it first!" + else + user << "You can't reach, close it first!" - if(istype(W, /obj/item/weapon/gun/energy/plasmacutter)) + else if(istype(W, /obj/item/weapon/weldingtool)) + var/obj/item/weapon/weldingtool/WT = W + if(WT.remove_fuel(0,user)) + dismantle(user) + else if(istype(W, /obj/item/weapon/gun/energy/plasmacutter)) dismantle(user) - - if(istype(W, /obj/item/weapon/pickaxe/drill/jackhammer)) + else if(istype(W, /obj/item/weapon/pickaxe/drill/jackhammer)) var/obj/item/weapon/pickaxe/drill/jackhammer/D = W D.playDigSound() dismantle(user) + else + return ..() /obj/structure/falsewall/proc/dismantle(mob/user) user.visible_message("[user] dismantles the false wall.", "You dismantle the false wall.") @@ -160,7 +161,7 @@ /obj/structure/falsewall/uranium/attackby(obj/item/weapon/W, mob/user, params) radiate() - ..() + return ..() /obj/structure/falsewall/uranium/attack_hand(mob/user) radiate() @@ -222,8 +223,8 @@ message_admins("Plasma falsewall ignited by [key_name_admin(user)](?) (FLW) in ([x],[y],[z] - JMP)",0,1) log_game("Plasma falsewall ignited by [key_name(user)] in ([x],[y],[z])") burnbabyburn() - return - ..() + else + return ..() /obj/structure/falsewall/plasma/proc/burnbabyburn(user) playsound(src, 'sound/items/Welder.ogg', 100, 1) diff --git a/code/game/objects/structures/fireaxe.dm b/code/game/objects/structures/fireaxe.dm index 9a53e50cd94..dbc85a06870 100644 --- a/code/game/objects/structures/fireaxe.dm +++ b/code/game/objects/structures/fireaxe.dm @@ -8,7 +8,7 @@ density = 0 var/locked = 1 var/open = 0 - var/glass_hp = 60 + var/health = 60 /obj/structure/fireaxecabinet/New() ..() @@ -18,7 +18,7 @@ if(isrobot(user) || istype(I,/obj/item/device/multitool)) toggle_lock(user) return - if(open || glass_hp <= 0) + if(open || health <= 0) if(istype(I, /obj/item/weapon/twohanded/fireaxe) && !fireaxe) var/obj/item/weapon/twohanded/fireaxe/F = I if(F.wielded) @@ -31,42 +31,56 @@ user << "You place the [F.name] back in the [name]." update_icon() return - else if(glass_hp > 0) + else if(health > 0) toggle_open() + else + return ..() - else if(istype(I, /obj/item/weapon)) - user.changeNext_move(CLICK_CD_MELEE) - var/obj/item/weapon/W = I - user.do_attack_animation(src) - playsound(src, 'sound/effects/Glasshit.ogg', 100, 1) - if(W.force >= 10) - glass_hp -= W.force - if(glass_hp <= 0) - playsound(src, 'sound/effects/Glassbr3.ogg', 100, 1) - update_icon() +/obj/structure/fireaxecabinet/attacked_by(obj/item/I, mob/living/user) + ..() + take_damage(I.force, I.damtype) + +/obj/structure/fireaxecabinet/proc/take_damage(damage, damage_type, sound_effect = 1) + if(open) + return + switch(damage_type) + if(BRUTE) + if(sound_effect) + if(health <= 0) + playsound(loc, 'sound/effects/hit_on_shattered_glass.ogg', 90, 1) + else + playsound(loc, 'sound/effects/Glasshit.ogg', 90, 1) + if(BURN) + if(sound_effect) + playsound(src.loc, 'sound/items/Welder.ogg', 100, 1) else - user << "The [name]'s protective glass glances off the hit." + return + if(damage < 10) + return + if(health > 0) + health -= damage + update_icon() + if(health <= 0) + playsound(src, 'sound/effects/Glassbr3.ogg', 100, 1) + /obj/structure/fireaxecabinet/ex_act(severity, target) switch(severity) if(1) qdel(src) - return if(2) if(prob(50) && fireaxe) fireaxe.loc = src.loc qdel(src) - return + else + take_damage(rand(30,70), BRUTE, 0) if(3) - return + take_damage(rand(10,30), BRUTE, 0) + +/obj/structure/fireaxecabinet/bullet_act(obj/item/projectile/P) + . = ..() + take_damage(P.damage, P.damage_type, 0) -/obj/structure/fireaxecabinet/bullet_act(obj/item/projectile/Proj) - if((Proj.damage_type == BRUTE || Proj.damage_type == BURN)) - if(Proj.damage) - glass_hp -= Proj.damage - if(glass_hp <= 0) - playsound(src, 'sound/effects/Glassbr3.ogg', 100, 1) - update_icon() /obj/structure/fireaxecabinet/blob_act() if(fireaxe) @@ -74,7 +88,7 @@ qdel(src) /obj/structure/fireaxecabinet/attack_hand(mob/user) - if(open || glass_hp <= 0) + if(open || health <= 0) if(fireaxe) user.put_in_hands(fireaxe) fireaxe = null @@ -90,10 +104,19 @@ update_icon() return -/obj/structure/fireaxecabinet/attack_paw(mob/user) - if(ismonkey(user)) //no fire-axe wielding aliens allowed - attack_hand(user) - return +/obj/structure/fireaxecabinet/attack_paw(mob/living/user) + attack_hand(user) + +/obj/structure/fireaxecabinet/attack_alien(mob/living/user) + user.visible_message("[user] slashes [src].") + take_damage(20) + +/obj/structure/fireaxecabinet/attack_animal(mob/living/simple_animal/M) + if(!M.melee_damage_upper) + return + M.visible_message("[M] smashes against [src].", \ + "You smash against [src].") + take_damage(M.melee_damage_upper, M.melee_damage_type) /obj/structure/fireaxecabinet/attack_ai(mob/user) toggle_lock(user) @@ -104,7 +127,7 @@ if(fireaxe) overlays += "axe" if(!open) - switch(glass_hp) + switch(health) if(-INFINITY to 0) overlays += "glass4" if(1 to 20) diff --git a/code/game/objects/structures/grille.dm b/code/game/objects/structures/grille.dm index 59bc6451075..d34a261a8f2 100644 --- a/code/game/objects/structures/grille.dm +++ b/code/game/objects/structures/grille.dm @@ -17,13 +17,18 @@ stored.amount = 2 /obj/structure/grille/ex_act(severity, target) - qdel(src) + switch(severity) + if(1) + qdel(src) + else + take_damage(rand(5,10), BRUTE, 0) /obj/structure/grille/blob_act() qdel(src) /obj/structure/grille/Bumped(atom/user) - if(ismob(user)) shock(user, 70) + if(ismob(user)) + shock(user, 70) /obj/structure/grille/attack_paw(mob/user) @@ -32,37 +37,25 @@ /obj/structure/grille/attack_hulk(mob/living/carbon/human/user) ..(user, 1) shock(user, 70) - health -= 5 - healthcheck() + take_damage(5) /obj/structure/grille/attack_hand(mob/living/user) user.changeNext_move(CLICK_CD_MELEE) user.do_attack_animation(src) - playsound(loc, 'sound/effects/grillehit.ogg', 80, 1) user.visible_message("[user] hits [src].", \ "You hit [src].", \ "You hear twisting metal.") - - if(shock(user, 70)) - return - else - health -= rand(1,2) - healthcheck() + if(!shock(user, 70)) + take_damage(rand(1,2)) /obj/structure/grille/attack_alien(mob/living/user) user.do_attack_animation(src) - if(istype(user, /mob/living/carbon/alien/larva)) - return user.changeNext_move(CLICK_CD_MELEE) - playsound(loc, 'sound/effects/grillehit.ogg', 80, 1) user.visible_message("[user] mangles [src].", \ "You mangle [src].", \ "You hear twisting metal.") - if(!shock(user, 70)) - health -= 5 - healthcheck() - return + take_damage(5) /obj/structure/grille/attack_slime(mob/living/simple_animal/slime/user) user.changeNext_move(CLICK_CD_MELEE) @@ -70,36 +63,25 @@ if(!user.is_adult) return - playsound(loc, 'sound/effects/grillehit.ogg', 80, 1) user.visible_message("[user] smashes against [src].", \ "You smash against [src].", \ "You hear twisting metal.") - - health -= rand(1,2) - healthcheck() - return + take_damage(rand(1,2)) /obj/structure/grille/attack_animal(var/mob/living/simple_animal/M) M.changeNext_move(CLICK_CD_MELEE) if(M.melee_damage_upper == 0 || (M.melee_damage_type != BRUTE && M.melee_damage_type != BURN)) return M.do_attack_animation(src) - playsound(loc, 'sound/effects/grillehit.ogg', 80, 1) M.visible_message("[M] smashes against [src].", \ "You smash against [src].", \ "You hear twisting metal.") - - health -= M.melee_damage_upper - healthcheck() - return + take_damage(M.melee_damage_upper, M.melee_damage_type) /obj/structure/grille/mech_melee_attack(obj/mecha/M) if(..()) - playsound(loc, 'sound/effects/grillehit.ogg', 80, 1) - health -= M.force * 0.5 - healthcheck() - + take_damage(M.force * 0.5, M.damtype) /obj/structure/grille/CanPass(atom/movable/mover, turf/target, height=0) if(height==0) return 1 @@ -118,13 +100,8 @@ . = . || mover.checkpass(PASSGRILLE) /obj/structure/grille/bullet_act(var/obj/item/projectile/Proj) - if(!Proj) - return - ..() - if((Proj.damage_type != STAMINA)) //Grilles can't be exhausted to death - src.health -= Proj.damage*0.3 - healthcheck() - return + . = ..() + take_damage(Proj.damage*0.3, Proj.damage_type) /obj/structure/grille/Deconstruct() if(!loc) //if already qdel'd somehow, we do nothing @@ -169,8 +146,6 @@ icon_state = "grille" R.use(1) return - else if(istype(W, /obj/item/weapon/rcd) && istype(loc, /turf)) //Do not attack the grille if the user is holding an RCD - return //window placing begin else if(istype(W, /obj/item/stack/sheet/rglass) || istype(W, /obj/item/stack/sheet/glass)) @@ -206,32 +181,35 @@ return //window placing end - else if(istype(W, /obj/item/weapon/shard)) - playsound(loc, 'sound/effects/grillehit.ogg', 80, 1) - health -= W.force * 0.1 - else if(!shock(user, 70)) - switch(W.damtype) - if(STAMINA) - return - if(BURN) - playsound(loc, 'sound/items/welder.ogg', 80, 1) - else - playsound(loc, 'sound/effects/grillehit.ogg', 80, 1) - health -= W.force * 0.3 + else if(istype(W, /obj/item/weapon/shard) || !shock(user, 70)) + return ..() - healthcheck() + +/obj/structure/grille/attacked_by(obj/item/I, mob/living/user) ..() - return + take_damage(I.force * 0.3, I.damtype) - -/obj/structure/grille/proc/healthcheck() +/obj/structure/grille/proc/take_damage(damage, damage_type = BRUTE, sound_effect = 1) + switch(damage_type) + if(BURN) + if(sound_effect) + playsound(loc, 'sound/items/welder.ogg', 80, 1) + if(BRUTE) + if(sound_effect) + if(damage) + playsound(loc, 'sound/effects/grillehit.ogg', 80, 1) + else + playsound(loc, 'sound/weapons/tap.ogg', 50, 1) + else + return + health -= damage if(health <= 0) if(!destroyed) Break() else if(health <= -6) Deconstruct() - return + // shock user with probability prb (if all connections & power are working) // returns 1 if shocked, 0 otherwise @@ -258,8 +236,7 @@ /obj/structure/grille/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume) if(!destroyed) if(exposed_temperature > T0C + 1500) - health -= 1 - healthcheck() + take_damage(1) ..() /obj/structure/grille/hitby(AM as mob|obj) @@ -277,9 +254,7 @@ if(C) playsound(src.loc, 'sound/magic/LightningShock.ogg', 100, 1, extrarange = 5) tesla_zap(src, 3, C.powernet.avail * 0.08) //ZAP for 1/5000 of the amount of power, which is from 15-25 with 200000W - playsound(loc, 'sound/effects/grillehit.ogg', 80, 1) - health = max(0, health - tforce) - healthcheck() + take_damage(tforce) /obj/structure/grille/storage_contents_dump_act(obj/item/weapon/storage/src_object, mob/user) return 0 diff --git a/code/game/objects/structures/guncase.dm b/code/game/objects/structures/guncase.dm index ae8c5b4e861..920f1534b69 100644 --- a/code/game/objects/structures/guncase.dm +++ b/code/game/objects/structures/guncase.dm @@ -46,11 +46,14 @@ update_icon() return - open = !open - update_icon() + else if(user.a_intent != "harm") + open = !open + update_icon() + else + return ..() /obj/structure/guncase/attack_hand(mob/user) - if(isrobot(usr) || isalien(usr)) + if(isrobot(user) || isalien(user)) return if(contents.len && open) ShowWindow(user) diff --git a/code/game/objects/structures/mineral_doors.dm b/code/game/objects/structures/mineral_doors.dm index 970abe0decf..bd4e5504385 100644 --- a/code/game/objects/structures/mineral_doors.dm +++ b/code/game/objects/structures/mineral_doors.dm @@ -129,14 +129,16 @@ if(do_after(user,digTool.digspeed*hardness, target = src) && src) user << "You finish digging." Dismantle() - else if(istype(W,/obj/item/weapon)) //not sure, can't not just weapons get passed to this proc? - hardness -= W.force/100 - user << "You hit the [name] with your [W.name]!" - CheckHardness() - else + else if(user.a_intent != "harm") attack_hand(user) - return + else + return ..() +/obj/structure/mineral_door/attacked_by(obj/item/I, mob/user) + ..() + if(I.damtype != STAMINA) + hardness -= I.force/100 + CheckHardness() /obj/structure/mineral_door/bullet_act(obj/item/projectile/Proj) hardness -= Proj.damage @@ -222,7 +224,8 @@ message_admins("Plasma mineral door ignited by [key_name_admin(user)](?) (FLW) in ([x],[y],[z] - JMP)",0,1) log_game("Plasma mineral door ignited by [key_name(user)] in ([x],[y],[z])") TemperatureAct(100) - ..() + else + return ..() /obj/structure/mineral_door/transparent/plasma/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume) if(exposed_temperature > 300) diff --git a/code/game/objects/structures/mirror.dm b/code/game/objects/structures/mirror.dm index 20d6a7a63e6..e2d7d3f1d47 100644 --- a/code/game/objects/structures/mirror.dm +++ b/code/game/objects/structures/mirror.dm @@ -42,32 +42,21 @@ /obj/structure/mirror/proc/shatter() - if(shattered) - return - shattered = 1 icon_state = "mirror_broke" playsound(src, "shatter", 70, 1) desc = "Oh no, seven years of bad luck!" -/obj/structure/mirror/bullet_act(obj/item/projectile/Proj) - if(prob(Proj.damage * 2)) - if((Proj.damage_type == BRUTE || Proj.damage_type == BURN)) - if(!shattered) - shatter() - else - playsound(src, 'sound/effects/hit_on_shattered_glass.ogg', 70, 1) - ..() +/obj/structure/mirror/bullet_act(obj/item/projectile/P) + . = ..() + take_damage(P.damage, P.damage_type, 0) /obj/structure/mirror/attackby(obj/item/I, mob/living/user, params) - user.changeNext_move(CLICK_CD_MELEE) - user.do_attack_animation(src) - if(I.damtype == STAMINA) - return - if(shattered) - if(istype(I, /obj/item/weapon/weldingtool)) - var/obj/item/weapon/weldingtool/WT = I + if(istype(I, /obj/item/weapon/weldingtool) && user.a_intent != "harm") + var/obj/item/weapon/weldingtool/WT = I + if(shattered) + user.changeNext_move(CLICK_CD_MELEE) if(WT.remove_fuel(0, user)) user << "You begin repairing [src]..." playsound(src, 'sound/items/Welder.ogg', 100, 1) @@ -78,59 +67,60 @@ shattered = 0 icon_state = initial(icon_state) desc = initial(desc) - return - playsound(src.loc, 'sound/effects/hit_on_shattered_glass.ogg', 70, 1) - return - - if(prob(I.force * 2)) - visible_message("[user] smashes [src] with [I].") - shatter() else - visible_message("[user] hits [src] with [I]!") - playsound(src.loc, 'sound/effects/Glasshit.ogg', 70, 1) + return ..() +/obj/structure/mirror/attacked_by(obj/item/I, mob/living/user) + ..() + take_damage(I.force, I.damtype) + +/obj/structure/mirror/ex_act(severity) + switch(severity) + if(1) + qdel(src) + if(2) + if(prob(50)) + qdel(src) + else + take_damage(5) + if(3) + if(prob(75)) + take_damage(5) + +/obj/structure/mirror/proc/take_damage(damage, damage_type = BRUTE, sound_effect = 1) + switch(damage_type) + if(BRUTE) + if(BURN) + else + return + if(!shattered) + if(damage) + shatter() + else if(sound_effect) + playsound(src.loc, 'sound/effects/hit_on_shattered_glass.ogg', 70, 1) + +/obj/structure/mirror/proc/attack_generic(mob/living/user) + user.changeNext_move(CLICK_CD_MELEE) + user.do_attack_animation(src) + user.visible_message("[user] smashes [src]!") + take_damage(5) /obj/structure/mirror/attack_alien(mob/living/user) - user.changeNext_move(CLICK_CD_MELEE) - user.do_attack_animation(src) - if(islarva(user)) - return - if(shattered) - playsound(src.loc, 'sound/effects/hit_on_shattered_glass.ogg', 70, 1) - return - user.visible_message("[user] smashes [src]!") - shatter() + attack_generic(user) - -/obj/structure/mirror/attack_animal(mob/living/user) - if(!isanimal(user)) - return - var/mob/living/simple_animal/M = user +/obj/structure/mirror/attack_animal(mob/living/simple_animal/M) if(M.melee_damage_upper <= 0) return - user.changeNext_move(CLICK_CD_MELEE) - M.do_attack_animation(src) - if(shattered) - playsound(src.loc, 'sound/effects/hit_on_shattered_glass.ogg', 70, 1) - return - user.visible_message("[user] smashes [src]!") - shatter() - + attack_generic(M) /obj/structure/mirror/attack_slime(mob/living/user) - user.changeNext_move(CLICK_CD_MELEE) - user.do_attack_animation(src) - if(shattered) - playsound(src.loc, 'sound/effects/hit_on_shattered_glass.ogg', 70, 1) - return - user.visible_message("[user] smashes [src]!") - shatter() + attack_generic(user) /obj/structure/mirror/magic name = "magic mirror" desc = "Turn and face the strange... face." icon_state = "magic_mirror" - var/list/races_blacklist = list("skeleton","agent") + var/list/races_blacklist = list("skeleton", "agent") var/list/choosable_races = list() /obj/structure/mirror/magic/New() diff --git a/code/game/objects/structures/signs.dm b/code/game/objects/structures/signs.dm index 08fefcf4910..1f5f8a22ec2 100644 --- a/code/game/objects/structures/signs.dm +++ b/code/game/objects/structures/signs.dm @@ -29,7 +29,7 @@ "You unfasten [src].") new /obj/item/sign_backing(get_turf(user)) qdel(src) - if(istype(O, /obj/item/weapon/pen)) + else if(istype(O, /obj/item/weapon/pen)) var/list/sign_types = list("Secure Area", "Biohazard", "High Voltage", "Radiation", "Hard Vacuum Ahead", "Disposal: Leads To Space", "Danger: Fire", "No Smoking", "Medbay", "Science", "Chemistry", \ "Hydroponics", "Xenobiology") var/obj/structure/sign/sign_type @@ -77,6 +77,8 @@ newsign.pixel_x = pixel_x newsign.pixel_y = pixel_y qdel(src) + else + return ..() /obj/item/sign_backing name = "sign backing" @@ -87,20 +89,16 @@ burn_state = FLAMMABLE /obj/item/sign_backing/afterattack(atom/target, mob/user, proximity) - if(!isturf(target)) + if(isturf(target) && proximity) + var/turf/T = target + user.visible_message("[user] fastens [src] to [T].", \ + "You attach a blank sign to [T].") + playsound(T, 'sound/items/Deconstruct.ogg', 50, 1) + new /obj/structure/sign/basic(T) + user.drop_item() + qdel(src) + else return ..() - if(!user.Adjacent(target)) - return ..() - var/turf/T = target - if(!T || !istype(T)) - return ..() - user.visible_message("[user] fastens [src] to [T].", \ - "You attach a blank sign to [T].") - playsound(T, 'sound/items/Deconstruct.ogg', 50, 1) - new /obj/structure/sign/basic(T) - user.drop_item() - qdel(src) - return /obj/structure/sign/map name = "station map" diff --git a/code/game/objects/structures/statues.dm b/code/game/objects/structures/statues.dm index 9867e641623..173d87b92af 100644 --- a/code/game/objects/structures/statues.dm +++ b/code/game/objects/structures/statues.dm @@ -8,7 +8,7 @@ icon_state = "" density = 1 anchored = 0 - var/hardness = 1 + var/health = 100 var/oreAmount = 7 var/mineralType = "metal" @@ -75,11 +75,12 @@ user.visible_message("[user] slices apart the [name].", \ "You slice apart the [name]!") Dismantle(1) - else - hardness -= W.force/100 - ..() - CheckHardness() + return ..() + +/obj/structure/statue/attacked_by(obj/item/I, mob/living/user) + ..() + take_damage(I.force, I.damtype) /obj/structure/statue/attack_hand(mob/living/user) user.changeNext_move(CLICK_CD_MELEE) @@ -87,17 +88,30 @@ user.visible_message("[user] rubs some dust off from the [name]'s surface.", \ "You rub some dust off from the [name]'s surface.") +//attack alien animal phil235 + /obj/structure/statue/CanAtmosPass() return !density -/obj/structure/statue/bullet_act(obj/item/projectile/Proj) - hardness -= Proj.damage - ..() - CheckHardness() - return +/obj/structure/statue/bullet_act(obj/item/projectile/P) + . = ..() + take_damage(P.damage, P.damage_type, 0) -/obj/structure/statue/proc/CheckHardness() - if(hardness <= 0) +/obj/structure/statue/proc/take_damage(damage, damage_type = BRUTE, sound_effect = 1) + switch(damage_type) + if(BRUTE) + if(sound_effect) + if(damage) + playsound(loc, 'sound/weapons/smash.ogg', 50, 1) + else + playsound(loc, 'sound/weapons/tap.ogg', 50, 1) + if(BURN) + if(sound_effect) + playsound(loc, 'sound/items/Welder.ogg', 40, 1) + else + return + health -= damage + if(health <= 0) Dismantle(1) /obj/structure/statue/proc/Dismantle(devastated = 0) @@ -126,21 +140,15 @@ if(1) Dismantle(1) if(2) - if(prob(20)) - Dismantle(1) - else - hardness-- - CheckHardness() + take_damage(rand(60,110), BRUTE, 0) if(3) - hardness -= 0.1 - CheckHardness() - return + take_damage(10, BRUTE, 0) //////////////////////////////////////STATUES///////////////////////////////////////////////////////////// ////////////////////////uranium/////////////////////////////////// /obj/structure/statue/uranium - hardness = 3 + health = 300 luminosity = 2 mineralType = "uranium" var/last_event = 0 @@ -158,7 +166,7 @@ /obj/structure/statue/uranium/attackby(obj/item/weapon/W, mob/user, params) radiate() - ..() + return ..() /obj/structure/statue/uranium/Bumped(atom/user) radiate() @@ -185,7 +193,7 @@ ////////////////////////////plasma/////////////////////////////////////////////////////////////////////// /obj/structure/statue/plasma - hardness = 2 + health = 200 mineralType = "plasma" desc = "This statue is suitably made from plasma." @@ -200,7 +208,7 @@ /obj/structure/statue/plasma/bullet_act(obj/item/projectile/Proj) var/burn = FALSE - if(istype(Proj,/obj/item/projectile/beam)) + if(istype(Proj,/obj/item/projectile/beam)) //phil235 test this PlasmaBurn(2500) burn = TRUE else if(istype(Proj,/obj/item/projectile/ion)) @@ -220,13 +228,12 @@ message_admins("Plasma statue ignited by [key_name_admin(user)](?) (FLW) in ([x],[y],[z] - JMP)",0,1) log_game("Plasma statue ignited by [key_name(user)] in ([x],[y],[z])") ignite(W.is_hot()) - return - ..() + else + return ..() /obj/structure/statue/plasma/proc/PlasmaBurn() atmos_spawn_air("plasma=400;TEMP=1000") - hardness = 0 - CheckHardness() + Dismantle(1) /obj/structure/statue/plasma/proc/ignite(exposed_temperature) if(exposed_temperature > 300) @@ -235,7 +242,7 @@ //////////////////////gold/////////////////////////////////////// /obj/structure/statue/gold - hardness = 3 + health = 300 mineralType = "gold" desc = "This is a highly valuable statue made from gold." @@ -262,7 +269,7 @@ //////////////////////////silver/////////////////////////////////////// /obj/structure/statue/silver - hardness = 3 + health = 300 mineralType = "silver" desc = "This is a valuable statue made from silver." @@ -289,7 +296,7 @@ /////////////////////////diamond///////////////////////////////////////// /obj/structure/statue/diamond - hardness = 10 + health = 1000 mineralType = "diamond" desc = "This is a very expensive diamond statue" @@ -308,7 +315,7 @@ ////////////////////////bananium/////////////////////////////////////// /obj/structure/statue/bananium - hardness = 3 + health = 300 mineralType = "bananium" desc = "A bananium statue with a small engraving:'HOOOOOOONK'." var/spam_flag = 0 @@ -323,7 +330,7 @@ /obj/structure/statue/bananium/attackby(obj/item/weapon/W, mob/user, params) honk() - ..() + return ..() /obj/structure/statue/bananium/attack_hand(mob/user) honk() @@ -343,7 +350,7 @@ /////////////////////sandstone///////////////////////////////////////// /obj/structure/statue/sandstone - hardness = 0.5 + health = 50 mineralType = "sandstone" /obj/structure/statue/sandstone/assistant @@ -354,7 +361,7 @@ /////////////////////snow///////////////////////////////////////// /obj/structure/statue/snow - hardness = 0.5 + health = 50 mineralType = "snow" /obj/structure/statue/snow/snowman diff --git a/code/game/objects/structures/tables_racks.dm b/code/game/objects/structures/tables_racks.dm index 83f7cdde998..a4956e461f0 100644 --- a/code/game/objects/structures/tables_racks.dm +++ b/code/game/objects/structures/tables_racks.dm @@ -28,7 +28,8 @@ var/busy = 0 var/buildstackamount = 1 var/framestackamount = 2 - var/deconstructable = 1 + var/deconstruction_ready = 1 + var/health = 100 smooth = SMOOTH_TRUE canSmoothWith = list(/obj/structure/table, /obj/structure/table/reinforced) @@ -48,55 +49,62 @@ if(1) qdel(src) if(2) - if(prob(50)) - table_destroy(1) - else - qdel(src) + take_damage(rand(80,120), BRUTE, 0) if(3) - if(prob(25)) - table_destroy(1) + take_damage(rand(40,80), BRUTE, 0) /obj/structure/table/blob_act() if(prob(75)) - table_destroy(1) - return + qdel(src) /obj/structure/table/narsie_act() if(prob(20)) new /obj/structure/table/wood(src.loc) /obj/structure/table/mech_melee_attack(obj/mecha/M) - visible_message("[M.name] smashes [src] apart!") playsound(src.loc, 'sound/weapons/punch4.ogg', 50, 1) - table_destroy(1) + visible_message("[M.name] smashes [src]!") + take_damage(200, M.damtype, 0) /obj/structure/table/attack_alien(mob/living/user) + user.changeNext_move(CLICK_CD_MELEE) user.do_attack_animation(src) playsound(src.loc, 'sound/weapons/bladeslice.ogg', 50, 1) - visible_message("[user] slices [src] apart!") - table_destroy(1) + visible_message("[user] slices [src]!") + take_damage(100, BRUTE, 0) + /obj/structure/table/attack_animal(mob/living/simple_animal/user) - if(user.environment_smash) - user.do_attack_animation(src) + user.changeNext_move(CLICK_CD_MELEE) + user.do_attack_animation(src) + if(user.melee_damage_upper) + var/dmg_dealt = user.melee_damage_upper + if(user.environment_smash) + dmg_dealt = 100 + visible_message("[user] smashes [src]!") playsound(src.loc, 'sound/weapons/Genhit.ogg', 50, 1) - visible_message("[user] smashes [src] apart!") - table_destroy(1) + take_damage(dmg_dealt, user.melee_damage_type, 0) + /obj/structure/table/attack_paw(mob/user) attack_hand(user) /obj/structure/table/attack_hulk(mob/living/carbon/human/user) ..(user, 1) - visible_message("[user] smashes [src] apart!") - playsound(src.loc, 'sound/effects/bang.ogg', 50, 1) + playsound(src, 'sound/effects/meteorimpact.ogg', 100, 1) + visible_message("[user] smashes [src]!") user.say(pick(";RAAAAAAAARGH!", ";HNNNNNNNNNGGGGGGH!", ";GWAAAAAAAARRRHHH!", "NNNNNNNNGGGGGGGGHH!", ";AAAAAAARRRGH!" )) - table_destroy(1) + take_damage(rand(180,280), BRUTE, 0) return 1 + /obj/structure/table/attack_tk() // no telehulk sorry return +/obj/structure/table/bullet_act(obj/item/projectile/P) + . = ..() + take_damage(P.damage, P.damage_type, 0) + /obj/structure/table/CanPass(atom/movable/mover, turf/target, height=0) if(height==0) return 1 @@ -145,31 +153,19 @@ qdel(I) /obj/structure/table/attackby(obj/item/I, mob/user, params) - if (istype(I, /obj/item/weapon/grab)) + if(istype(I, /obj/item/weapon/grab)) tablepush(I, user) return - if(!(flags&NODECONSTRUCT)) - if (istype(I, /obj/item/weapon/screwdriver)) - if(istype(src, /obj/structure/table/reinforced)) - var/obj/structure/table/reinforced/RT = src - if(RT.status == 1) - table_destroy(2, user) - return - else - table_destroy(2, user) - return + if(!(flags & NODECONSTRUCT)) + if(istype(I, /obj/item/weapon/screwdriver) && deconstruction_ready) + table_deconstruct(user, 1) + return - if (istype(I, /obj/item/weapon/wrench)) - if(istype(src, /obj/structure/table/reinforced)) - var/obj/structure/table/reinforced/RT = src - if(RT.status == 1) - table_destroy(3, user) - return - else - table_destroy(3, user) - return + if(istype(I, /obj/item/weapon/wrench) && deconstruction_ready) + table_deconstruct(user, 0) + return - if (istype(I, /obj/item/weapon/storage/bag/tray)) + if(istype(I, /obj/item/weapon/storage/bag/tray)) var/obj/item/weapon/storage/bag/tray/T = I if(T.contents.len > 0) // If the tray isn't empty var/list/obj/item/oldContents = T.contents.Copy() @@ -182,10 +178,7 @@ return // If the tray IS empty, continue on (tray will be placed on the table like other items) - if(isrobot(user)) - return - - if(!(I.flags & ABSTRACT)) //rip more parems rip in peace ;_; + if(user.a_intent != "harm" && !(I.flags & ABSTRACT)) if(user.drop_item()) I.Move(loc) var/list/click_params = params2list(params) @@ -195,29 +188,51 @@ //Clamp it so that the icon never moves more than 16 pixels in either direction (thus leaving the table turf) I.pixel_x = Clamp(text2num(click_params["icon-x"]) - 16, -(world.icon_size/2), world.icon_size/2) I.pixel_y = Clamp(text2num(click_params["icon-y"]) - 16, -(world.icon_size/2), world.icon_size/2) + return 1 + else + return ..() +/obj/structure/table/attacked_by(obj/item/I, mob/living/user) + ..() + take_damage(I.force, I.damtype) + +/obj/structure/table/proc/take_damage(damage, damage_type = BRUTE, sound_effect = 1) + switch(damage_type) + if(BRUTE) + if(sound_effect) + if(damage) + playsound(loc, 'sound/weapons/smash.ogg', 50, 1) + else + playsound(loc, 'sound/weapons/tap.ogg', 50, 1) + if(BURN) + if(sound_effect) + playsound(loc, 'sound/items/Welder.ogg', 40, 1) + else + return + health -= damage + if(health <= 0) + table_destroy() /* * TABLE DESTRUCTION/DECONSTRUCTION */ -#define TBL_DESTROY 1 -#define TBL_DISASSEMBLE 2 -#define TBL_DECONSTRUCT 3 -/obj/structure/table/proc/table_destroy(destroy_type, mob/user) - if(!deconstructable || (flags&NODECONSTRUCT)) - return - if(destroy_type == TBL_DESTROY) +/obj/structure/table/proc/table_destroy() + if(!(flags & NODECONSTRUCT)) + var/turf/T = get_turf(src) for(var/i = 1, i <= framestackamount, i++) - new framestack(get_turf(src)) + new framestack(T) for(var/i = 1, i <= buildstackamount, i++) - new buildstack(get_turf(src)) - qdel(src) - return + new buildstack(T) + qdel(src) - if(destroy_type == TBL_DISASSEMBLE) + +/obj/structure/table/proc/table_deconstruct(mob/user, disassembling = 0) + if(flags & NODECONSTRUCT) + return + if(disassembling) user << "You start disassembling [src]..." playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, 1) if(do_after(user, 20, target = src)) @@ -225,9 +240,7 @@ for(var/i = 1, i <= buildstackamount, i++) new buildstack(get_turf(src)) qdel(src) - return - - if(destroy_type == TBL_DECONSTRUCT) + else user << "You start deconstructing [src]..." playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1) if(do_after(user, 40, target = src)) @@ -237,7 +250,7 @@ new buildstack(get_turf(src)) playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1) qdel(src) - return + /* * Glass tables @@ -249,6 +262,7 @@ icon_state = "glass_table" buildstack = /obj/item/stack/sheet/glass canSmoothWith = null + health = 50 /obj/structure/table/glass/tablepush(obj/item/I, mob/user) if(..()) @@ -306,45 +320,31 @@ desc = "A reinforced version of the four legged table, much harder to simply deconstruct." icon = 'icons/obj/smooth_structures/reinforced_table.dmi' icon_state = "r_table" - var/status = 2 + deconstruction_ready = 0 buildstack = /obj/item/stack/sheet/plasteel canSmoothWith = list(/obj/structure/table/reinforced, /obj/structure/table) + health = 200 /obj/structure/table/reinforced/attackby(obj/item/weapon/W, mob/user, params) - if (istype(W, /obj/item/weapon/weldingtool)) + if(istype(W, /obj/item/weapon/weldingtool)) var/obj/item/weapon/weldingtool/WT = W if(WT.remove_fuel(0, user)) - if(src.status == 2) + playsound(src.loc, 'sound/items/Welder.ogg', 50, 1) + if(deconstruction_ready) user << "You start weakening the reinforced table..." - playsound(src.loc, 'sound/items/Welder.ogg', 50, 1) if (do_after(user, 50/W.toolspeed, target = src)) if(!src || !WT.isOn()) return user << "You weaken the table." - src.status = 1 + deconstruction_ready = 0 else user << "You start strengthening the reinforced table..." - playsound(src.loc, 'sound/items/Welder.ogg', 50, 1) if (do_after(user, 50/W.toolspeed, target = src)) if(!src || !WT.isOn()) return user << "You strengthen the table." - src.status = 2 - return - ..() - -/obj/structure/table/reinforced/attack_paw(mob/user) - attack_hand(user) - -/obj/structure/table/reinforced/attack_hulk(mob/living/carbon/human/user) - ..(user, 1) - if(prob(75)) - playsound(src, 'sound/effects/meteorimpact.ogg', 100, 1) - user << text("You kick [src] into pieces.") - user.say(pick(";RAAAAAAAARGH!", ";HNNNNNNNNNGGGGGGH!", ";GWAAAAAAAARRRHHH!", "NNNNNNNNGGGGGGGGHH!", ";AAAAAAARRRGH!" )) - table_destroy(1) + deconstruction_ready = 1 else - playsound(src, 'sound/effects/bang.ogg', 50, 1) - user << text("You kick [src].") - return 1 + return ..() + /* * Surgery Tables @@ -394,7 +394,7 @@ density = 1 anchored = 1 pass_flags = LETPASSTHROW //You can throw objects over this, despite it's density. - var/health = 5 + var/health = 20 /obj/structure/rack/ex_act(severity, target) switch(severity) @@ -406,20 +406,18 @@ else qdel(src) if(3) - if(prob(25)) - rack_destroy() + take_damage(rand(5,25), BRUTE, 0) /obj/structure/rack/blob_act() if(prob(75)) qdel(src) - return - else if(prob(50)) + else rack_destroy() - return + /obj/structure/rack/mech_melee_attack(obj/mecha/M) visible_message("[M.name] smashes [src] apart!") - rack_destroy(1) + rack_destroy() /obj/structure/rack/CanPass(atom/movable/mover, turf/target, height=0) if(height==0) return 1 @@ -439,29 +437,26 @@ /obj/structure/rack/MouseDrop_T(obj/O, mob/user) if ((!( istype(O, /obj/item/weapon) ) || user.get_active_hand() != O)) return - if(isrobot(user)) - return if(!user.drop_item()) - user << "\The [O] is stuck to your hand, you cannot put it in the rack!" return - if (O.loc != src.loc) + if(O.loc != src.loc) step(O, get_dir(O, src)) - return + /obj/structure/rack/attackby(obj/item/weapon/W, mob/user, params) if (istype(W, /obj/item/weapon/wrench) && !(flags&NODECONSTRUCT)) playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1) rack_destroy() return + if(user.a_intent == "harm") + return ..() + if(user.drop_item()) + W.Move(loc) + return 1 - if(isrobot(user)) - return - if(!user.drop_item()) - user << "\The [W] is stuck to your hand, you cannot put it in the rack!" - return - W.Move(loc) - return 1 - +/obj/structure/rack/attacked_by(obj/item/I, mob/living/user) + ..() + take_damage(I.force, I.damtype) /obj/structure/rack/attack_paw(mob/living/user) attack_hand(user) @@ -474,30 +469,54 @@ /obj/structure/rack/attack_hand(mob/living/user) user.changeNext_move(CLICK_CD_MELEE) user.do_attack_animation(src) - playsound(loc, 'sound/items/dodgeball.ogg', 80, 1) user.visible_message("[user] kicks [src].", \ "You kick [src].") - health -= rand(1,2) - healthcheck() + take_damage(rand(4,8), BRUTE) /obj/structure/rack/attack_alien(mob/living/user) + user.changeNext_move(CLICK_CD_MELEE) user.do_attack_animation(src) + playsound(src.loc, 'sound/weapons/bladeslice.ogg', 50, 1) visible_message("[user] slices [src] apart.") rack_destroy() /obj/structure/rack/attack_animal(mob/living/simple_animal/user) - if(user.environment_smash) - user.do_attack_animation(src) - visible_message("[user] smashes [src] apart.") - rack_destroy() + user.changeNext_move(CLICK_CD_MELEE) + user.do_attack_animation(src) + if(user.melee_damage_upper) + if(user.environment_smash) + playsound(src, 'sound/effects/meteorimpact.ogg', 100, 1) + visible_message("[user] smashes [src] apart.") + rack_destroy() + else + take_damage(user.melee_damage_upper, user.melee_damage_type) + + /obj/structure/rack/attack_tk() // no telehulk sorry return -/obj/structure/rack/proc/healthcheck() +/obj/structure/rack/bullet_act(obj/item/projectile/P) + . = ..() + take_damage(P.damage, P.damage_type, 0) + +/obj/structure/rack/proc/take_damage(damage, damage_type = BRUTE, sound_effect = 1) + switch(damage_type) + if(BRUTE) + if(sound_effect) + if(damage) + playsound(loc, 'sound/items/dodgeball.ogg', 80, 1) + else + playsound(loc, 'sound/weapons/tap.ogg', 50, 1) + if(BURN) + if(sound_effect) + playsound(loc, 'sound/items/Welder.ogg', 40, 1) + else + return + health -= damage if(health <= 0) rack_destroy() - return + /* * Rack destruction @@ -524,12 +543,12 @@ materials = list(MAT_METAL=2000) /obj/item/weapon/rack_parts/attackby(obj/item/weapon/W, mob/user, params) - ..() if (istype(W, /obj/item/weapon/wrench)) new /obj/item/stack/sheet/metal( user.loc ) qdel(src) return - return + else + return ..() /obj/item/weapon/rack_parts/attack_self(mob/user) user << "You start constructing rack..." diff --git a/code/game/objects/structures/transit_tubes/station.dm b/code/game/objects/structures/transit_tubes/station.dm index 475383d8b2b..e4bbee8dcf7 100644 --- a/code/game/objects/structures/transit_tubes/station.dm +++ b/code/game/objects/structures/transit_tubes/station.dm @@ -82,18 +82,19 @@ /obj/structure/transit_tube/station/attackby(obj/item/W, mob/user, params) - if(istype(W, /obj/item/weapon/grab) && icon_state == "open") - var/obj/item/weapon/grab/G = W - if(ismob(G.affecting) && G.state >= GRAB_AGGRESSIVE) - var/mob/GM = G.affecting - for(var/obj/structure/transit_tube_pod/pod in loc) - pod.visible_message("[user] starts putting [GM] into the [pod]!") - if(do_after(user, 15, target = src) && GM && G && G.affecting == GM) - GM.Weaken(5) - src.Bumped(GM) - qdel(G) - break - if(istype(W, /obj/item/weapon/crowbar)) + if(istype(W, /obj/item/weapon/grab)) + if(icon_state == "open") + var/obj/item/weapon/grab/G = W + if(ismob(G.affecting) && G.state >= GRAB_AGGRESSIVE) + var/mob/GM = G.affecting + for(var/obj/structure/transit_tube_pod/pod in loc) + pod.visible_message("[user] starts putting [GM] into the [pod]!") + if(do_after(user, 15, target = src) && GM && G && G.affecting == GM) + GM.Weaken(5) + src.Bumped(GM) + qdel(G) + break + else if(istype(W, /obj/item/weapon/crowbar)) for(var/obj/structure/transit_tube_pod/pod in loc) if(pod.contents) user << "Empty the pod first!" @@ -103,7 +104,8 @@ pod.transfer_fingerprints_to(R) R.add_fingerprint(user) qdel(pod) - ..(W, user) + else + return ..() /obj/structure/transit_tube/station/proc/open_animation() if(icon_state == "closed") diff --git a/code/game/objects/structures/watercloset.dm b/code/game/objects/structures/watercloset.dm index 1a9586b7449..9f90f3a224b 100644 --- a/code/game/objects/structures/watercloset.dm +++ b/code/game/objects/structures/watercloset.dm @@ -56,7 +56,23 @@ update_icon() return - if(istype(I, /obj/item/weapon/reagent_containers)) + else if(cistern) + if(user.a_intent != "harm") + if(I.w_class > 3) + user << "[I] does not fit!" + return + if(w_items + I.w_class > 5) + user << "The cistern is full!" + return + if(!user.drop_item()) + user << "\The [I] is stuck to your hand, you cannot put it in the cistern!" + return + I.loc = src + w_items += I.w_class + user << "You carefully place [I] into the cistern." + return + + else if(istype(I, /obj/item/weapon/reagent_containers)) if (!open) return var/obj/item/weapon/reagent_containers/RG = I @@ -64,7 +80,7 @@ user << "You fill [RG] from [src]. Gross." return - if(istype(I, /obj/item/weapon/grab)) + else if(istype(I, /obj/item/weapon/grab)) user.changeNext_move(CLICK_CD_MELEE) var/obj/item/weapon/grab/G = I if(!G.confirm()) @@ -95,20 +111,8 @@ else user << "You need a tighter grip!" - if(cistern) - if(I.w_class > 3) - user << "[I] does not fit!" - return - if(w_items + I.w_class > 5) - user << "The cistern is full!" - return - if(!user.drop_item()) - user << "\The [I] is stuck to your hand, you cannot put it in the cistern!" - return - I.loc = src - w_items += I.w_class - user << "You carefully place [I] into the cistern." - return + else + return ..() @@ -137,7 +141,8 @@ GM.adjustBruteLoss(8) else user << "You need a tighter grip!" - + else + return ..() /obj/machinery/shower name = "shower" @@ -418,9 +423,9 @@ if(RG.flags & OPENCONTAINER) RG.reagents.add_reagent("water", min(RG.volume - RG.reagents.total_volume, RG.amount_per_transfer_from_this)) user << "You fill [RG] from [src]." - return + return 1 - if(istype(O, /obj/item/weapon/melee/baton)) + else if(istype(O, /obj/item/weapon/melee/baton)) var/obj/item/weapon/melee/baton/B = O if(B.bcell) if(B.bcell.charge > 0 && B.status == 1) @@ -435,12 +440,12 @@ playsound(src, "sparks", 50, 1) return - if(istype(O, /obj/item/weapon/mop)) + else if(istype(O, /obj/item/weapon/mop)) O.reagents.add_reagent("water", 5) user << "You wet [O] in [src]." playsound(loc, 'sound/effects/slosh.ogg', 25, 1) - if(istype(O, /obj/item/weapon/reagent_containers/food/snacks/monkeycube)) + else if(istype(O, /obj/item/weapon/reagent_containers/food/snacks/monkeycube)) var/obj/item/weapon/reagent_containers/food/snacks/monkeycube/M = O if(M.wrapped) user << "You need to unwrap [src] first!" @@ -458,15 +463,20 @@ if(I.flags & ABSTRACT) //Abstract items like grabs won't wash. No-drop items will though because it's still technically an item in your hand. return - user << "You start washing [I]..." - busy = 1 - if(!do_after(user, 40, target = src)) + if(user.a_intent != "harm") + user << "You start washing [I]..." + busy = 1 + if(!do_after(user, 40, target = src)) + busy = 0 + return 1 busy = 0 - return - busy = 0 - O.clean_blood() - user.visible_message("[user] washes [I] using [src].", \ - "You wash [I] using [src].") + O.clean_blood() + user.visible_message("[user] washes [I] using [src].", \ + "You wash [I] using [src].") + return 1 + else + return ..() + /obj/structure/sink/kitchen name = "kitchen sink" @@ -484,5 +494,5 @@ /obj/structure/sink/puddle/attackby(obj/item/O, mob/user, params) icon_state = "puddle-splash" - ..() + . = ..() icon_state = "puddle" \ No newline at end of file diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm index 4259c94c6eb..bf8b3a9476f 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -12,7 +12,6 @@ var/ini_dir = null var/state = 0 var/reinf = 0 - var/disassembled = 0 var/wtype = "glass" var/fulltile = 0 var/list/storeditems = list() @@ -49,30 +48,28 @@ return -/obj/structure/window/bullet_act(obj/item/projectile/Proj) - if((Proj.damage_type == BRUTE || Proj.damage_type == BURN)) - health -= Proj.damage - update_nearby_icons() - ..() - if(health <= 0) - spawnfragments() - return +/obj/structure/window/bullet_act(obj/item/projectile/P) + . = ..() + take_damage(P.damage, P.damage_type, 0) /obj/structure/window/ex_act(severity, target) - if(severity == 1) - qdel(src) - else - spawnfragments() + switch(severity) + if(1) + qdel(src) + if(2) + shatter() + if(3) + take_damage(rand(25,75), BRUTE, 0) /obj/structure/window/blob_act() - spawnfragments() + shatter() /obj/structure/window/narsie_act() color = "#7D1919" /obj/structure/window/singularity_pull(S, current_size) if(current_size >= STAGE_FIVE) - spawnfragments() + shatter() /obj/structure/window/CanPass(atom/movable/mover, turf/target, height=0) if(istype(mover) && mover.checkpass(PASSGLASS)) @@ -102,20 +99,9 @@ else if(isobj(AM)) var/obj/item/I = AM tforce = I.throwforce - if(reinf) tforce *= 0.25 - - playsound(loc, 'sound/effects/Glasshit.ogg', 100, 1) - health = max(0, health - tforce) - if(health <= 7 && !reinf) - anchored = 0 - update_nearby_icons() - step(src, get_dir(AM, src)) - - if(health <= 0) - spawnfragments() - update_nearby_icons() + take_damage(tforce) /obj/structure/window/attack_tk(mob/user) user.changeNext_move(CLICK_CD_MELEE) @@ -130,7 +116,7 @@ user.say(pick(";RAAAAAAAARGH!", ";HNNNNNNNNNGGGGGGH!", ";GWAAAAAAAARRRHHH!", "NNNNNNNNGGGGGGGGHH!", ";AAAAAAARRRGH!")) user.visible_message("[user] smashes through [src]!") add_fingerprint(user) - hit(50) + take_damage(50) return 1 /obj/structure/window/attack_hand(mob/user) @@ -145,44 +131,28 @@ return attack_hand(user) -/obj/structure/window/proc/attack_generic(mob/user, damage = 0) //used by attack_alien, attack_animal, and attack_slime +/obj/structure/window/proc/attack_generic(mob/user, damage = 0, damage_type = BRUTE) //used by attack_alien, attack_animal, and attack_slime if(!can_be_reached(user)) return + user.do_attack_animation(src) user.changeNext_move(CLICK_CD_MELEE) - health -= damage - if(health <= 0) - user.visible_message("[user] smashes through [src]!") - spawnfragments() - else //for nicer text~ - user.visible_message("[user] smashes into [src]!") - playsound(loc, 'sound/effects/Glasshit.ogg', 100, 1) - + user.visible_message("[user] smashes into [src]!") + take_damage(damage, damage_type) /obj/structure/window/attack_alien(mob/living/user) - user.do_attack_animation(src) - if(islarva(user)) return attack_generic(user, 15) - update_nearby_icons() -/obj/structure/window/attack_animal(mob/living/user) - if(!isanimal(user)) +/obj/structure/window/attack_animal(mob/living/simple_animal/M) + if(!M.melee_damage_upper) return + attack_generic(M, M.melee_damage_upper, M.melee_damage_type) - var/mob/living/simple_animal/M = user - M.do_attack_animation(src) - if(M.melee_damage_upper <= 0 || (M.melee_damage_type != BRUTE && M.melee_damage_type != BURN)) - return - - attack_generic(M, M.melee_damage_upper) - update_nearby_icons() /obj/structure/window/attack_slime(mob/living/simple_animal/slime/user) - user.do_attack_animation(src) if(!user.is_adult) return - attack_generic(user, rand(10, 15)) - update_nearby_icons() + /obj/structure/window/attackby(obj/item/I, mob/living/user, params) if(!can_be_reached(user)) @@ -243,8 +213,8 @@ playsound(loc, 'sound/items/Ratchet.ogg', 75, 1) user << " You begin to disassemble [src]..." if(do_after(user, 40/I.toolspeed, target = src)) - if(disassembled) - return //Prevents multiple deconstruction attempts + if(qdeleted(src)) + return if(reinf) var/obj/item/stack/sheet/rglass/RG = new (user.loc) @@ -261,25 +231,19 @@ G.add_fingerprint(user) playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1) - disassembled = 1 user << "You successfully disassemble [src]." qdel(src) return + return ..() - if(istype(I, /obj/item/weapon/rcd)) //Do not attack the window if the user is holding an RCD - return - if(I.damtype == BRUTE || I.damtype == BURN) - user.changeNext_move(CLICK_CD_MELEE) - hit(I.force) - else - playsound(loc, 'sound/effects/Glasshit.ogg', 75, 1) +/obj/structure/window/attacked_by(obj/item/I, mob/living/user) ..() - return + take_damage(I.force, I.damtype) /obj/structure/window/mech_melee_attack(obj/mecha/M) if(..()) - hit(M.force, 1) + take_damage(M.force, M.damtype) /obj/structure/window/proc/can_be_reached(mob/user) @@ -290,20 +254,27 @@ return 0 return 1 -/obj/structure/window/proc/hit(damage, sound_effect = 1) +/obj/structure/window/proc/take_damage(damage, damage_type = BRUTE, sound_effect = 1) if(reinf) damage *= 0.5 - health = max(0, health - damage) + switch(damage_type) + if(BRUTE) + if(sound_effect) + playsound(loc, 'sound/effects/Glasshit.ogg', 90, 1) + if(BURN) + if(sound_effect) + playsound(src.loc, 'sound/items/Welder.ogg', 100, 1) + else + return + health -= damage update_nearby_icons() - if(sound_effect) - playsound(loc, 'sound/effects/Glasshit.ogg', 75, 1) if(health <= 0) - spawnfragments() - return + shatter() -/obj/structure/window/proc/spawnfragments() - if(qdeleted()) +/obj/structure/window/proc/shatter() + if(qdeleted(src)) return + playsound(src, "shatter", 70, 1) var/turf/T = loc for(var/obj/item/I in storeditems) I.loc = T @@ -378,8 +349,6 @@ /obj/structure/window/Destroy() density = 0 air_update_turf(1) - if(!disassembled && !(flags&NODECONSTRUCT)) - playsound(src, "shatter", 70, 1) update_nearby_icons() return ..() @@ -403,13 +372,9 @@ if(smooth) queue_smooth_neighbors(src) -//merges adjacent full-tile windows into one (blatant ripoff from game/smoothwall.dm) +//merges adjacent full-tile windows into one /obj/structure/window/update_icon() - //A little cludge here, since I don't know how it will work with slim windows. Most likely VERY wrong. - //this way it will only update full-tile ones - //This spawn is here so windows get properly updated when one gets deleted. - spawn(2) - if(!src) return + if(!qdeleted(src)) //phil235 if(!fulltile) return @@ -427,7 +392,7 @@ /obj/structure/window/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume) if(exposed_temperature > T0C + (reinf ? 1600 : 800)) - hit(round(exposed_volume / 100), 0) + take_damage(round(exposed_volume / 100), BURN, 0) ..() /obj/structure/window/storage_contents_dump_act(obj/item/weapon/storage/src_object, mob/user) @@ -448,16 +413,6 @@ maxhealth = 50 explosion_block = 1 -/obj/structure/window/reinforced/ex_act(severity, target) - switch(severity) - if(1) - qdel(src) - if(2) - spawnfragments() - if(3) - if(prob(50)) - spawnfragments() - /obj/structure/window/reinforced/tinted name = "tinted window" icon_state = "twindow" diff --git a/code/modules/vehicles/pimpin_ride.dm b/code/modules/vehicles/pimpin_ride.dm index b1d1e5a3af8..356c5ca354d 100644 --- a/code/modules/vehicles/pimpin_ride.dm +++ b/code/modules/vehicles/pimpin_ride.dm @@ -60,20 +60,19 @@ /obj/vehicle/janicart/attackby(obj/item/I, mob/user, params) if(istype(I, /obj/item/weapon/storage/bag/trash)) - if(keytype == /obj/item/key/janitor) - if(!user.drop_item()) - return - user << "You hook the trashbag onto \the [name]." - I.loc = src - mybag = I + if(!user.drop_item()) + return + user << "You hook the trashbag onto \the [name]." + I.loc = src + mybag = I + update_icon() else if(istype(I, /obj/item/janiupgrade)) - if(keytype == /obj/item/key/janitor) - floorbuffer = 1 - qdel(I) - user << "You upgrade \the [name] with the floor buffer." - update_icon() - - ..() + floorbuffer = 1 + qdel(I) + user << "You upgrade \the [name] with the floor buffer." + update_icon() + else + return ..() /obj/vehicle/janicart/update_icon()