Merge pull request #4236 from Citadel-Station-13/upstream-merge-33274

[MIRROR] Removes ComponentActivated in favor of callbacks
This commit is contained in:
deathride58
2017-12-06 03:53:35 +00:00
committed by GitHub
14 changed files with 79 additions and 151 deletions
+12 -18
View File
@@ -46,7 +46,7 @@
)
/obj/machinery/autolathe/Initialize()
AddComponent(/datum/component/material_container, list(MAT_METAL, MAT_GLASS))
AddComponent(/datum/component/material_container, list(MAT_METAL, MAT_GLASS), 0, FALSE, null, null, CALLBACK(src, .proc/AfterMaterialInsert))
. = ..()
wires = new /datum/wires/autolathe(src)
@@ -124,23 +124,17 @@
return ..()
/obj/machinery/mecha_part_fabricator/ComponentActivated(datum/component/C)
..()
if(istype(C, /datum/component/material_container))
var/datum/component/material_container/M = C
if(!M.last_insert_success)
return
var/lit = M.last_inserted_type
if(ispath(lit, /obj/item/ore/bluespace_crystal))
use_power(max(500,M.last_amount_inserted/10))
else
switch(M.last_inserted_id)
if (MAT_METAL)
flick("autolathe_o",src)//plays metal insertion animation
if (MAT_GLASS)
flick("autolathe_r",src)//plays glass insertion animation
use_power(M.last_amount_inserted*100)
updateUsrDialog()
/obj/machinery/autolathe/proc/AfterMaterialInsert(type_inserted, id_inserted, amount_inserted)
if(ispath(type_inserted, /obj/item/ore/bluespace_crystal))
use_power(max(500, amount_inserted / 10))
else
switch(id_inserted)
if (MAT_METAL)
flick("autolathe_o",src)//plays metal insertion animation
if (MAT_GLASS)
flick("autolathe_r",src)//plays glass insertion animation
use_power(amount_inserted * 100)
updateUsrDialog()
/obj/machinery/autolathe/Topic(href, href_list)
if(..())
+10 -16
View File
@@ -35,12 +35,11 @@
)
/obj/machinery/mecha_part_fabricator/Initialize()
var/datum/component/material_container/materials = AddComponent(/datum/component/material_container,
list(MAT_METAL, MAT_GLASS, MAT_SILVER, MAT_GOLD, MAT_DIAMOND, MAT_PLASMA, MAT_URANIUM, MAT_BANANIUM, MAT_TITANIUM, MAT_BLUESPACE),
FALSE, list(/obj/item/stack, /obj/item/ore/bluespace_crystal), CALLBACK(src, .proc/is_insertion_ready))
materials.precise_insertion = TRUE
. = ..()
files = new /datum/research(src) //Setup the research data holder.
var/datum/component/material_container/materials = AddComponent(/datum/component/material_container,
list(MAT_METAL, MAT_GLASS, MAT_SILVER, MAT_GOLD, MAT_DIAMOND, MAT_PLASMA, MAT_URANIUM, MAT_BANANIUM, MAT_TITANIUM, MAT_BLUESPACE),
FALSE, list(/obj/item/stack, /obj/item/ore/bluespace_crystal), CALLBACK(src, .proc/is_insertion_ready), CALLBACK(src, .proc/AfterMaterialInsert))
materials.precise_insertion = TRUE
return ..()
/obj/machinery/mecha_part_fabricator/RefreshParts()
var/T = 0
@@ -415,16 +414,11 @@
materials.retrieve_all()
..()
/obj/machinery/mecha_part_fabricator/ComponentActivated(datum/component/C)
..()
if(istype(C, /datum/component/material_container))
var/datum/component/material_container/M = C
if(!M.last_insert_success)
return
var/stack_name = material2name(M.last_inserted_id)
add_overlay("fab-load-[stack_name]")
addtimer(CALLBACK(src, /atom/proc/cut_overlay, "fab-load-[stack_name]"), 10)
updateUsrDialog()
/obj/machinery/mecha_part_fabricator/proc/AfterMaterialInsert(type_inserted, id_inserted, amount_inserted)
var/stack_name = material2name(id_inserted)
add_overlay("fab-load-[stack_name]")
addtimer(CALLBACK(src, /atom/proc/cut_overlay, "fab-load-[stack_name]"), 10)
updateUsrDialog()
/obj/machinery/mecha_part_fabricator/attackby(obj/item/W, mob/user, params)
if(default_deconstruction_screwdriver(user, "fab-o", "fab-idle", W))
@@ -10,16 +10,11 @@
/obj/item/device/pda/clown/Initialize()
. = ..()
AddComponent(/datum/component/slippery, 120, NO_SLIP_WHEN_WALKING)
AddComponent(/datum/component/slippery, 120, NO_SLIP_WHEN_WALKING, CALLBACK(src, .proc/AfterSlip))
/obj/item/device/pda/clown/ComponentActivated(datum/component/C)
..()
var/datum/component/slippery/S = C
if(!istype(S))
return
var/mob/living/carbon/human/M = S.slip_victim
if (istype(M) && (M.real_name != src.owner))
slipvictims |= M
/obj/item/device/pda/clown/proc/AfterSlip(mob/living/carbon/human/M)
if (istype(M) && (M.real_name != owner))
slipvictims |=M
var/obj/item/cartridge/virus/clown/cart = cartridge
if(istype(cart) && cart.charges < 5)
cart.charges++
+2 -7
View File
@@ -275,17 +275,12 @@
else
qdel(GetComponent(/datum/component/slippery))
return
var/datum/component/slippery/S = LoadComponent(/datum/component/slippery)
var/datum/component/slippery/S = LoadComponent(/datum/component/slippery, NONE, CALLBACK(src, .proc/AfterSlip))
S.intensity = intensity
S.lube_flags = lube_flags
/turf/open/ComponentActivated(datum/component/C)
..()
var/datum/component/slippery/S = C
if(!istype(S))
return
/turf/open/proc/AfterSlip(mob/living/L)
if(wet == TURF_WET_LUBE)
var/mob/living/L = S.slip_victim
L.confused = max(L.confused, 8)
/turf/open/proc/MakeDry(wet_setting = TURF_WET_WATER)
@@ -87,6 +87,9 @@
/turf/open/floor/plating/asteroid/basalt/Initialize()
. = ..()
set_basalt_light(src)
GET_COMPONENT(arch, /datum/component/archaeology)
ASSERT(isnull(arch.callback))
arch.callback = CALLBACK(src, /atom/proc/set_light, 0)
/proc/set_basalt_light(turf/open/floor/B)
switch(B.icon_state)
@@ -95,12 +98,6 @@
if("basalt5", "basalt9")
B.set_light(1.4, 0.6, LIGHT_COLOR_LAVA) //barely anything!
/turf/open/floor/plating/asteroid/basalt/ComponentActivated(datum/component/C)
..()
if(istype(C, /datum/component/archaeology))
set_light(0)
///////Surface. The surface is warm, but survivable without a suit. Internals are required. The floors break to chasms, which drop you into the underground.
/turf/open/floor/plating/asteroid/basalt/lava_land_surface