Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] Gun rack parts fix #1400

Merged
merged 16 commits into from
Aug 1, 2024
81 changes: 69 additions & 12 deletions modular_ss220/aesthetics/racks/code/racks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
icon = 'modular_ss220/aesthetics/racks/icons/racks.dmi'

/obj/structure/rack/gunrack
name = "gun rack"
desc = "A gun rack for storing guns."
name = "оружейная стойка"
skifsky marked this conversation as resolved.
Show resolved Hide resolved
desc = "Стойка для хранения оружия."
icon_state = "gunrack"

/obj/item/gun
Expand All @@ -27,7 +27,7 @@

/obj/structure/rack/gunrack/MouseDrop_T(obj/O, mob/user)
if(!(istype(O, /obj/item/gun)))
to_chat(user, span_warning("This item doesn't fit!"))
to_chat(user, span_warning("Этот предмет не помещается!"))
return
. = ..()
if(.)
Expand All @@ -37,7 +37,7 @@

/obj/structure/rack/gunrack/attackby(obj/item/W, mob/user, params) //TODO: fix logic
if(!(istype(W, /obj/item/gun)))
to_chat(user, span_warning("This item doesn't fit!"))
to_chat(user, span_warning("Этот предмет не помещается!"))
return
. = ..()
if(W.loc == get_turf(src))
Expand All @@ -62,19 +62,76 @@
/obj/structure/rack/gunrack/deconstruct(disassembled = TRUE)
if(!(flags & NODECONSTRUCT))
density = FALSE
var/obj/item/gunrack_parts/newparts = new(loc)
var/obj/item/rack_parts/gunrack_parts/newparts = new(loc)
transfer_fingerprints_to(newparts)
for(var/obj/item/I in loc.contents)
if(istype(I, /obj/item/gun))
var/obj/item/gun/to_remove = I
to_remove.remove_from_rack()
qdel(src)

/obj/item/gunrack_parts
name = "gun rack parts"
desc = "Parts of a gun rack."
icon = 'icons/obj/items.dmi'
/obj/item/rack_parts/gunrack_parts
skifsky marked this conversation as resolved.
Show resolved Hide resolved
name = "детали оружейной стойки"
desc = "Детали для сборки оружейной стойки."
icon = 'modular_ss220/aesthetics/racks/icons/racks.dmi'
icon_state = "gunrack_parts"
flags = CONDUCT
materials = list(MAT_METAL=2000)
var/building = FALSE

/obj/item/rack_parts/gunrack_parts/attack_self(mob/user)
if(building)
return
building = TRUE
to_chat(user, span_notice("Вы начинаете собирать оружейную стойку..."))
if(do_after(user, 50, target = user, progress=TRUE) && user.drop_item(src))
var/obj/structure/rack/gunrack/G = new /obj/structure/rack/gunrack(user.loc)
user.visible_message(span_notice("[user] собирает оружейную стойку."), span_notice("Вы закончили собирать оружейную стойку."))
G.add_fingerprint(user)
building = FALSE
qdel(src)
else
building = FALSE
return

/obj/structure/rack/shelving
name = "стеллаж"
desc = "Стеллаж для хранения различных вещей."
icon_state = "shelving"

/obj/structure/rack/shelving/attackby(obj/item/V, mob/user, params)
. = ..()
if(V.loc == get_turf(src))
add_fingerprint(user)
var/list/click_params = params2list(params)
//Center the icon where the user clicked.
if(!click_params || !click_params["icon-x"] || !click_params["icon-y"])
return
//Clamp it so that the icon never moves more than 16 pixels in either direction (thus leaving the table turf)
V.pixel_x = clamp(text2num(click_params["icon-x"]) - 16, -(world.icon_size/2), world.icon_size/2)
V.pixel_y = clamp(text2num(click_params["icon-y"]) - 16, -(world.icon_size/2), world.icon_size/2)

/obj/structure/rack/shelving/deconstruct(disassembled = TRUE)
if(!(flags & NODECONSTRUCT))
density = FALSE
var/obj/item/rack_parts/shelving_parts/newparts = new(loc)
transfer_fingerprints_to(newparts)
qdel(src)
skifsky marked this conversation as resolved.
Show resolved Hide resolved

/obj/item/rack_parts/shelving_parts
skifsky marked this conversation as resolved.
Show resolved Hide resolved
name = "детали стеллажа"
desc = "Детали для сборки стеллажа."
icon = 'modular_ss220/aesthetics/racks/icons/racks.dmi'
icon_state = "shelving_parts"

/obj/item/rack_parts/shelving_parts/attack_self(mob/user)
if(building)
return
building = TRUE
to_chat(user, span_notice("Вы начинаете собирать стеллаж..."))
if(do_after(user, 50, target = user, progress=TRUE) && user.drop_item(src))
var/obj/structure/rack/shelving/S = new /obj/structure/rack/shelving(user.loc)
user.visible_message(span_notice("[user] собирает стеллаж."), span_notice("Вы закончили собирать стеллаж."))
S.add_fingerprint(user)
building = FALSE
skifsky marked this conversation as resolved.
Show resolved Hide resolved
qdel(src)
else
building = FALSE
return
Binary file modified modular_ss220/aesthetics/racks/icons/racks.dmi
Binary file not shown.
Loading