Skip to content

Commit

Permalink
Add: Platforms (#178)
Browse files Browse the repository at this point in the history
<!-- Пишите **НИЖЕ** заголовков и **ВЫШЕ** комментариев, иначе что то
может пойти не так. -->
<!-- Вы можете прочитать Contributing.MD, если хотите узнать больше. -->

## Что этот PR делает
Добавляет платформы (2 варианта), которые можно скрафтить. Работают по
принципу с railing.
ПР был взят отсюда. Спрайты были перекрашены, код малость дополнен
Helixis#787

## Почему это хорошо для игры
Больше декоративных решений

## Изображения изменений
(Примеры использования)


![image](https://github.com/ss220club/Paradise-SS220/assets/20109643/17690f12-b7e1-46f9-a7bd-072197463e76)

![image](https://github.com/ss220club/Paradise-SS220/assets/20109643/84e06745-48e1-44bb-95f1-326f6fd9ec52)

![image](https://github.com/ss220club/Paradise-SS220/assets/20109643/95ac559d-5743-4bfa-b1cd-07473f1b683a)

![image](https://github.com/ss220club/Paradise-SS220/assets/20109643/981f681f-f53c-42b8-a17e-6c6b0be5d6f4)

## Тестирование
Проверял в игре

## Changelog

:cl:
add: Платформы
/:cl:

<!-- Оба :cl:'а должны быть на месте, что-бы чейнджлог работал! Вы
можете написать свой ник справа от первого :cl:, если хотите. Иначе
будет использован ваш ник на ГитХабе. -->
<!-- Вы можете использовать несколько записей с одинаковым префиксом
(Они используются только для иконки в игре) и удалить ненужные. Помните,
что чейнджлог должен быть понятен обычным игроком. -->
<!-- Если чейнджлог не влияет на игроков(например, это рефактор), вы
можете исключить всю секцию. -->
  • Loading branch information
dj-34 authored Sep 16, 2023
1 parent 41ecb9a commit f4bcd1a
Show file tree
Hide file tree
Showing 5 changed files with 228 additions and 0 deletions.
1 change: 1 addition & 0 deletions modular_ss220/modular_ss220.dme
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "food/_food.dme"
#include "gateway/_gateway.dme"
#include "hydroponics/hydroponics.dme"
#include "objects/_objects.dme"
#include "sechailer/sechailer.dme"
#include "unique_objects/_unique_objects.dme"
#include "vending/vending.dme"
Expand Down
16 changes: 16 additions & 0 deletions modular_ss220/objects/_objects.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/datum/modpack/objects
name = "Объекты"
desc = "В основном включает в себя портированные объекты и всякие мелочи, которым не нужен отдельный модпак."
author = "dj-34"

// Maybe it would be better, if i didn't make it modular, because i can't change order in the recipe list :catDespair:
/datum/modpack/objects/initialize()
GLOB.metal_recipes += list(
new /datum/stack_recipe("metal platform", /obj/structure/platform, 4, time = 30,one_per_turf = TRUE, on_floor = TRUE),
new /datum/stack_recipe("metal platform corner", /obj/structure/platform/corner, 2, time = 20, one_per_turf = TRUE, on_floor = TRUE)
)

GLOB.plasteel_recipes += list(
new /datum/stack_recipe("reinforced plasteel platform", /obj/structure/platform/reinforced, 4, time = 40,one_per_turf = TRUE, on_floor = TRUE),
new /datum/stack_recipe("reinforced plasteel platform corner", /obj/structure/platform/reinforced/corner, 2, time = 30,one_per_turf = TRUE, on_floor = TRUE)
)
3 changes: 3 additions & 0 deletions modular_ss220/objects/_objects.dme
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include "_objects.dm"

#include "code/platform.dm"
208 changes: 208 additions & 0 deletions modular_ss220/objects/code/platform.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,208 @@
// Platform Code by Danaleja2005
/obj/structure/platform
name = "platform"
icon = 'modular_ss220/objects/icons/platform.dmi'
icon_state = "metal"
desc = "A metal platform."
flags = ON_BORDER
anchored = FALSE
climbable = TRUE
max_integrity = 200
armor = list("melee" = 10, "bullet" = 10, "laser" = 10, "energy" = 50, "bomb" = 20, "bio" = 0, "rad" = 0, "fire" = 30, "acid" = 30)
var/corner = FALSE
var/material_type = /obj/item/stack/sheet/metal
var/material_amount = 4
var/decon_speed

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

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

/obj/structure/platform/Initialize()
. = ..()
CheckLayer()

/obj/structure/platform/New()
..()
if(corner)
decon_speed = 20
density = FALSE
climbable = FALSE
else
decon_speed = 30
CheckLayer()

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

/obj/structure/platform/verb/rotate()
set name = "Rotate Platform Counter-Clockwise"
set category = "Object"
set src in oview(1)

if(usr.incapacitated())
return

if(anchored)
to_chat(usr, span_warning("[src] cannot be rotated while it is screwed to the floor!"))
return FALSE

var/target_dir = turn(dir, 90)

setDir(target_dir)
air_update_turf(1)
add_fingerprint(usr)
return TRUE

/obj/structure/platform/verb/revrotate()
set name = "Rotate Platform Clockwise"
set category = "Object"
set src in oview(1)

if(usr.incapacitated())
return

if(anchored)
to_chat(usr, span_warning("[src] cannot be rotated while it is screwed to the floor!"))
return FALSE

var/target_dir = turn(dir, 270)

setDir(target_dir)
air_update_turf(1)
add_fingerprint(usr)
return TRUE

/obj/structure/platform/AltClick(mob/user)
rotate()

// Construction
/obj/structure/platform/screwdriver_act(mob/user, obj/item/I)
. = TRUE
to_chat(user, span_notice("You begin [anchored == TRUE ? "unscrewing" : "screwing"] [src] [anchored == TRUE ? "from" : "to"] the floor."))
if(!I.use_tool(src, user, decon_speed, volume = I.tool_volume))
return
to_chat(user, span_notice("You [anchored == TRUE ? "unscrew" : "screw"] [src] [anchored == TRUE ? "from" : "to"] the floor."))
anchored = !anchored

/obj/structure/platform/wrench_act(mob/user, obj/item/I)
if(user.a_intent != INTENT_HELP)
return
. = TRUE
if(anchored)
to_chat(user, span_notice("You cannot disassemble [src], unscrew it first!"))
return
TOOL_ATTEMPT_DISMANTLE_MESSAGE
if(!I.use_tool(src, user, decon_speed, volume = I.tool_volume))
return
var/obj/item/stack/sheet/G = new material_type(user.loc, material_amount)
G.add_fingerprint(user)
playsound(src, 'sound/items/deconstruct.ogg', 50, 1)
TOOL_DISMANTLE_SUCCESS_MESSAGE
qdel(src)


/obj/structure/platform/CheckExit(atom/movable/O, turf/target)
if(!anchored)
CheckLayer()
if(istype(O, /obj/structure/platform))
return FALSE
if(istype(O, /obj/item/projectile))
return TRUE
if(corner)
return !density
if(O && O.throwing)
return TRUE
if(((flags & ON_BORDER) && get_dir(loc, target) == dir))
return FALSE
else
return TRUE

/obj/structure/platform/CanPass(atom/movable/mover, turf/target)
if(!anchored)
CheckLayer()
if(istype(mover, /obj/structure/platform))
return FALSE
if(istype(mover, /obj/item/projectile))
return TRUE
if(corner)
return !density
if(mover && mover.throwing)
return TRUE
var/obj/structure/S = locate(/obj/structure) in get_turf(mover)
if(S && S.climbable && !(S.flags & ON_BORDER) && climbable && isliving(mover))// Climbable objects allow you to universally climb over others
return TRUE
if(!(flags & ON_BORDER) || get_dir(loc, target) == dir)
return FALSE
else
return TRUE

/obj/structure/platform/do_climb(mob/living/user)
if(!can_touch(user) || !climbable)
return
var/blocking_object = density_check()
if(blocking_object)
to_chat(user, span_warning("You cannot climb over [src], as it is blocked by \a [blocking_object]!"))
return

var/destination_climb = get_step(src, dir)
if(is_blocked_turf(destination_climb))
to_chat(user, span_warning("You cannot climb over [src], the path is blocked!"))
return
var/turf/T = src.loc
if(!T || !istype(T)) return

if(get_turf(user) == get_turf(src))
usr.visible_message(span_warning("[user] starts climbing over \the [src]!"))
else
usr.visible_message(span_warning("[user] starts getting off \the [src]!"))
climber = user
if(!do_after(user, 50, target = src))
climber = null
return

if(!can_touch(user) || !climbable)
climber = null
return

if(get_turf(user) == get_turf(src))
usr.loc = get_step(src, dir)
usr.visible_message(span_warning("[user] leaves \the [src]!"))
else
usr.loc = get_turf(src)
usr.visible_message(span_warning("[user] starts climbing over \the [src]!"))
climber = null

/obj/structure/platform/CanAtmosPass()
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
max_integrity = 300
armor = list("melee" = 20, "bullet" = 30, "laser" = 30, "energy" = 100, "bomb" = 50, "bio" = 0, "rad" = 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_ss220/objects/icons/platform.dmi
Binary file not shown.

0 comments on commit f4bcd1a

Please sign in to comment.