-
-
Notifications
You must be signed in to change notification settings - Fork 418
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
base: master
Are you sure you want to change the base?
The head ref may contain hidden characters: "4\u0421\u0442\u0438\u043A\u0435\u0440\u0430"
4 Стикера #13652
Changes from all commits
b8944aa
5e7a621
dcfb813
6112587
c375987
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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))) | ||
|
||
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)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. А как же RemoveComponent() ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Прикол в том что у нас везде в билде "qdel(GetComponent", потому я и выбрал абсолютно такую же вещь. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Точно RemoveComponent работает так как мне надо? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. removecomponent это другое There was a problem hiding this comment. Choose a reason for hiding this commentThe 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() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А точно компонента нужна? Оно точно нормально перемещается вместе с объектами?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Да, я тестил, норм перемещается с объектами.