Skip to content

Commit

Permalink
Adds Umbrellas (#575)
Browse files Browse the repository at this point in the history
  • Loading branch information
Constellado authored Nov 5, 2024
1 parent ee8c2f6 commit 3a63e14
Show file tree
Hide file tree
Showing 13 changed files with 256 additions and 0 deletions.
28 changes: 28 additions & 0 deletions code/datums/greyscale/json_configs/_umbrella.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"umbrella_on": [
{
"type": "icon_state",
"icon_state": "umbrella_on_handle",
"blend_mode": "overlay"
},
{
"type": "icon_state",
"icon_state": "umbrella_on",
"blend_mode": "overlay",
"color_ids": [ 1 ]
}
],
"umbrella": [
{
"type": "icon_state",
"icon_state": "umbrella_handle",
"blend_mode": "overlay"
},
{
"type": "icon_state",
"icon_state": "umbrella",
"blend_mode": "overlay",
"color_ids": [ 1 ]
}
]
}
31 changes: 31 additions & 0 deletions code/datums/greyscale/json_configs/_umbrella_inhand.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"umbrella_closed": [
{
"type": "icon_state",
"icon_state": "umbrella_closed",
"blend_mode": "overlay",
"color_ids": [ 1 ]
}
],
"umbrella_on": [
{
"type": "icon_state",
"icon_state": "umbrella_handle",
"blend_mode": "overlay"
},
{
"type": "icon_state",
"icon_state": "umbrella_on",
"blend_mode": "overlay",
"color_ids": [ 1 ]
}
],
"umbrella_on_BACK": [
{
"type": "icon_state",
"icon_state": "umbrella_on_BACK",
"blend_mode": "overlay",
"color_ids": [ 1 ]
}
]
}
1 change: 1 addition & 0 deletions maplestation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -6158,6 +6158,7 @@
#include "maplestation_modules\code\game\objects\items\plushes.dm"
#include "maplestation_modules\code\game\objects\items\toys.dm"
#include "maplestation_modules\code\game\objects\items\triage_card.dm"
#include "maplestation_modules\code\game\objects\items\umbrellas.dm"
#include "maplestation_modules\code\game\objects\items\weaponry.dm"
#include "maplestation_modules\code\game\objects\items\devices\triage_projector.dm"
#include "maplestation_modules\code\game\objects\items\devices\PDA\PDA_types.dm"
Expand Down
15 changes: 15 additions & 0 deletions maplestation_modules/code/datums/greyscale/_greyscale_config.dm
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,18 @@
name = "Spacer's Turtleneck Worn"
icon_file = 'maplestation_modules/icons/mob/clothing/under/spacer_turtleneck.dmi'
json_config = 'code/datums/greyscale/json_configs/spacer_turtleneck_worn.json'

/datum/greyscale_config/umbrella
name = "Umbrella"
icon_file = 'maplestation_modules/icons/obj/weapons/umbrellas.dmi'
json_config = 'code/datums/greyscale/json_configs/_umbrella.json'

/datum/greyscale_config/umbrella_inhand_left
name = "Held Umbrella, Left, Closed"
icon_file = 'maplestation_modules/icons/mob/inhands/weapons/umbrellas_inhand_lh.dmi'
json_config = 'code/datums/greyscale/json_configs/_umbrella_inhand.json'

/datum/greyscale_config/umbrella_inhand_right
name = "Held Umbrella, Right, Closed"
icon_file = 'maplestation_modules/icons/mob/inhands/weapons/umbrellas_inhand_rh.dmi'
json_config = 'code/datums/greyscale/json_configs/_umbrella_inhand.json'
134 changes: 134 additions & 0 deletions maplestation_modules/code/game/objects/items/umbrellas.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
/*
* # Umbrellas!
* This file has code for umbrellas!
* Umbrellas you can hold, and open and close.
* Currently not coding for protecting against rain as ???I dont think??? rain exists.
* The rest don't and it just for looks.
*/
/obj/item/umbrella
name = "umbrella"
desc = "A plain umbrella."
icon = 'maplestation_modules/icons/obj/weapons/umbrellas.dmi'
icon_state = "umbrella"
inhand_icon_state = "umbrella_closed"
lefthand_file = 'maplestation_modules/icons/mob/inhands/weapons/umbrellas_inhand_lh.dmi'
righthand_file = 'maplestation_modules/icons/mob/inhands/weapons/umbrellas_inhand_rh.dmi'
force = 5
throwforce = 5
w_class = WEIGHT_CLASS_SMALL
custom_materials = list(/datum/material/iron= SMALL_MATERIAL_AMOUNT * 0.5)
attack_verb_continuous = list("bludgeons", "whacks", "disciplines", "pummels")
attack_verb_simple = list("bludgeon", "whack", "discipline", "pummel")
drop_sound = 'maplestation_modules/sound/items/drop/wooden.ogg'
pickup_sound = 'maplestation_modules/sound/items/pickup/wooden.ogg'
hitsound = 'sound/weapons/genhit1.ogg'

//open umbrella offsets for the inhands
var/open_x_offset = 2
var/open_y_offset = 2

//Whether it's open or not
var/open = FALSE

/// The sound effect played when our umbrella is opened
var/on_sound = 'sound/weapons/batonextend.ogg'
/// The inhand icon state used when our umbrella is opened.
var/on_inhand_icon_state = "umbrella_on"

//greyscale stuff
greyscale_config = /datum/greyscale_config/umbrella
greyscale_config_inhand_left = /datum/greyscale_config/umbrella_inhand_left
greyscale_config_inhand_right = /datum/greyscale_config/umbrella_inhand_right
greyscale_colors = "#dddddd"
/// If the item should be assigned a random color
var/random_color = TRUE
/// List of possible random colors
var/static/list/umbrella_colors = list(
COLOR_BLUE,
COLOR_RED,
COLOR_PINK,
COLOR_BROWN,
COLOR_GREEN,
COLOR_CYAN,
COLOR_YELLOW,
COLOR_WHITE
)
flags_1 = IS_PLAYER_COLORABLE_1

/obj/item/umbrella/Initialize(mapload)
. = ..()
if(random_color)
set_greyscale(colors = list(pick(umbrella_colors)))
AddComponent( \
/datum/component/transforming, \
force_on = 7, \
hitsound_on = "sound/weapons/genhit1.ogg", \
w_class_on = WEIGHT_CLASS_BULKY, \
clumsy_check = FALSE, \
attack_verb_continuous_on = list("swooshes", "whacks", "fwumps"), \
attack_verb_simple_on = list("swoosh", "whack", "fwump"), \
)
RegisterSignal(src, COMSIG_TRANSFORMING_ON_TRANSFORM, PROC_REF(on_transform))

/obj/item/umbrella/worn_overlays(mutable_appearance/standing, isinhands)
. = ..()
if(!isinhands)
return
var/mob/holder = loc
if(open)
if(ISODD(holder.get_held_index_of_item(src))) //left hand or right hand?
. += mutable_appearance(lefthand_file, inhand_icon_state + "_BACK", BELOW_MOB_LAYER)
else
. += mutable_appearance(righthand_file, inhand_icon_state + "_BACK", BELOW_MOB_LAYER)


/obj/item/umbrella/proc/on_transform(obj/item/source, mob/user, active)
SIGNAL_HANDLER
inhand_icon_state = active ? on_inhand_icon_state : inhand_icon_state
open = active
if(user)
balloon_alert(user, active ? "opened" : "closed")
playsound(src, on_sound, 50, TRUE)
return COMPONENT_NO_DEFAULT_MESSAGE

/obj/item/umbrella/pickup(mob/user)
. = ..()
RegisterSignal(user, COMSIG_ATOM_DIR_CHANGE, PROC_REF(on_dir_change))

/obj/item/umbrella/dropped(mob/user, silent)
. = ..()
UnregisterSignal(user, COMSIG_ATOM_DIR_CHANGE)

/obj/item/umbrella/proc/on_dir_change(mob/living/carbon/owner, olddir, newdir)
SIGNAL_HANDLER
owner.update_held_items()

/obj/item/umbrella/get_worn_offsets(isinhands)
. = ..()
var/mob/holder = loc
if(open)
.[2] += open_y_offset
switch(loc.dir)
if(NORTH)
.[1] += ISODD(holder.get_held_index_of_item(src)) ? -open_x_offset : open_x_offset
if(SOUTH)
.[1] += ISODD(holder.get_held_index_of_item(src)) ? open_x_offset : -open_x_offset
if(EAST)
.[1] -= open_x_offset
if(WEST)
.[1] += open_x_offset



//other umbrellas

/obj/item/umbrella/parasol
name = "parasol"
desc = "A black laced parsol, how intricate."
icon_state = "parasol"
inhand_icon_state = "parasol_closed"
on_inhand_icon_state = "parasol_on"
random_color = FALSE
greyscale_config = null
greyscale_config_inhand_left = null
greyscale_config_inhand_right = null
Original file line number Diff line number Diff line change
Expand Up @@ -311,3 +311,16 @@
/datum/loadout_item/pocket_items/cybernetics_paintkit
name = "Cybernetics Paint Kit"
item_path = /obj/item/cybernetics_paintkit

/datum/loadout_item/pocket_items/umbrella
name = "Umbrella"
item_path = /obj/item/umbrella

/datum/loadout_item/pocket_items/black_parasol
name = "Umbrella (Black Parasol)"
item_path = /obj/item/umbrella/parasol

/datum/loadout_item/pocket_items/rad_umbrella
name = "Umbrella (Radiation Shielded)"
item_path = /obj/item/umbrella/volkan
additional_displayed_text = list("Character Item")
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,40 @@

w_class = WEIGHT_CLASS_TINY

///Volkan's umbrella. Stops radiation.
/obj/item/umbrella/volkan
name = "Volkan's umbrella"
desc = "A very thick, almost metallic umbrella. It has a dark black plasticky rim on the edge."
icon = 'maplestation_modules/story_content/volkan_equipment/icons/umbrellas.dmi'
icon_state = "umbrella_volkan"
inhand_icon_state = "umbrella_volkan_closed"
lefthand_file = 'maplestation_modules/story_content/volkan_equipment/icons/umbrellas_inhand_lh.dmi'
righthand_file = 'maplestation_modules/story_content/volkan_equipment/icons/umbrellas_inhand_rh.dmi'

on_inhand_icon_state = "umbrella_volkan_open"

random_color = FALSE
greyscale_config = null
greyscale_config_inhand_left = null
greyscale_config_inhand_right = null

/obj/item/umbrella/volkan/on_transform(obj/item/source, mob/user, active)
. = ..()
if(user)
if(active)
ADD_TRAIT(user, TRAIT_RADIMMUNE, TRAIT_GENERIC)
else
REMOVE_TRAIT(user, TRAIT_RADIMMUNE, TRAIT_GENERIC)

/obj/item/umbrella/volkan/pickup(mob/user)
. = ..()
if (open)
ADD_TRAIT(user, TRAIT_RADIMMUNE, TRAIT_GENERIC)

/obj/item/umbrella/volkan/dropped(mob/user, silent)
. = ..()
REMOVE_TRAIT(user, TRAIT_RADIMMUNE, TRAIT_GENERIC)


//---------------------cool boxes!-----------------------

Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 3a63e14

Please sign in to comment.