mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-21 03:59:59 +01:00
[MIRROR] Sticker resprite and rewrite (#26853)
* Sticker resprite and rewrite (#81893) Stealing from Goon is bad, but stickers are actually a good feature, and loosing those will be a disappointment. This project aims to recreate 'em from scratch without using Jimmyl's and Goon's code. Also, suspicious icons were resprited and renamed. * Sticker resprite and rewrite --------- Co-authored-by: Interception&? <137328283+intercepti0n@users.noreply.github.com>
This commit is contained in:
co-authored by
Interception&?
parent
24cd444494
commit
0e217eab7b
@@ -1,131 +0,0 @@
|
||||
/// parent type for all other stickers. do not spawn directly
|
||||
/obj/item/sticker
|
||||
name = "sticker"
|
||||
desc = "A sticker with some strong adhesive on the back, sticks to stuff!"
|
||||
item_flags = NOBLUDGEON | XENOMORPH_HOLDABLE //funny
|
||||
resistance_flags = FLAMMABLE
|
||||
icon = 'icons/obj/toys/stickers.dmi'
|
||||
w_class = WEIGHT_CLASS_TINY
|
||||
throw_range = 3
|
||||
vis_flags = VIS_INHERIT_DIR | VIS_INHERIT_PLANE | VIS_INHERIT_LAYER
|
||||
///If not null, pick an icon_state from this list
|
||||
var/icon_states
|
||||
/// If the sticker should be disincluded from normal sticker boxes.
|
||||
var/contraband = FALSE
|
||||
|
||||
/obj/item/sticker/Initialize(mapload)
|
||||
. = ..()
|
||||
if(icon_states)
|
||||
icon_state = pick(icon_states)
|
||||
pixel_y = rand(-3,3)
|
||||
pixel_x = rand(-3,3)
|
||||
AddElement(/datum/element/sticker)
|
||||
|
||||
/obj/item/sticker/smile
|
||||
name = "smiley sticker"
|
||||
icon_state = "smile"
|
||||
|
||||
/obj/item/sticker/frown
|
||||
name = "frowny sticker"
|
||||
icon_state = "frown"
|
||||
|
||||
/obj/item/sticker/left_arrow
|
||||
name = "left arrow sticker"
|
||||
icon_state = "larrow"
|
||||
|
||||
/obj/item/sticker/right_arrow
|
||||
name = "right arrow sticker"
|
||||
icon_state = "rarrow"
|
||||
|
||||
/obj/item/sticker/star
|
||||
name = "star sticker"
|
||||
icon_state = "star1"
|
||||
icon_states = list("star1","star2")
|
||||
|
||||
/obj/item/sticker/heart
|
||||
name = "heart sticker"
|
||||
icon_state = "heart"
|
||||
|
||||
/obj/item/sticker/googly
|
||||
name = "googly eye sticker"
|
||||
icon_state = "googly1"
|
||||
icon_states = list("googly1","googly2")
|
||||
|
||||
/obj/item/sticker/rev
|
||||
name = "blue R sticker"
|
||||
desc = "A sticker of FUCK THE SYSTEM, the galaxy's premiere hardcore punk band."
|
||||
icon_state = "revhead"
|
||||
|
||||
/obj/item/sticker/pslime
|
||||
name = "slime plushie sticker"
|
||||
icon_state = "pslime"
|
||||
|
||||
/obj/item/sticker/pliz
|
||||
name = "lizard plushie sticker"
|
||||
icon_state = "plizard"
|
||||
|
||||
/obj/item/sticker/pbee
|
||||
name = "bee plushie sticker"
|
||||
icon_state = "pbee"
|
||||
|
||||
/obj/item/sticker/psnake
|
||||
name = "snake plushie sticker"
|
||||
icon_state = "psnake"
|
||||
|
||||
/obj/item/sticker/robot
|
||||
name = "bot sticker"
|
||||
icon_state = "tile"
|
||||
icon_states = list("tile","medbot","clean")
|
||||
|
||||
/obj/item/sticker/toolbox
|
||||
name = "toolbox sticker"
|
||||
icon_state = "toolbox"
|
||||
|
||||
/obj/item/sticker/clown
|
||||
name = "clown sticker"
|
||||
icon_state = "honkman"
|
||||
|
||||
/obj/item/sticker/mime
|
||||
name = "mime sticker"
|
||||
icon_state = "silentman"
|
||||
|
||||
/obj/item/sticker/assistant
|
||||
name = "assistant sticker"
|
||||
icon_state = "tider"
|
||||
|
||||
/obj/item/sticker/syndicate
|
||||
name = "syndicate sticker"
|
||||
icon_state = "synd"
|
||||
contraband = TRUE
|
||||
|
||||
/obj/item/sticker/syndicate/c4
|
||||
name = "C-4 sticker"
|
||||
icon_state = "c4"
|
||||
|
||||
/obj/item/sticker/syndicate/bomb
|
||||
name = "syndicate bomb sticker"
|
||||
icon_state = "sbomb"
|
||||
|
||||
/obj/item/sticker/syndicate/apc
|
||||
name = "broken APC sticker"
|
||||
icon_state = "milf"
|
||||
|
||||
/obj/item/sticker/syndicate/larva
|
||||
name = "larva sticker"
|
||||
icon_state = "larva"
|
||||
|
||||
/obj/item/sticker/syndicate/cult
|
||||
name = "bloody paper sticker"
|
||||
icon_state = "cult"
|
||||
|
||||
/obj/item/sticker/syndicate/flash
|
||||
name = "flash sticker"
|
||||
icon_state = "flash"
|
||||
|
||||
/obj/item/sticker/syndicate/op
|
||||
name = "operative sticker"
|
||||
icon_state = "newcop"
|
||||
|
||||
/obj/item/sticker/syndicate/trap
|
||||
name = "bear trap sticker"
|
||||
icon_state = "trap"
|
||||
@@ -0,0 +1,195 @@
|
||||
#define MAX_STICKER_COUNT 15
|
||||
|
||||
/**
|
||||
* What stickers can do?
|
||||
*
|
||||
* - They can be attached to any object.
|
||||
* - They inherit cursor position when attached.
|
||||
* - They are unclickable by mouse, I suppose?
|
||||
* - They can be washed off.
|
||||
* - They can be burnt off.
|
||||
* - They can be attached to the object they collided with.
|
||||
* - They play "attack" animation when attached.
|
||||
*
|
||||
*/
|
||||
|
||||
/obj/item/sticker
|
||||
name = "sticker"
|
||||
desc = "A sticker with some strong adhesive on the back, sticks to stuff!"
|
||||
|
||||
icon = 'icons/obj/toys/stickers.dmi'
|
||||
|
||||
max_integrity = 50
|
||||
resistance_flags = FLAMMABLE
|
||||
|
||||
throw_range = 3
|
||||
pressure_resistance = 0
|
||||
|
||||
item_flags = NOBLUDGEON | XENOMORPH_HOLDABLE //funny ~Jimmyl
|
||||
w_class = WEIGHT_CLASS_TINY
|
||||
|
||||
/// `list` or `null`, contains possible alternate `icon_states`.
|
||||
var/list/icon_states
|
||||
/// Whether sticker is legal and allowed to generate inside non-syndicate boxes.
|
||||
var/contraband = FALSE
|
||||
|
||||
/obj/item/sticker/Initialize(mapload)
|
||||
. = ..()
|
||||
|
||||
if(length(icon_states))
|
||||
icon_state = pick(icon_states)
|
||||
|
||||
/obj/item/sticker/Bump(atom/bumped_atom)
|
||||
if(prob(50) && attempt_attach(bumped_atom))
|
||||
bumped_atom.balloon_alert_to_viewers("sticker landed on sticky side!")
|
||||
|
||||
/obj/item/sticker/interact_with_atom(atom/interacting_with, mob/living/user, list/modifiers)
|
||||
if(!isatom(interacting_with))
|
||||
return NONE
|
||||
|
||||
var/cursor_x = text2num(LAZYACCESS(modifiers, ICON_X))
|
||||
var/cursor_y = text2num(LAZYACCESS(modifiers, ICON_Y))
|
||||
|
||||
if(isnull(cursor_x) || isnull(cursor_y))
|
||||
return NONE
|
||||
|
||||
if(attempt_attach(interacting_with, user, cursor_x, cursor_y))
|
||||
return ITEM_INTERACT_SUCCESS
|
||||
|
||||
return NONE
|
||||
|
||||
/**
|
||||
* Attempts to attach sticker to an object. Returns `FALSE` if atom has more than
|
||||
* `MAX_STICKER_COUNT` stickers, `TRUE` otherwise. If no `px` or `py` were passed
|
||||
* picks random coordinates based on a `target`'s icon.
|
||||
*/
|
||||
/obj/item/sticker/proc/attempt_attach(atom/target, mob/user, px, py)
|
||||
if(COUNT_TRAIT_SOURCES(target, TRAIT_STICKERED) >= MAX_STICKER_COUNT)
|
||||
balloon_alert_to_viewers("sticker won't stick!")
|
||||
return FALSE
|
||||
|
||||
if(isnull(px) || isnull(py))
|
||||
var/icon/target_mask = icon(target.icon, target.icon_state)
|
||||
|
||||
if(isnull(px))
|
||||
px = rand(1, target_mask.Width())
|
||||
|
||||
if(isnull(py))
|
||||
py = rand(1, target_mask.Height())
|
||||
|
||||
if(!isnull(user))
|
||||
user.do_attack_animation(target, used_item = src)
|
||||
target.balloon_alert(user, "sticker sticked")
|
||||
|
||||
target.AddComponent(/datum/component/sticker, src, user, get_dir(target, src), px, py)
|
||||
return TRUE
|
||||
|
||||
#undef MAX_STICKER_COUNT
|
||||
|
||||
/obj/item/sticker/smile
|
||||
name = "smiley sticker"
|
||||
icon_state = "smile"
|
||||
|
||||
/obj/item/sticker/frown
|
||||
name = "frowny sticker"
|
||||
icon_state = "frown"
|
||||
|
||||
/obj/item/sticker/left_arrow
|
||||
name = "left arrow sticker"
|
||||
icon_state = "arrow-left"
|
||||
|
||||
/obj/item/sticker/right_arrow
|
||||
name = "right arrow sticker"
|
||||
icon_state = "arrow-right"
|
||||
|
||||
/obj/item/sticker/star
|
||||
name = "star sticker"
|
||||
icon_state = "star"
|
||||
|
||||
/obj/item/sticker/heart
|
||||
name = "heart sticker"
|
||||
icon_state = "heart"
|
||||
|
||||
/obj/item/sticker/googly
|
||||
name = "googly eye sticker"
|
||||
icon_state = "googly"
|
||||
icon_states = list("googly", "googly-alt")
|
||||
|
||||
/obj/item/sticker/rev
|
||||
name = "blue R sticker"
|
||||
desc = "A sticker of FUCK THE SYSTEM, the galaxy's premiere hardcore punk band."
|
||||
icon_state = "revhead"
|
||||
|
||||
/obj/item/sticker/pslime
|
||||
name = "slime plushie sticker"
|
||||
icon_state = "pslime"
|
||||
|
||||
/obj/item/sticker/pliz
|
||||
name = "lizard plushie sticker"
|
||||
icon_state = "plizard"
|
||||
|
||||
/obj/item/sticker/pbee
|
||||
name = "bee plushie sticker"
|
||||
icon_state = "pbee"
|
||||
|
||||
/obj/item/sticker/psnake
|
||||
name = "snake plushie sticker"
|
||||
icon_state = "psnake"
|
||||
|
||||
/obj/item/sticker/robot
|
||||
name = "bot sticker"
|
||||
icon_state = "tile"
|
||||
icon_states = list("tile", "medbot", "clean")
|
||||
|
||||
/obj/item/sticker/toolbox
|
||||
name = "toolbox sticker"
|
||||
icon_state = "soul"
|
||||
|
||||
/obj/item/sticker/clown
|
||||
name = "clown sticker"
|
||||
icon_state = "honkman"
|
||||
|
||||
/obj/item/sticker/mime
|
||||
name = "mime sticker"
|
||||
icon_state = "silentman"
|
||||
|
||||
/obj/item/sticker/assistant
|
||||
name = "assistant sticker"
|
||||
icon_state = "tider"
|
||||
|
||||
/obj/item/sticker/syndicate
|
||||
name = "syndicate sticker"
|
||||
icon_state = "synd"
|
||||
contraband = TRUE
|
||||
|
||||
/obj/item/sticker/syndicate/c4
|
||||
name = "C-4 sticker"
|
||||
icon_state = "c4"
|
||||
|
||||
/obj/item/sticker/syndicate/bomb
|
||||
name = "syndicate bomb sticker"
|
||||
icon_state = "sbomb"
|
||||
|
||||
/obj/item/sticker/syndicate/apc
|
||||
name = "broken APC sticker"
|
||||
icon_state = "milf"
|
||||
|
||||
/obj/item/sticker/syndicate/larva
|
||||
name = "larva sticker"
|
||||
icon_state = "larva"
|
||||
|
||||
/obj/item/sticker/syndicate/cult
|
||||
name = "bloody paper sticker"
|
||||
icon_state = "cult"
|
||||
|
||||
/obj/item/sticker/syndicate/flash
|
||||
name = "flash sticker"
|
||||
icon_state = "flash"
|
||||
|
||||
/obj/item/sticker/syndicate/op
|
||||
name = "operative sticker"
|
||||
icon_state = "newcop"
|
||||
|
||||
/obj/item/sticker/syndicate/trap
|
||||
name = "bear trap sticker"
|
||||
icon_state = "trap"
|
||||
@@ -209,16 +209,21 @@
|
||||
desc = "A box full of random stickers. Do give to the clown."
|
||||
|
||||
/obj/item/storage/box/stickers/proc/generate_non_contraband_stickers_list()
|
||||
. = list()
|
||||
var/list/allowed_stickers = list()
|
||||
|
||||
for(var/obj/item/sticker/sticker_type as anything in subtypesof(/obj/item/sticker))
|
||||
if(!initial(sticker_type.contraband))
|
||||
. += sticker_type
|
||||
return .
|
||||
if(!sticker_type::contraband)
|
||||
allowed_stickers += sticker_type
|
||||
|
||||
return allowed_stickers
|
||||
|
||||
/obj/item/storage/box/stickers/PopulateContents()
|
||||
var/static/list/non_contraband
|
||||
if(!non_contraband)
|
||||
|
||||
if(isnull(non_contraband))
|
||||
non_contraband = generate_non_contraband_stickers_list()
|
||||
for(var/i in 1 to rand(4,8))
|
||||
|
||||
for(var/i in 1 to rand(4, 8))
|
||||
var/type = pick(non_contraband)
|
||||
new type(src)
|
||||
|
||||
|
||||
@@ -674,6 +674,7 @@
|
||||
|
||||
/obj/item/storage/box/syndie_kit/stickers/PopulateContents()
|
||||
var/list/types = subtypesof(/obj/item/sticker/syndicate)
|
||||
|
||||
for(var/i in 1 to atom_storage.max_slots)
|
||||
var/type = pick(types)
|
||||
new type(src)
|
||||
|
||||
Reference in New Issue
Block a user