Merge branch 'master' into 91-files-changed-fml

This commit is contained in:
Detective-Google
2020-05-02 17:16:18 -05:00
committed by GitHub
80 changed files with 1987 additions and 1900 deletions
+66
View File
@@ -0,0 +1,66 @@
/*
* Loot piles structures, somewhat inspired from Polaris 13 ones but without the one search per pile ckey/mind restriction
* because the actual code is located its own element and has enough variables already. the piles themselves merely cosmetical.
*/
/obj/structure/loot_pile
name = "pile of junk"
desc = "Lots of junk lying around. They say one man's trash is another man's treasure."
icon = 'icons/obj/loot_piles.dmi'
icon_state = "randompile"
density = FALSE
anchored = TRUE
var/loot_amount = 5
var/delete_on_depletion = FALSE
var/can_use_hands = TRUE
var/scavenge_time = 12 SECONDS
var/allowed_tools = list(TOOL_SHOVEL = 0.6) //list of tool_behaviours with associated speed multipliers (lower is better)
var/icon_states_to_use = list("junk_pile1", "junk_pile2", "junk_pile3", "junk_pile4", "junk_pile5")
var/list/loot
/*
* Associated values in this list are not weights but numbers of times the kery can be rolled
* before being removed from ALL piles with same kind. This is why I wanted 'scavenging' to be an element and not a component.
*/
var/list/unique_loot
/*
* used for restrictions such as "one per mind", "one per ckey". Depending on the setting, these can be either limited to
* the current pile or shared throughout all atoms attached to this element.
*/
var/loot_restriction = NO_LOOT_RESTRICTION
var/maximum_loot_per_player = 1
/obj/structure/loot_pile/Initialize()
. = ..()
icon_state = pick(icon_states_to_use)
/obj/structure/loot_pile/ComponentInitialize()
. = ..()
if(loot)
AddElement(/datum/element/scavenging, loot_amount, loot, unique_loot, scavenge_time, can_use_hands, allowed_tools, null, delete_on_depletion, loot_restriction, maximum_loot_per_player)
//uses the maintenance_loot global list, mostly boring stuff and mices.
/obj/structure/loot_pile/maint
name = "trash pile"
desc = "A heap of garbage, but maybe there's something interesting inside?"
density = TRUE
layer = TABLE_LAYER
climbable = TRUE
pass_flags = LETPASSTHROW
loot = list(
SCAVENGING_FOUND_NOTHING = 50,
SCAVENGING_SPAWN_MOUSE = 10,
SCAVENGING_SPAWN_MICE = 5,
SCAVENGING_SPAWN_TOM = 1,
/obj/item/clothing/gloves/color/yellow = 0.5)
unique_loot = list(/obj/item/clothing/gloves/color/yellow = 5, SCAVENGING_SPAWN_TOM = 1)
/obj/structure/loot_pile/maint/ComponentInitialize()
var/static/safe_maint_items
if(!safe_maint_items)
safe_maint_items = list()
for(var/A in GLOB.maintenance_loot)
if(ispath(A, /obj/item))
safe_maint_items[A] = GLOB.maintenance_loot[A]
loot += safe_maint_items
return ..()
+143 -3
View File
@@ -1,3 +1,18 @@
#define NOT_ELECTROCHROMATIC 0
#define ELECTROCHROMATIC_OFF 1
#define ELECTROCHROMATIC_DIMMED 2
GLOBAL_LIST_EMPTY(electrochromatic_window_lookup)
/proc/do_electrochromatic_toggle(new_status, id)
var/list/windows = GLOB.electrochromatic_window_lookup["[id]"]
if(!windows)
return
var/obj/structure/window/W //define outside for performance because obviously this matters.
for(var/i in windows)
W = i
new_status? W.electrochromatic_dim() : W.electrochromatic_off()
/obj/structure/window
name = "window"
desc = "A window."
@@ -28,8 +43,15 @@
rad_insulation = RAD_VERY_LIGHT_INSULATION
rad_flags = RAD_PROTECT_CONTENTS
/// Electrochromatic status
var/electrochromatic_status = NOT_ELECTROCHROMATIC
/// Electrochromatic ID. Set the first character to ! to replace with a SSmapping generated pseudorandom obfuscated ID for mapping purposes.
var/electrochromatic_id
/obj/structure/window/examine(mob/user)
. = ..()
if(electrochromatic_status != NOT_ELECTROCHROMATIC)
. += "<span class='notice'>The window has electrochromatic circuitry on it.</span>"
if(reinf)
if(anchored && state == WINDOW_SCREWED_TO_FRAME)
. += "<span class='notice'>The window is <b>screwed</b> to the frame.</span>"
@@ -52,6 +74,10 @@
if(reinf && anchored)
state = WINDOW_SCREWED_TO_FRAME
if(mapload && electrochromatic_id)
if(copytext(electrochromatic_id, 1, 2) == "!")
electrochromatic_id = SSmapping.get_obfuscated_id(electrochromatic_id)
ini_dir = dir
air_update_turf(1)
@@ -62,6 +88,12 @@
real_explosion_block = explosion_block
explosion_block = EXPLOSION_BLOCK_PROC
if(electrochromatic_status != NOT_ELECTROCHROMATIC)
var/old = electrochromatic_status
make_electrochromatic()
if(old == ELECTROCHROMATIC_DIMMED)
electrochromatic_dim()
/obj/structure/window/ComponentInitialize()
. = ..()
AddComponent(/datum/component/simple_rotation,ROTATION_ALTCLICK | ROTATION_CLOCKWISE | ROTATION_COUNTERCLOCKWISE | ROTATION_VERBS ,null,CALLBACK(src, .proc/can_be_rotated),CALLBACK(src,.proc/after_rotation))
@@ -177,6 +209,24 @@
to_chat(user, "<span class='warning'>[src] is already in good condition!</span>")
return
if(istype(I, /obj/item/electronics/electrochromatic_kit) && user.a_intent == INTENT_HELP)
var/obj/item/electronics/electrochromatic_kit/K = I
if(electrochromatic_status != NOT_ELECTROCHROMATIC)
to_chat(user, "<span class='warning'>[src] is already electrochromatic!</span>")
return
if(anchored)
to_chat(user, "<span class='warning'>[src] must not be attached to the floor!</span>")
return
if(!K.id)
to_chat(user, "<span class='warning'>[K] has no ID set!</span>")
return
if(!user.temporarilyRemoveItemFromInventory(K))
to_chat(user, "<span class='warning'>[K] is stuck to your hand!</span>")
return
user.visible_message("<span class='notice'>[user] upgrades [src] with [I].</span>", "<span class='notice'>You upgrade [src] with [I].</span>")
make_electrochromatic(K.id)
qdel(K)
if(!(flags_1&NODECONSTRUCT_1))
if(istype(I, /obj/item/screwdriver))
I.play_tool_sound(src, 75)
@@ -224,6 +274,91 @@
air_update_turf(TRUE)
update_nearby_icons()
/obj/structure/window/proc/spraycan_paint(paint_color)
if(color_hex2num(paint_color) < 255)
set_opacity(255)
else
set_opacity(initial(opacity))
add_atom_colour(paint_color, WASHABLE_COLOUR_PRIORITY)
/obj/structure/window/proc/electrochromatic_dim()
if(electrochromatic_status == ELECTROCHROMATIC_DIMMED)
return
electrochromatic_status = ELECTROCHROMATIC_DIMMED
animate(src, color = "#222222", time = 2)
set_opacity(TRUE)
/obj/structure/window/proc/electrochromatic_off()
if(electrochromatic_status == ELECTROCHROMATIC_OFF)
return
electrochromatic_status = ELECTROCHROMATIC_OFF
var/current = color
update_atom_colour()
var/newcolor = color
color = current
animate(src, color = newcolor, time = 2)
/obj/structure/window/proc/remove_electrochromatic()
electrochromatic_off()
electrochromatic_status = NOT_ELECTROCHROMATIC
if(!electrochromatic_id)
return
var/list/L = GLOB.electrochromatic_window_lookup["[electrochromatic_id]"]
if(L)
L -= src
electrochromatic_id = null
/obj/structure/window/vv_edit_var(var_name, var_value)
var/check_status
if(var_name == NAMEOF(src, electrochromatic_id))
if(electrochromatic_id && GLOB.electrochromatic_window_lookup["[electrochromatic_id]"])
GLOB.electrochromatic_window_lookup[electrochromatic_id] -= src
if(var_name == NAMEOF(src, electrochromatic_status))
check_status = TRUE
. = ..() //do this first incase it runtimes.
if(var_name == NAMEOF(src, electrochromatic_id))
if((electrochromatic_status != NOT_ELECTROCHROMATIC) && electrochromatic_id)
LAZYINITLIST(GLOB.electrochromatic_window_lookup[electrochromatic_id])
GLOB.electrochromatic_window_lookup[electrochromatic_id] += src
if(check_status)
if(electrochromatic_status == NOT_ELECTROCHROMATIC)
remove_electrochromatic()
return
else if(electrochromatic_status == ELECTROCHROMATIC_OFF)
if(!electrochromatic_id)
return
else
make_electrochromatic()
electrochromatic_off()
return
else if(electrochromatic_status == ELECTROCHROMATIC_DIMMED)
if(!electrochromatic_id)
return
else
make_electrochromatic()
electrochromatic_dim()
return
else
remove_electrochromatic()
/obj/structure/window/proc/make_electrochromatic(new_id = electrochromatic_id)
remove_electrochromatic()
if(!new_id)
CRASH("Attempted to make electrochromatic with null ID.")
electrochromatic_id = new_id
electrochromatic_status = ELECTROCHROMATIC_OFF
LAZYINITLIST(GLOB.electrochromatic_window_lookup["[electrochromatic_id]"])
GLOB.electrochromatic_window_lookup[electrochromatic_id] |= src
/obj/structure/window/update_atom_colour()
if((electrochromatic_status != ELECTROCHROMATIC_OFF) && (electrochromatic_status != ELECTROCHROMATIC_DIMMED))
return FALSE
. = ..()
if(color && (color_hex2num(color) < 255))
set_opacity(255)
else
set_opacity(FALSE)
/obj/structure/window/proc/check_state(checked_state)
if(state == checked_state)
return TRUE
@@ -263,7 +398,6 @@
if(BURN)
playsound(src, 'sound/items/Welder.ogg', 100, 1)
/obj/structure/window/deconstruct(disassembled = TRUE)
if(QDELETED(src))
return
@@ -272,6 +406,9 @@
if(!(flags_1 & NODECONSTRUCT_1))
for(var/obj/item/shard/debris in spawnDebris(drop_location()))
transfer_fingerprints_to(debris) // transfer fingerprints to shards only
if(electrochromatic_status != NOT_ELECTROCHROMATIC) //eh fine keep your kit.
new /obj/item/electronics/electrochromatic_kit(drop_location())
// Intentionally not setting the ID so you can't decon one to know all of the IDs.
qdel(src)
update_nearby_icons()
@@ -315,9 +452,9 @@
density = FALSE
air_update_turf(1)
update_nearby_icons()
remove_electrochromatic()
return ..()
/obj/structure/window/Move()
var/turf/T = loc
. = ..()
@@ -731,7 +868,6 @@
set_opacity(TRUE)
queue_smooth(src)
/obj/structure/window/paperframe/attackby(obj/item/W, mob/user)
if(W.get_temperature())
fire_act(W.get_temperature())
@@ -749,3 +885,7 @@
return
..()
update_icon()
#undef NOT_ELECTROCHROMATIC
#undef ELECTROCHROMATIC_OFF
#undef ELECTROCHROMATIC_DIMMED