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

4 Стикера #13652

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion code/game/objects/structures/crates_lockers/closets.dm
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
for(var/obj/item/I in src.loc)
if(itemcount >= storage_capacity)
break
if(!I.anchored)
if(!I.anchored && !istype(I, /obj/item/weapon/paper/sticker))
I.forceMove(src)
itemcount++

Expand Down
10 changes: 7 additions & 3 deletions code/modules/paperwork/paper.dm
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@
///Last world.time tick the contents of this paper was changed.
var/last_info_change = 0

var/windowX = 425
var/windowY = 600
var/windowTheme = CSS_THEME_LIGHT

//lipstick wiping is in code/game/objects/items/weapons/cosmetics.dm!

/obj/item/weapon/paper/atom_init()
Expand All @@ -58,9 +62,9 @@

/obj/item/weapon/paper/update_icon()
if(info)
icon_state = "paper_words"
icon_state = "[initial(icon_state)]_words"
return
icon_state = "paper"
icon_state = "[initial(icon_state)]"

/obj/item/weapon/paper/proc/update_space(new_text)
if(!new_text)
Expand Down Expand Up @@ -91,7 +95,7 @@
data = "[infolinks ? info_links : info][stamp_text]"

if(view)
var/datum/browser/popup = new(user, "window=[name]", "[name]", 425, 600, ntheme = CSS_THEME_LIGHT)
var/datum/browser/popup = new(user, "window=[name]", "[name]", windowX, windowY, ntheme = windowTheme)
popup.set_content(data)
popup.open()

Expand Down
2 changes: 1 addition & 1 deletion code/modules/paperwork/paper_bundle.dm
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
var/obj/item/weapon/paper/P = W
dat += P.show_content(human_user, view = FALSE)

var/datum/browser/popup = new(human_user, "window=[name]", "[sanitize(P.name)]", 300, 480, ntheme = CSS_THEME_LIGHT)
var/datum/browser/popup = new(human_user, "window=[name]", "[sanitize(P.name)]", P.windowX, P.windowY, ntheme = P.windowTheme)
popup.set_content(dat)
popup.open()

Expand Down
113 changes: 113 additions & 0 deletions code/modules/paperwork/stickers.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
/obj/item/weapon/paper/sticker
name = "sticker"
cases = list("стикер", "стикера", "стикеру", "стикер", "стикером", "стикере")
desc = "Самоклеящаяся бумага для заметок."
icon_state = "sticker_yellow"
slot_flags = null

free_space = 100

windowX = 200
windowY = 200
windowTheme = "sticker_theme_yellow"

/obj/item/weapon/paper/sticker/yellow
icon_state = "sticker_yellow"

windowTheme = "sticker_theme_yellow"

/obj/item/weapon/paper/sticker/red
icon_state = "sticker_red"

windowTheme = "sticker_theme_red"

/obj/item/weapon/paper/sticker/green
icon_state = "sticker_green"

windowTheme = "sticker_theme_green"

/obj/item/weapon/paper/sticker/blue
icon_state = "sticker_blue"

windowTheme = "sticker_theme_blue"


/obj/item/weapon/paper/sticker/afterattack(atom/target, mob/user, proximity, params)
if(!proximity)
return
if(!istype(target, /obj/structure) && !ismachinery(target))
return

var/list/click_params = params2list(params)
var/matrix/M = matrix()
M.Turn(rand(-20,20))
transform = M
user.drop_from_inventory(src, target.loc, text2num(click_params[ICON_X]) + target.pixel_x - world.icon_size / 2, text2num(click_params[ICON_Y]) + target.pixel_y - world.icon_size / 2)

AddComponent(/datum/component/bounded, target, 0, 0, CALLBACK(src, PROC_REF(resolve_stranded)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А точно компонента нужна? Оно точно нормально перемещается вместе с объектами?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Да, я тестил, норм перемещается с объектами.


return

/obj/item/weapon/paper/sticker/proc/resolve_stranded(datum/component/bounded/bounds)
if(get_dist(bounds.master, src) <= 1 && isturf(loc))
forceMove(bounds.master.loc)
var/dist = get_dist(src, get_turf(bounds.master))
if(dist >= bounds.min_dist && dist <= bounds.max_dist)
return TRUE

qdel(GetComponent(/datum/component/bounded))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А как же RemoveComponent() ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Прикол в том что у нас везде в билде "qdel(GetComponent", потому я и выбрал абсолютно такую же вещь.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Точно RemoveComponent работает так как мне надо?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removecomponent это другое
на тг уже споткнулись об это и переименовали в ClearFromParent()

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

пепец

return TRUE

/obj/item/weapon/stickers
name = "stickers"
cases = list("стикеры", "стикеров", "стикерам", "стикеры", "стикерами", "стикерах")
desc = "Самоклеящаяся бумага для заметок."
icon = 'icons/obj/bureaucracy.dmi'
icon_state = "stickers_4"

var/stickers_amount = 20

/obj/item/weapon/stickers/update_icon()
if(!stickers_amount)
qdel(src)
return

icon_state = "stickers_[ceil(stickers_amount/5)]"

/obj/item/weapon/stickers/MouseDrop(mob/user)
. = ..()
if(user == usr && !usr.incapacitated() && Adjacent(usr))
if(ishuman(user))
user.put_in_hands(src)
else
forceMove(get_turf(user))

/obj/item/weapon/stickers/attack_paw(mob/user)
return attack_hand(user)

/obj/item/weapon/stickers/attack_hand(mob/living/user)
if(user && user.a_intent == INTENT_GRAB)
return ..()

var/obj/item/weapon/paper/sticker/S

switch(stickers_amount)
if(1 to 5)
S = new /obj/item/weapon/paper/sticker/blue(src)
if(6 to 10)
S = new /obj/item/weapon/paper/sticker/green(src)
if(11 to 15)
S = new /obj/item/weapon/paper/sticker/red(src)
if(16 to 20)
S = new /obj/item/weapon/paper/sticker/yellow(src)

if(ishuman(user))
user.put_in_hands(S)
else
S.forceMove(get_turf(src))

stickers_amount--

to_chat(user, "<span class='notice'>Вы взяли стикер.</span>")
add_fingerprint(user)
update_icon()
49 changes: 49 additions & 0 deletions html/browser/common.css
Original file line number Diff line number Diff line change
Expand Up @@ -646,3 +646,52 @@ body.theme_abductor {
margin-right: auto;
width: 50%;
}

body.sticker_theme_yellow {
background-color: #fcf7be;
background-image:none;
color: #000000;
}

.sticker_theme_yellow .uiTitle {
border-bottom: 2px solid #f6d896;
background: #fcf7be;
color: #30373d;
}

body.sticker_theme_red {
background-color: #ffe0b7;
background-image:none;
color: #000000;
}

.sticker_theme_red .uiTitle {
border-bottom: 2px solid #fca570;
background: #ffe0b7;
color: #30373d;
}

body.sticker_theme_green {
background-color: #b5e7cb;
background-image:none;
color: #000000;
}

.sticker_theme_green .uiTitle {
border-bottom: 2px solid #86c69a;
background: #b5e7cb;
color: #30373d;
}

body.sticker_theme_blue {
background-color: #42bfe8;
background-image:none;
color: #000000;
}

.sticker_theme_blue .uiTitle {
border-bottom: 2px solid #2789cd;
background: #42bfe8;
color: #30373d;
}

Binary file modified icons/obj/bureaucracy.dmi
Binary file not shown.
1 change: 1 addition & 0 deletions taucetistation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -2145,6 +2145,7 @@
#include "code\modules\paperwork\predefined_forms.dm"
#include "code\modules\paperwork\silicon_photography.dm"
#include "code\modules\paperwork\stamps.dm"
#include "code\modules\paperwork\stickers.dm"
#include "code\modules\paperwork\ticket_machine.dm"
#include "code\modules\persistent_cache\persistent_cache.dm"
#include "code\modules\power\apc.dm"
Expand Down
Loading