Files
Yogstation/code/game/turfs/simulated/walls.dm
Mqiib 16df09cc53 Fixes mech bump smash using sword attack (#16831)
* 2 out of 14

need to go to bed

* ok fine turdis be like that
2022-12-02 14:14:43 +00:00

319 lines
8.7 KiB
Plaintext

#define MAX_DENT_DECALS 15
/turf/closed/wall
name = "wall"
desc = "A huge chunk of metal used to separate rooms."
icon = 'icons/turf/walls/wall.dmi'
icon_state = "wall"
explosion_block = 1
thermal_conductivity = WALL_HEAT_TRANSFER_COEFFICIENT
heat_capacity = 312500 //a little over 5 cm thick , 312500 for 1 m by 2.5 m by 0.25 m plasteel wall
baseturfs = /turf/open/floor/plating
FASTDMM_PROP(\
pipe_astar_cost = 50 /* nich really doesn't like pipes that go through walls */\
)
var/hardness = 30 //lower numbers are harder. Used to determine the probability of a hulk smashing through.
var/slicing_duration = 200 //default time taken to slice the wall
var/sheet_type = /obj/item/stack/sheet/metal
var/sheet_amount = 2
var/girder_type = /obj/structure/girder
canSmoothWith = list(
/turf/closed/wall,
/turf/closed/wall/r_wall,
/obj/structure/falsewall,
/obj/structure/falsewall/brass,
/obj/structure/falsewall/reinforced,
/turf/closed/wall/rust,
/turf/closed/wall/r_wall/rust,
/turf/closed/wall/clockwork)
smooth = SMOOTH_TRUE
var/list/dent_decals
/turf/closed/wall/Initialize(mapload)
. = ..()
if(is_station_level(z))
GLOB.station_turfs += src
/turf/closed/wall/Destroy()
if(is_station_level(z))
GLOB.station_turfs -= src
..()
/turf/closed/wall/examine(mob/user)
. += ..()
. += deconstruction_hints(user)
/turf/closed/wall/proc/deconstruction_hints(mob/user)
return span_notice("The outer plating is <b>welded</b> firmly in place.")
/turf/closed/wall/attack_tk()
return
/turf/closed/wall/handle_ricochet(obj/item/projectile/P) //A huge pile of shitcode!
var/turf/p_turf = get_turf(P)
var/face_direction = get_dir(src, p_turf)
var/face_angle = dir2angle(face_direction)
var/incidence_s = GET_ANGLE_OF_INCIDENCE(face_angle, (P.Angle + 180))
if(abs(incidence_s) > 90 && abs(incidence_s) < 270)
return FALSE
var/new_angle_s = SIMPLIFY_DEGREES(face_angle + incidence_s)
P.setAngle(new_angle_s)
return TRUE
/turf/closed/wall/proc/dismantle_wall(devastated=0, explode=0)
if(devastated)
devastate_wall()
else
playsound(src, 'sound/items/welder.ogg', 100, 1)
var/newgirder = break_wall()
if(newgirder) //maybe we don't /want/ a girder!
transfer_fingerprints_to(newgirder)
for(var/obj/O in src.contents) //Eject contents!
if(istype(O, /obj/structure/sign/poster))
var/obj/structure/sign/poster/P = O
P.roll_and_drop(src)
var/turf/new_floor = ScrapeAway()
new_floor.air_update_turf()
/turf/closed/wall/proc/break_wall()
new sheet_type(src, sheet_amount)
return new girder_type(src)
/turf/closed/wall/proc/devastate_wall()
new sheet_type(src, sheet_amount)
if(girder_type)
new /obj/item/stack/sheet/metal(src)
/turf/closed/wall/ex_act(severity, target)
if(target == src)
dismantle_wall(1,1)
return
switch(severity)
if(1)
//SN src = null
var/turf/NT = ScrapeAway()
NT.contents_explosion(severity, target)
return
if(2)
if (prob(50))
dismantle_wall(0,1)
else
dismantle_wall(1,1)
if(3)
if (prob(hardness))
dismantle_wall(0,1)
if(!density)
..()
/turf/closed/wall/blob_act(obj/structure/blob/B)
if(prob(50))
dismantle_wall()
else
add_dent(WALL_DENT_HIT)
/turf/closed/wall/mech_melee_attack(obj/mecha/M, equip_allowed)
M.do_attack_animation(src)
switch(M.damtype)
if(BRUTE)
playsound(src, 'sound/weapons/punch4.ogg', 50, 1)
visible_message(span_danger("[M.name] has hit [src]!"), null, null, COMBAT_MESSAGE_RANGE)
if(prob(hardness + M.force) && M.force > 20)
dismantle_wall(1)
playsound(src, 'sound/effects/meteorimpact.ogg', 100, 1)
else
add_dent(WALL_DENT_HIT)
if(BURN)
playsound(src, 'sound/items/welder.ogg', 100, 1)
if(TOX)
playsound(src, 'sound/effects/spray2.ogg', 100, 1)
return FALSE
/turf/closed/wall/attack_paw(mob/living/user)
user.changeNext_move(CLICK_CD_MELEE)
return attack_hand(user)
/turf/closed/wall/attack_animal(mob/living/simple_animal/M)
M.changeNext_move(CLICK_CD_MELEE)
M.do_attack_animation(src)
if((M.environment_smash & ENVIRONMENT_SMASH_WALLS) || (M.environment_smash & ENVIRONMENT_SMASH_RWALLS))
playsound(src, 'sound/effects/meteorimpact.ogg', 100, 1)
dismantle_wall(1)
return
/turf/closed/wall/attack_hulk(mob/user, does_attack_animation = 0)
..(user, 1)
if(prob(hardness))
playsound(src, 'sound/effects/meteorimpact.ogg', 100, 1)
user.say(pick(";RAAAAAAAARGH!", ";HNNNNNNNNNGGGGGGH!", ";GWAAAAAAAARRRHHH!", "NNNNNNNNGGGGGGGGHH!", ";AAAAAAARRRGH!" ), forced = "hulk")
dismantle_wall(1)
else
playsound(src, 'sound/effects/bang.ogg', 50, 1)
add_dent(WALL_DENT_HIT)
to_chat(user, span_notice("You punch the wall."))
return TRUE
/turf/closed/wall/attack_hand(mob/user)
. = ..()
if(.)
return
user.changeNext_move(CLICK_CD_MELEE)
to_chat(user, span_notice("You push the wall but nothing happens!"))
playsound(src, 'sound/weapons/genhit.ogg', 25, 1)
add_fingerprint(user)
/turf/closed/wall/attackby(obj/item/W, mob/user, params)
user.changeNext_move(CLICK_CD_MELEE)
if (!user.IsAdvancedToolUser())
to_chat(user, span_warning("You don't have the dexterity to do this!"))
return
//get the user's location
if(!isturf(user.loc))
return //can't do this stuff whilst inside objects and such
add_fingerprint(user)
var/turf/T = user.loc //get user's location for delay checks
//the istype cascade has been spread among various procs for easy overriding
if(try_clean(W, user, T) || try_wallmount(W, user, T) || try_decon(W, user, T))
return
return ..()
/turf/closed/wall/proc/try_clean(obj/item/W, mob/user, turf/T)
if((user.a_intent != INTENT_HELP) || !LAZYLEN(dent_decals))
return FALSE
if(W.tool_behaviour == TOOL_WELDER)
if(!W.tool_start_check(user, amount=0))
return FALSE
to_chat(user, span_notice("You begin fixing dents on the wall..."))
if(W.use_tool(src, user, 0, volume=100))
if(iswallturf(src) && LAZYLEN(dent_decals))
to_chat(user, span_notice("You fix some dents on the wall."))
cut_overlay(dent_decals)
dent_decals.Cut()
return TRUE
return FALSE
/turf/closed/wall/proc/try_wallmount(obj/item/W, mob/user, turf/T)
//check for wall mounted frames
if(istype(W, /obj/item/wallframe))
var/obj/item/wallframe/F = W
if(F.try_build(src, user))
F.attach(src, user)
return TRUE
//Poster stuff
else if(istype(W, /obj/item/poster))
place_poster(W,user)
return TRUE
//Borg Poster STuff
else if(istype(W, /obj/item/wantedposterposter))
place_borg_poster(W, user)
return FALSE
/turf/closed/wall/proc/try_decon(obj/item/I, mob/user, turf/T)
if(I.tool_behaviour == TOOL_WELDER)
if(!I.tool_start_check(user, amount=0))
return FALSE
to_chat(user, span_notice("You begin slicing through the outer plating..."))
if(I.use_tool(src, user, slicing_duration, volume=100))
if(iswallturf(src))
to_chat(user, span_notice("You remove the outer plating."))
dismantle_wall()
return TRUE
return FALSE
/turf/closed/wall/singularity_pull(S, current_size)
..()
if(current_size >= STAGE_FIVE)
if(prob(50))
dismantle_wall()
return
if(current_size == STAGE_FOUR)
if(prob(30))
dismantle_wall()
/turf/closed/wall/narsie_act(force, ignore_mobs, probability = 20)
. = ..()
if(.)
ChangeTurf(/turf/closed/wall/mineral/cult)
/turf/closed/wall/ratvar_act(force, ignore_mobs)
. = ..()
if(.)
ChangeTurf(/turf/closed/wall/clockwork)
/turf/closed/wall/honk_act()
ChangeTurf(/turf/closed/wall/mineral/bananium)
/turf/closed/wall/get_dumping_location(obj/item/storage/source, mob/user)
return null
/turf/closed/wall/acid_act(acidpwr, acid_volume)
if(explosion_block >= 2)
acidpwr = min(acidpwr, 50) //we reduce the power so strong walls never get melted.
. = ..()
/turf/closed/wall/acid_melt()
dismantle_wall(1)
/turf/closed/wall/rcd_vals(mob/user, obj/item/construction/rcd/the_rcd)
switch(the_rcd.mode)
if(RCD_DECONSTRUCT)
return list("mode" = RCD_DECONSTRUCT, "delay" = 40, "cost" = 26)
return FALSE
/turf/closed/wall/rcd_act(mob/user, obj/item/construction/rcd/the_rcd, passed_mode)
switch(passed_mode)
if(RCD_DECONSTRUCT)
to_chat(user, span_notice("You deconstruct the wall."))
ScrapeAway()
return TRUE
return FALSE
/turf/closed/wall/proc/add_dent(denttype, x=rand(-8, 8), y=rand(-8, 8))
if(LAZYLEN(dent_decals) >= MAX_DENT_DECALS)
return
var/mutable_appearance/decal = mutable_appearance('icons/effects/effects.dmi', "", BULLET_HOLE_LAYER)
switch(denttype)
if(WALL_DENT_SHOT)
decal.icon_state = "bullet_hole"
if(WALL_DENT_HIT)
decal.icon_state = "impact[rand(1, 3)]"
decal.pixel_x = x
decal.pixel_y = y
if(LAZYLEN(dent_decals))
cut_overlay(dent_decals)
dent_decals += decal
else
dent_decals = list(decal)
add_overlay(dent_decals)
/turf/closed/wall/rust_heretic_act()
if(prob(70))
new /obj/effect/glowing_rune(src)
ChangeTurf(/turf/closed/wall/rust)
#undef MAX_DENT_DECALS