Skip to content

Commit

Permalink
Add platforms (#780)
Browse files Browse the repository at this point in the history
Добавил платформы. Потестил на локалке.
  • Loading branch information
dj-34 authored Nov 22, 2024
1 parent 50d5ca4 commit 568178d
Show file tree
Hide file tree
Showing 4 changed files with 230 additions and 3 deletions.
54 changes: 51 additions & 3 deletions _maps/map_files/Cyberiad/Cyberiad.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -2460,6 +2460,9 @@
/obj/effect/turf_decal/siding/thinplating_new/corner{
dir = 8
},
/obj/structure/platform{
dir = 1
},
/turf/open/floor/iron/half,
/area/station/commons/dorms)
"aHB" = (
Expand Down Expand Up @@ -13038,6 +13041,12 @@
/obj/machinery/airalarm/directional/south,
/turf/open/floor/iron,
/area/station/hallway/secondary/exit/departure_lounge)
"drz" = (
/obj/structure/platform/corner{
dir = 8
},
/turf/open/floor/wood,
/area/station/security/courtroom)
"drA" = (
/obj/structure/table/reinforced,
/obj/item/stack/sheet/glass{
Expand Down Expand Up @@ -20365,6 +20374,9 @@
/obj/structure/chair/pew/left{
dir = 8
},
/obj/structure/platform{
dir = 4
},
/turf/open/floor/wood,
/area/station/security/courtroom)
"frn" = (
Expand Down Expand Up @@ -32288,6 +32300,9 @@
/obj/effect/turf_decal/tile/dark/half{
dir = 4
},
/obj/structure/platform/corner{
dir = 8
},
/turf/open/floor/iron/half{
dir = 8
},
Expand Down Expand Up @@ -43838,6 +43853,12 @@
/obj/effect/decal/cleanable/generic,
/turf/open/floor/iron/dark,
/area/station/maintenance/starboard/fore)
"lEr" = (
/obj/structure/platform{
dir = 5
},
/turf/open/floor/wood,
/area/station/security/courtroom)
"lEt" = (
/obj/effect/turf_decal/tile/red{
dir = 4
Expand Down Expand Up @@ -45349,6 +45370,15 @@
},
/turf/open/floor/iron/dark,
/area/station/science/genetics)
"lYh" = (
/obj/structure/chair/pew/right{
dir = 8
},
/obj/structure/platform{
dir = 4
},
/turf/open/floor/wood,
/area/station/security/courtroom)
"lYr" = (
/obj/machinery/conveyor{
dir = 8;
Expand Down Expand Up @@ -47077,6 +47107,9 @@
/obj/effect/turf_decal/tile/dark/half{
dir = 8
},
/obj/structure/platform{
dir = 8
},
/turf/open/floor/iron/half{
dir = 8
},
Expand Down Expand Up @@ -55747,6 +55780,9 @@
/obj/effect/turf_decal/tile/dark/half{
dir = 4
},
/obj/structure/platform{
dir = 4
},
/turf/open/floor/iron/half{
dir = 8
},
Expand Down Expand Up @@ -63459,6 +63495,9 @@
/obj/effect/turf_decal/tile/dark/half{
dir = 8
},
/obj/structure/platform{
dir = 8
},
/turf/open/floor/iron/half{
dir = 8
},
Expand Down Expand Up @@ -71885,6 +71924,9 @@
/obj/effect/turf_decal/tile/dark/half{
dir = 4
},
/obj/structure/platform{
dir = 4
},
/turf/open/floor/iron/half{
dir = 8
},
Expand Down Expand Up @@ -78146,6 +78188,9 @@
/obj/effect/turf_decal/tile/dark/half{
dir = 8
},
/obj/structure/platform/corner{
dir = 4
},
/turf/open/floor/iron/half{
dir = 8
},
Expand Down Expand Up @@ -87793,6 +87838,9 @@
dir = 1
},
/obj/effect/turf_decal/siding/thinplating_new,
/obj/structure/platform{
dir = 1
},
/turf/open/floor/iron/half,
/area/station/commons/dorms)
"xye" = (
Expand Down Expand Up @@ -183191,8 +183239,8 @@ vHm
rmt
acI
frm
ndP
nEb
lYh
drz
swp
nEb
ciD
Expand Down Expand Up @@ -183449,7 +183497,7 @@ qnT
wpn
tED
xIr
nEb
lEr
swp
nEb
nEb
Expand Down
1 change: 1 addition & 0 deletions modular_bandastation/objects/_objects.dme
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "code/hampters.dm"
#include "code/material_pouch.dm"
#include "code/papershredder.dm"
#include "code/platform.dm"
#include "code/wallets.dm"

#include "code/clothing/head/hat.dm"
Expand Down
178 changes: 178 additions & 0 deletions modular_bandastation/objects/code/platform.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
// Almost copypaste from railings
/obj/structure/platform
name = "platform"
desc = "A metal platform."
icon = 'modular_bandastation/objects/icons/platform.dmi'
icon_state = "metal"
flags_1 = ON_BORDER_1
obj_flags = CAN_BE_HIT | IGNORE_DENSITY
pass_flags_self = LETPASSTHROW | PASSSTRUCTURE
density = TRUE
anchored = TRUE
armor_type = /datum/armor/platform
max_integrity = 200
var/climbable = TRUE
var/corner = FALSE
var/material_type = /obj/item/stack/sheet/iron
var/material_amount = 4

/datum/armor/platform
melee = 10
bullet = 10
laser = 10
energy = 50
bomb = 20
fire = 100
acid = 30

/obj/structure/platform/Initialize(mapload)
. = ..()
if(climbable)
AddElement(/datum/element/climbable)
if(density && flags_1 & ON_BORDER_1) // blocks normal movement from and to the direction it's facing.
var/static/list/loc_connections = list(
COMSIG_ATOM_EXIT = PROC_REF(on_exit),
)
AddElement(/datum/element/connect_loc, loc_connections)
var/static/list/tool_behaviors = list(
TOOL_WELDER = list(
SCREENTIP_CONTEXT_LMB = "Repair",
),
TOOL_WRENCH = list(
SCREENTIP_CONTEXT_LMB = "Anchor/Unanchor",
),
TOOL_SCREWDRIVER = list(
SCREENTIP_CONTEXT_LMB = "Deconstruct",
),
)
AddElement(/datum/element/contextual_screentip_tools, tool_behaviors)

AddComponent(/datum/component/simple_rotation, ROTATION_NEEDS_ROOM)
CheckLayer()

/obj/structure/platform/New()
..()
if(corner)
density = FALSE
CheckLayer()

/obj/structure/platform/examine(mob/user)
. = ..()
. += span_notice("[src] is [anchored ? "screwed" : "unscrewed"] [anchored ? "to" : "from"] the floor.")

// Repairing
/obj/structure/platform/attackby(obj/item/I, mob/living/user, params)
..()
add_fingerprint(user)

if(I.tool_behaviour == TOOL_WELDER && !user.combat_mode)
if(atom_integrity < max_integrity)
if(!I.tool_start_check(user, amount=1))
return

to_chat(user, span_notice("You begin repairing [src]..."))
if(I.use_tool(src, user, 40, volume = 50))
atom_integrity = max_integrity
to_chat(user, span_notice("You repair [src]."))
else
to_chat(user, span_warning("[src] is already in good condition!"))
return

// Anchoring
/obj/structure/platform/wrench_act(mob/user, obj/item/I)
. = ..()
to_chat(user, span_notice("You begin to [anchored ? "unfasten [src] from" : "fasten [src] to"] the floor..."))
if(I.use_tool(src, user, volume = 75, extra_checks = CALLBACK(src, PROC_REF(check_anchored), anchored)))
set_anchored(!anchored)
to_chat(user, span_notice("You [anchored ? "fasten [src] to" : "unfasten [src] from"] the floor."))
return TRUE

// Dismantle
/obj/structure/platform/screwdriver_act(mob/user, obj/item/I)
if(resistance_flags & INDESTRUCTIBLE)
to_chat(user, span_warning("You try to dismantle [src], but it's too hard!"))
I.play_tool_sound(src, 100)
return TRUE
to_chat(user, span_warning("You dismantle [src]."))
I.play_tool_sound(src, 100)
deconstruct()
return TRUE

/obj/structure/platform/atom_deconstruct(disassembled)
var/obj/sheet = new material_type(drop_location(), material_amount)
transfer_fingerprints_to(sheet)

/obj/structure/platform/proc/on_exit(datum/source, atom/movable/leaving, direction)
SIGNAL_HANDLER
if(leaving == src)
return // Let's not block ourselves.
if(!(direction & dir))
return
if(!density)
return
if(leaving.throwing)
return
if(leaving.movement_type & (PHASING|MOVETYPES_NOT_TOUCHING_GROUND))
return
if(leaving.move_force >= MOVE_FORCE_EXTREMELY_STRONG)
return
leaving.Bump(src)
return COMPONENT_ATOM_BLOCK_EXIT

/obj/structure/platform/CanPass(atom/movable/mover, border_dir)
. = ..()
if(border_dir & dir)
return . || mover.throwing || (mover.movement_type & MOVETYPES_NOT_TOUCHING_GROUND)
return TRUE

/obj/structure/platform/CanAStarPass(to_dir, datum/can_pass_info/pass_info)
if(!(to_dir & dir))
return TRUE
return ..()

/obj/structure/platform/setDir(newdir)
. = ..()
CheckLayer()

/obj/structure/platform/proc/CheckLayer()
if(dir == SOUTH)
layer = ABOVE_MOB_LAYER
else if(corner || dir == NORTH)
layer = BELOW_MOB_LAYER

/obj/structure/platform/proc/check_anchored(checked_anchored)
if(anchored == checked_anchored)
return TRUE

// Platform types
/obj/structure/platform/reinforced
name = "reinforced platform"
desc = "A robust platform made of plasteel, more resistance for hazard sites."
icon_state = "plasteel"
material_type = /obj/item/stack/sheet/plasteel
armor_type = /datum/armor/platform_reinforced
max_integrity = 300

/datum/armor/platform_reinforced
melee = 20
bullet = 30
laser = 30
energy = 100
bomb = 75
fire = 100
acid = 100

// Platform corners
/obj/structure/platform/corner
name = "platform corner"
desc = "A metal platform corner."
icon_state = "metalcorner"
corner = TRUE
material_amount = 2

/obj/structure/platform/reinforced/corner
name = "reinforced platform corner"
desc = "A robust platform corner made of plasteel, more resistance for hazard sites."
icon_state = "plasteelcorner"
corner = TRUE
material_amount = 2
Binary file added modular_bandastation/objects/icons/platform.dmi
Binary file not shown.

0 comments on commit 568178d

Please sign in to comment.