Merge pull request #2661 from Citadel-Station-13/upstream-merge-30220
[MIRROR] Adds Archaeology Component
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
// How multiple components of the exact same type are handled in the same datum
|
||||
|
||||
#define COMPONENT_DUPE_HIGHLANDER 0 //old component is deleted (default)
|
||||
#define COMPONENT_DUPE_ALLOWED 1 //duplicates allowed
|
||||
#define COMPONENT_DUPE_ALLOWED 1 //duplicates allowed
|
||||
#define COMPONENT_DUPE_UNIQUE 2 //new component is deleted
|
||||
|
||||
// All signals. Format:
|
||||
@@ -16,3 +16,9 @@
|
||||
#define COMSIG_PARENT_QDELETED "parent_qdeleted" //before a datum's Destroy() is called: ()
|
||||
#define COMSIG_ATOM_ENTERED "atom_entered" //from base of atom/Entered(): (atom/movable, atom)
|
||||
#define COMSIG_MOVABLE_CROSSED "movable_crossed" //from base of atom/movable/Crossed(): (atom/movable)
|
||||
#define COMSIG_PARENT_ATTACKBY "atom_attackby" //from the base of atom/attackby: (obj/item, mob/living, params)
|
||||
#define COMSIG_PARENT_EXAMINE "atom_examine" //from the base of atom/examine: (mob)
|
||||
#define COMSIG_ATOM_ENTERED "atom_entered" //from base of atom/Entered(): (atom/movable, atom)
|
||||
#define COMSIG_ATOM_EX_ACT "atom_ex_act" //from base of atom/ex_act(): (severity, target)
|
||||
#define COMSIG_ATOM_SING_PULL "atom_sing_pull" //from base of atom/singularity_pull(): (S, current_size)
|
||||
#define COMSIG_MOVABLE_CROSSED "movable_crossed" //from base of atom/movable/Crossed(): (atom/movable)
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
|
||||
#define islava(A) (istype(A, /turf/open/lava))
|
||||
|
||||
#define isplatingturf(A) (istype(A, /turf/open/floor/plating))
|
||||
|
||||
//Mobs
|
||||
#define isliving(A) (istype(A, /mob/living))
|
||||
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
/datum/component/archaeology
|
||||
dupe_type = COMPONENT_DUPE_UNIQUE
|
||||
var/list/archdrops
|
||||
var/prob2drop
|
||||
var/dug
|
||||
|
||||
/datum/component/archaeology/Initialize(_prob2drop, list/_archdrops = list())
|
||||
prob2drop = Clamp(_prob2drop, 0, 100)
|
||||
archdrops = _archdrops
|
||||
RegisterSignal(COMSIG_PARENT_ATTACKBY,.proc/Dig)
|
||||
RegisterSignal(COMSIG_ATOM_EX_ACT, .proc/BombDig)
|
||||
RegisterSignal(COMSIG_ATOM_SING_PULL, .proc/SingDig)
|
||||
|
||||
/datum/component/archaeology/InheritComponent(datum/component/archaeology/A, i_am_original)
|
||||
var/list/other_archdrops = A.archdrops
|
||||
var/list/_archdrops = archdrops
|
||||
for(var/I in other_archdrops)
|
||||
_archdrops[I] += other_archdrops[I]
|
||||
|
||||
/datum/component/archaeology/proc/Dig(mob/user, obj/item/W)
|
||||
if(dug)
|
||||
to_chat(user, "<span class='notice'>Looks like someone has dug here already.</span>")
|
||||
return FALSE
|
||||
else
|
||||
var/digging_speed
|
||||
if (istype(W, /obj/item/shovel))
|
||||
var/obj/item/shovel/S = W
|
||||
digging_speed = S.digspeed
|
||||
else if (istype(W, /obj/item/pickaxe))
|
||||
var/obj/item/pickaxe/P = W
|
||||
digging_speed = P.digspeed
|
||||
|
||||
if (digging_speed && isturf(user.loc))
|
||||
to_chat(user, "<span class='notice'>You start digging...</span>")
|
||||
playsound(parent, 'sound/effects/shovel_dig.ogg', 50, 1)
|
||||
|
||||
if(do_after(user, digging_speed, target = parent))
|
||||
to_chat(user, "<span class='notice'>You dig a hole.</span>")
|
||||
gets_dug()
|
||||
dug = TRUE
|
||||
SSblackbox.add_details("pick_used_mining",W.type)
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/datum/component/archaeology/proc/gets_dug()
|
||||
if(dug)
|
||||
return
|
||||
else
|
||||
var/turf/open/OT = get_turf(parent)
|
||||
for(var/thing in archdrops)
|
||||
var/maxtodrop = archdrops[thing]
|
||||
for(var/i in 1 to maxtodrop)
|
||||
if(prob(prob2drop)) // can't win them all!
|
||||
new thing(OT)
|
||||
|
||||
if(isopenturf(OT))
|
||||
if(OT.postdig_icon_change)
|
||||
if(istype(OT, /turf/open/floor/plating/asteroid/) && !OT.postdig_icon)
|
||||
var/turf/open/floor/plating/asteroid/AOT = parent
|
||||
AOT.icon_plating = "[AOT.environment_type]_dug"
|
||||
AOT.icon_state = "[AOT.environment_type]_dug"
|
||||
else
|
||||
if(isplatingturf(OT))
|
||||
var/turf/open/floor/plating/POT = parent
|
||||
POT.icon_plating = "[POT.postdig_icon]"
|
||||
OT.icon_state = "[OT.postdig_icon]"
|
||||
|
||||
if(OT.slowdown) //Things like snow slow you down until you dig them.
|
||||
OT.slowdown = 0
|
||||
dug = TRUE
|
||||
|
||||
/datum/component/archaeology/proc/SingDig(S, current_size)
|
||||
switch(current_size)
|
||||
if(STAGE_THREE)
|
||||
if(prob(30))
|
||||
gets_dug()
|
||||
if(STAGE_FOUR)
|
||||
if(prob(50))
|
||||
gets_dug()
|
||||
else
|
||||
if(current_size >= STAGE_FIVE && prob(70))
|
||||
gets_dug()
|
||||
|
||||
/datum/component/archaeology/proc/BombDig(severity, target)
|
||||
switch(severity)
|
||||
if(3)
|
||||
return
|
||||
if(2)
|
||||
if(prob(20))
|
||||
gets_dug()
|
||||
if(1)
|
||||
gets_dug()
|
||||
+3
-2
@@ -304,6 +304,7 @@
|
||||
/atom/proc/ex_act(severity, target)
|
||||
set waitfor = FALSE
|
||||
contents_explosion(severity, target)
|
||||
SendSignal(COMSIG_ATOM_EX_ACT, severity, target)
|
||||
|
||||
/atom/proc/blob_act(obj/structure/blob/B)
|
||||
return
|
||||
@@ -468,8 +469,8 @@ GLOBAL_LIST_EMPTY(blood_splatter_icons)
|
||||
/atom/proc/singularity_act()
|
||||
return
|
||||
|
||||
/atom/proc/singularity_pull()
|
||||
return
|
||||
/atom/proc/singularity_pull(obj/singularity/S, current_size)
|
||||
SendSignal(COMSIG_ATOM_SING_PULL, S, current_size)
|
||||
|
||||
/atom/proc/acid_act(acidpwr, acid_volume)
|
||||
return
|
||||
|
||||
@@ -58,7 +58,9 @@
|
||||
/turf/open/floor/plating/asteroid/drill_act(obj/item/mecha_parts/mecha_equipment/drill/drill)
|
||||
for(var/turf/open/floor/plating/asteroid/M in range(1, drill.chassis))
|
||||
if(get_dir(drill.chassis,M)&drill.chassis.dir)
|
||||
M.gets_dug()
|
||||
for(var/I in GetComponents(/datum/component/archaeology))
|
||||
var/datum/component/archaeology/archy = I
|
||||
archy.gets_dug()
|
||||
drill.log_message("Drilled through [src]")
|
||||
drill.move_ores()
|
||||
|
||||
|
||||
@@ -549,9 +549,10 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE)
|
||||
transfer_blood = 0
|
||||
|
||||
/obj/item/singularity_pull(S, current_size)
|
||||
..()
|
||||
if(current_size >= STAGE_FOUR)
|
||||
throw_at(S,14,3, spin=0)
|
||||
else ..()
|
||||
else return
|
||||
|
||||
/obj/item/throw_impact(atom/A)
|
||||
if(A && !QDELETED(A))
|
||||
|
||||
@@ -169,6 +169,7 @@
|
||||
return
|
||||
|
||||
/obj/singularity_pull(S, current_size)
|
||||
..()
|
||||
if(!anchored || current_size >= STAGE_FIVE)
|
||||
step_towards(src,S)
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
qdel(src)
|
||||
|
||||
/obj/structure/lattice/singularity_pull(S, current_size)
|
||||
..()
|
||||
if(current_size >= STAGE_FOUR)
|
||||
deconstruct()
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
return ..()
|
||||
|
||||
/obj/structure/transit_tube/singularity_pull(S, current_size)
|
||||
..()
|
||||
if(current_size >= STAGE_FIVE)
|
||||
deconstruct(FALSE)
|
||||
|
||||
|
||||
@@ -62,6 +62,7 @@
|
||||
AM.ex_act(severity, target)
|
||||
|
||||
/obj/structure/transit_tube_pod/singularity_pull(S, current_size)
|
||||
..()
|
||||
if(current_size >= STAGE_FIVE)
|
||||
deconstruct(FALSE)
|
||||
|
||||
|
||||
@@ -105,6 +105,7 @@
|
||||
qdel(src)
|
||||
|
||||
/obj/structure/window/singularity_pull(S, current_size)
|
||||
..()
|
||||
if(current_size >= STAGE_FIVE)
|
||||
deconstruct(FALSE)
|
||||
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
var/wet = 0
|
||||
var/wet_time = 0 // Time in seconds that this floor will be wet for.
|
||||
var/mutable_appearance/wet_overlay
|
||||
var/postdig_icon_change = FALSE
|
||||
var/postdig_icon
|
||||
var/list/archdrops
|
||||
|
||||
/turf/open/indestructible
|
||||
name = "floor"
|
||||
|
||||
@@ -170,6 +170,7 @@
|
||||
return make_plating()
|
||||
|
||||
/turf/open/floor/singularity_pull(S, current_size)
|
||||
..()
|
||||
if(current_size == STAGE_THREE)
|
||||
if(prob(30))
|
||||
if(floor_tile)
|
||||
|
||||
@@ -269,6 +269,7 @@
|
||||
narsie_act(force, ignore_mobs, probability)
|
||||
|
||||
/turf/open/floor/vines/singularity_pull(S, current_size)
|
||||
..()
|
||||
if(current_size >= STAGE_FIVE)
|
||||
if(prob(50))
|
||||
ChangeTurf(src.baseturf)
|
||||
|
||||
@@ -9,11 +9,11 @@
|
||||
icon = 'icons/turf/floors.dmi'
|
||||
icon_state = "asteroid"
|
||||
icon_plating = "asteroid"
|
||||
postdig_icon_change = TRUE
|
||||
var/environment_type = "asteroid"
|
||||
var/turf_type = /turf/open/floor/plating/asteroid //Because caves do whacky shit to revert to normal
|
||||
var/dug = 0 //0 = has not yet been dug, 1 = has already been dug
|
||||
var/sand_type = /obj/item/ore/glass
|
||||
var/floor_variance = 20 //probability floor has a different icon state
|
||||
archdrops = list(/obj/item/ore/glass = 5)
|
||||
|
||||
/turf/open/floor/plating/asteroid/Initialize()
|
||||
var/proper_name = name
|
||||
@@ -22,6 +22,9 @@
|
||||
if(prob(floor_variance))
|
||||
icon_state = "[environment_type][rand(0,12)]"
|
||||
|
||||
if(LAZYLEN(archdrops))
|
||||
AddComponent(/datum/component/archaeology, 100, archdrops)
|
||||
|
||||
/turf/open/floor/plating/asteroid/burn_tile()
|
||||
return
|
||||
|
||||
@@ -31,46 +34,7 @@
|
||||
/turf/open/floor/plating/asteroid/MakeDry(wet_setting = TURF_WET_WATER)
|
||||
return
|
||||
|
||||
/turf/open/floor/plating/asteroid/ex_act(severity, target)
|
||||
contents_explosion(severity, target)
|
||||
switch(severity)
|
||||
if(3)
|
||||
return
|
||||
if(2)
|
||||
if(prob(20))
|
||||
src.gets_dug()
|
||||
if(1)
|
||||
src.gets_dug()
|
||||
|
||||
/turf/open/floor/plating/asteroid/attackby(obj/item/W, mob/user, params)
|
||||
//note that this proc does not call ..()
|
||||
if(!W || !user)
|
||||
return 0
|
||||
var/digging_speed = 0
|
||||
if (istype(W, /obj/item/shovel))
|
||||
var/obj/item/shovel/S = W
|
||||
digging_speed = S.digspeed
|
||||
else if (istype(W, /obj/item/pickaxe))
|
||||
var/obj/item/pickaxe/P = W
|
||||
digging_speed = P.digspeed
|
||||
if (digging_speed)
|
||||
var/turf/T = user.loc
|
||||
if(!isturf(T))
|
||||
return
|
||||
|
||||
if (dug)
|
||||
to_chat(user, "<span class='warning'>This area has already been dug!</span>")
|
||||
return
|
||||
|
||||
to_chat(user, "<span class='notice'>You start digging...</span>")
|
||||
playsound(src, 'sound/effects/shovel_dig.ogg', 50, 1)
|
||||
|
||||
if(do_after(user, digging_speed, target = src))
|
||||
if(istype(src, /turf/open/floor/plating/asteroid))
|
||||
to_chat(user, "<span class='notice'>You dig a hole.</span>")
|
||||
gets_dug()
|
||||
SSblackbox.add_details("pick_used_mining","[W.type]")
|
||||
|
||||
if(istype(W, /obj/item/storage/bag/ore))
|
||||
var/obj/item/storage/bag/ore/S = W
|
||||
if(S.collection_mode == 1)
|
||||
@@ -88,37 +52,16 @@
|
||||
var/turf/open/floor/light/F = T
|
||||
F.state = L.state
|
||||
playsound(src, 'sound/weapons/genhit.ogg', 50, 1)
|
||||
|
||||
/turf/open/floor/plating/asteroid/proc/gets_dug()
|
||||
if(dug)
|
||||
return
|
||||
for(var/i in 1 to 5)
|
||||
new sand_type(src)
|
||||
dug = 1
|
||||
icon_plating = "[environment_type]_dug"
|
||||
icon_state = "[environment_type]_dug"
|
||||
slowdown = 0
|
||||
return
|
||||
|
||||
return ..()
|
||||
|
||||
|
||||
/turf/open/floor/plating/asteroid/singularity_act()
|
||||
if(turf_z_is_planet(src))
|
||||
return ..()
|
||||
ChangeTurf(/turf/open/space)
|
||||
|
||||
/turf/open/floor/plating/asteroid/singularity_pull(S, current_size)
|
||||
if(dug)
|
||||
return
|
||||
switch(current_size)
|
||||
if(STAGE_THREE)
|
||||
if(!prob(30))
|
||||
gets_dug()
|
||||
if(STAGE_FOUR)
|
||||
if(prob(50))
|
||||
gets_dug()
|
||||
else
|
||||
if(current_size >= STAGE_FIVE && prob(70))
|
||||
gets_dug()
|
||||
|
||||
|
||||
/turf/open/floor/plating/asteroid/basalt
|
||||
name = "volcanic floor"
|
||||
@@ -127,7 +70,7 @@
|
||||
icon_state = "basalt"
|
||||
icon_plating = "basalt"
|
||||
environment_type = "basalt"
|
||||
sand_type = /obj/item/ore/glass/basalt
|
||||
archdrops = list(/obj/item/ore/glass/basalt = 5)
|
||||
floor_variance = 15
|
||||
|
||||
/turf/open/floor/plating/asteroid/basalt/lava //lava underneath
|
||||
@@ -147,10 +90,10 @@
|
||||
if("basalt5", "basalt9")
|
||||
B.set_light(1.4, 0.6, LIGHT_COLOR_LAVA) //barely anything!
|
||||
|
||||
/turf/open/floor/plating/asteroid/basalt/gets_dug()
|
||||
if(!dug)
|
||||
set_light(0)
|
||||
/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.
|
||||
@@ -340,8 +283,8 @@
|
||||
initial_gas_mix = "TEMP=180"
|
||||
slowdown = 2
|
||||
environment_type = "snow"
|
||||
sand_type = /obj/item/stack/sheet/mineral/snow
|
||||
flags_1 = NONE
|
||||
archdrops = list(/obj/item/stack/sheet/mineral/snow = 5)
|
||||
|
||||
/turf/open/floor/plating/asteroid/snow/airless
|
||||
initial_gas_mix = "TEMP=2.7"
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
make_plating(1)
|
||||
|
||||
/turf/open/floor/engine/singularity_pull(S, current_size)
|
||||
..()
|
||||
if(current_size >= STAGE_FIVE)
|
||||
if(floor_tile)
|
||||
if(prob(30))
|
||||
|
||||
@@ -247,6 +247,7 @@
|
||||
icon_state = "r_wall"
|
||||
|
||||
/turf/closed/wall/r_wall/singularity_pull(S, current_size)
|
||||
..()
|
||||
if(current_size >= STAGE_FIVE)
|
||||
if(prob(30))
|
||||
dismantle_wall()
|
||||
|
||||
@@ -245,6 +245,7 @@
|
||||
QDEL_IN(O, 50)
|
||||
|
||||
/turf/closed/wall/singularity_pull(S, current_size)
|
||||
..()
|
||||
if(current_size >= STAGE_FIVE)
|
||||
if(prob(50))
|
||||
dismantle_wall()
|
||||
|
||||
@@ -222,6 +222,7 @@ Pipelines + Other Objects -> Pipe network
|
||||
build_network()
|
||||
|
||||
/obj/machinery/atmospherics/singularity_pull(S, current_size)
|
||||
..()
|
||||
if(current_size >= STAGE_FIVE)
|
||||
deconstruct(FALSE)
|
||||
|
||||
|
||||
@@ -120,6 +120,7 @@
|
||||
return 1
|
||||
|
||||
/obj/machinery/meter/singularity_pull(S, current_size)
|
||||
..()
|
||||
if(current_size >= STAGE_FIVE)
|
||||
new /obj/item/pipe_meter(loc)
|
||||
qdel(src)
|
||||
|
||||
@@ -643,6 +643,7 @@ INITIALIZE_IMMEDIATE(/mob/living/carbon/human/dummy)
|
||||
update_hair()
|
||||
|
||||
/mob/living/carbon/human/singularity_pull(S, current_size)
|
||||
..()
|
||||
if(current_size >= STAGE_THREE)
|
||||
for(var/obj/item/hand in held_items)
|
||||
if(prob(current_size * 5) && hand.w_class >= ((11-current_size)/2) && dropItemToGround(hand))
|
||||
@@ -651,7 +652,6 @@ INITIALIZE_IMMEDIATE(/mob/living/carbon/human/dummy)
|
||||
rad_act(current_size * 3)
|
||||
if(mob_negates_gravity())
|
||||
return
|
||||
..()
|
||||
|
||||
/mob/living/carbon/human/proc/do_cpr(mob/living/carbon/C)
|
||||
CHECK_DNA_AND_SPECIES(C)
|
||||
|
||||
@@ -690,6 +690,7 @@
|
||||
who.equip_to_slot(what, where, TRUE)
|
||||
|
||||
/mob/living/singularity_pull(S, current_size)
|
||||
..()
|
||||
if(current_size >= STAGE_SIX)
|
||||
throw_at(S,14,3, spin=1)
|
||||
else
|
||||
|
||||
@@ -170,6 +170,7 @@ By design, d1 is the smallest direction and d2 is the highest
|
||||
return 0
|
||||
|
||||
/obj/structure/cable/singularity_pull(S, current_size)
|
||||
..()
|
||||
if(current_size >= STAGE_FIVE)
|
||||
deconstruct()
|
||||
|
||||
|
||||
@@ -335,6 +335,7 @@
|
||||
|
||||
|
||||
/obj/structure/disposalpipe/singularity_pull(S, current_size)
|
||||
..()
|
||||
if(current_size >= STAGE_FIVE)
|
||||
deconstruct()
|
||||
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
return ..()
|
||||
|
||||
/obj/machinery/disposal/singularity_pull(S, current_size)
|
||||
..()
|
||||
if(current_size >= STAGE_FIVE)
|
||||
deconstruct()
|
||||
|
||||
|
||||
@@ -282,6 +282,7 @@
|
||||
#include "code\datums\antagonists\datum_traitor.dm"
|
||||
#include "code\datums\antagonists\devil.dm"
|
||||
#include "code\datums\antagonists\ninja.dm"
|
||||
#include "code\datums\components\archaeology.dm"
|
||||
#include "code\datums\components\component.dm"
|
||||
#include "code\datums\components\slippery.dm"
|
||||
#include "code\datums\diseases\_disease.dm"
|
||||
|
||||
Reference in New Issue
Block a user