Skip to content

Commit

Permalink
4 Стикера (TauCetiStation#13652)
Browse files Browse the repository at this point in the history
* 4 Стикера

Добавлены 4 стикера которые можно клеить на всякое и писать на них надписи.

* Забытая строчка на конце файла.

Добавлена забытая пустая строчка на конце файла.

* Убрал странный код форс интента.

Убрано насильное изменение интента игрока на Граб чтобы поднять пачку стикеров путём добавления переменной forceGrab что обходит проверку на граб в функции attack_hand

* Убран копипаст функции show_content

Убран копипаст функции show_content путём добавления трёх переменных в /obj/item/weapon/paper.

windowX, windowY, windowTheme для ширины, высоты и темы окошка соответственно.

* Переписал маусдроп

Переписал маусдроп на попытку положить стопку стикеров в руку вместо вызова аттак_хенд.

Не берите, дети, легасикод в свои фичи. Может легасикод быть по-дебильному написан и замержен легасимейнтейнером.

* Update code/modules/paperwork/stickers.dm

Co-authored-by: KIBORG04 <[email protected]>

* Update code/modules/paperwork/stickers.dm

Co-authored-by: KIBORG04 <[email protected]>

* Убрал проверку на хумана в ненужном месте. Заменил наименования переменных окна бумаги.

Проверка на ishuman убрана из mouseDrop пачки стикеров.

Переменные windowX и windowY у окна бумаги заменены на windowWidth и windowHeight соответственно.

* Исправления

Заменил маусдроп на предложенный в ревью.

Добавил проверку на стикер для шкафов чтобы те не открывались и не разблокировались когда на них клеят стикер.

* Убрал странное расположение проверки на опустошение стикеров.

---------

Co-authored-by: KIBORG04 <[email protected]>
  • Loading branch information
DarthSidiousPalpatine and KIBORG04 authored Nov 28, 2024
1 parent d1026b4 commit f82b0e4
Show file tree
Hide file tree
Showing 8 changed files with 169 additions and 6 deletions.
5 changes: 4 additions & 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 Expand Up @@ -178,6 +178,9 @@
else if(istagger(W))
return

else if(istype(W, /obj/item/weapon/paper/sticker))
return

else
attack_hand(user)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
playsound(src, pick(SOUNDIN_SPARKS), VOL_EFFECTS_MASTER)
visible_message("<span class='notice'>The locker has been sliced open by [user] with an [W.name]!</span>", blind_message = "<span class='warning'>You hear metal being sliced and sparks flying.</span>", viewing_distance = 3)

else if(istype(W,/obj/item/weapon/packageWrap) || iswelding(W))
else if(istype(W,/obj/item/weapon/packageWrap) || iswelding(W) || istype(W, /obj/item/weapon/paper/sticker))
return ..(W,user)
else
togglelock(user)
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/windowWidth = 425
var/windowHeight = 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]", windowWidth, windowHeight, 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.windowWidth, P.windowHeight, ntheme = P.windowTheme)
popup.set_content(dat)
popup.open()

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

free_space = 100

windowWidth = 200
windowHeight = 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)))

/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))
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()
icon_state = "stickers_[ceil(stickers_amount/5)]"

/obj/item/weapon/stickers/MouseDrop(mob/user)
. = ..()
if(.)
user.put_in_hands(src)

/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)

user.put_in_hands(S)

stickers_amount--

to_chat(user, "<span class='notice'>Вы взяли стикер.</span>")
add_fingerprint(user)

if(stickers_amount <= 0)
qdel(src)
return

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

0 comments on commit f82b0e4

Please sign in to comment.