/**********************Mineral deposits**************************/ /turf/closed/mineral //wall piece name = "rock" icon = 'icons/turf/mining.dmi' icon_state = "rock" var/smooth_icon = 'icons/turf/smoothrocks.dmi' smooth = SMOOTH_MORE|SMOOTH_BORDER canSmoothWith = null baseturfs = /turf/open/floor/plating/asteroid/airless initial_gas_mix = "TEMP=2.7" opacity = 1 density = TRUE blocks_air = 1 layer = EDGED_TURF_LAYER temperature = TCMB var/environment_type = "asteroid" var/turf/open/floor/plating/turf_type = /turf/open/floor/plating/asteroid/airless var/mineralType = null var/mineralAmt = 3 var/spread = 0 //will the seam spread? var/spreadChance = 0 //the percentual chance of an ore spreading to the neighbouring tiles var/last_act = 0 var/scan_state = "" //Holder for the image we display when we're pinged by a mining scanner var/defer_change = 0 /turf/closed/mineral/Initialize() if (!canSmoothWith) canSmoothWith = list(/turf/closed/mineral, /turf/closed/indestructible) var/matrix/M = new M.Translate(-4, -4) transform = M icon = smooth_icon . = ..() if (mineralType && mineralAmt && spread && spreadChance) for(var/dir in GLOB.cardinals) if(prob(spreadChance)) var/turf/T = get_step(src, dir) if(istype(T, /turf/closed/mineral/random)) Spread(T) /turf/closed/mineral/get_smooth_underlay_icon(mutable_appearance/underlay_appearance, turf/asking_turf, adjacency_dir) if(turf_type) underlay_appearance.icon = initial(turf_type.icon) underlay_appearance.icon_state = initial(turf_type.icon_state) return TRUE return ..() /turf/closed/mineral/attackby(obj/item/I, mob/user, params) if (!user.IsAdvancedToolUser()) to_chat(usr, "You don't have the dexterity to do this!") return if(I.tool_behaviour == TOOL_MINING) var/turf/T = user.loc if (!isturf(T)) return if(last_act + (40 * I.toolspeed) > world.time)//prevents message spam return last_act = world.time to_chat(user, "You start picking...") if(I.use_tool(src, user, 40, volume=50)) if(ismineralturf(src)) to_chat(user, "You finish cutting into the rock.") gets_drilled(user) SSblackbox.record_feedback("tally", "pick_used_mining", 1, I.type) else return attack_hand(user) /turf/closed/mineral/proc/gets_drilled() if (mineralType && (mineralAmt > 0)) new mineralType(src, mineralAmt) SSblackbox.record_feedback("tally", "ore_mined", mineralAmt, mineralType) for(var/obj/effect/temp_visual/mining_overlay/M in src) qdel(M) var/flags = NONE if(defer_change) // TODO: make the defer change var a var for any changeturf flag flags = CHANGETURF_DEFER_CHANGE ScrapeAway(null, flags) addtimer(CALLBACK(src, .proc/AfterChange), 1, TIMER_UNIQUE) playsound(src, 'sound/effects/break_stone.ogg', 50, 1) //beautiful destruction /turf/closed/mineral/attack_animal(mob/living/simple_animal/user) if((user.environment_smash & ENVIRONMENT_SMASH_WALLS) || (user.environment_smash & ENVIRONMENT_SMASH_RWALLS)) gets_drilled() ..() /turf/closed/mineral/attack_alien(mob/living/carbon/alien/M) to_chat(M, "You start digging into the rock...") playsound(src, 'sound/effects/break_stone.ogg', 50, 1) if(do_after(M, 40, target = src)) to_chat(M, "You tunnel into the rock.") gets_drilled(M) /turf/closed/mineral/Bumped(atom/movable/AM) ..() if(ishuman(AM)) var/mob/living/carbon/human/H = AM var/obj/item/I = H.is_holding_tool_quality(TOOL_MINING) if(I) attackby(I, H) return else if(iscyborg(AM)) var/mob/living/silicon/robot/R = AM if(R.module_active && R.module_active.tool_behaviour == TOOL_MINING) attackby(R.module_active, R) return else return /turf/closed/mineral/acid_melt() ScrapeAway() /turf/closed/mineral/ex_act(severity, target) ..() switch(severity) if(3) if (prob(75)) gets_drilled(null, 1) if(2) if (prob(90)) gets_drilled(null, 1) if(1) gets_drilled(null, 1) return /turf/closed/mineral/Spread(turf/T) T.ChangeTurf(type) /turf/closed/mineral/random var/list/mineralSpawnChanceList = list(/turf/closed/mineral/uranium = 5, /turf/closed/mineral/diamond = 1, /turf/closed/mineral/gold = 10, /turf/closed/mineral/silver = 12, /turf/closed/mineral/plasma = 20, /turf/closed/mineral/iron = 40, /turf/closed/mineral/titanium = 11, /turf/closed/mineral/gibtonite = 4, /turf/open/floor/plating/asteroid/airless/cave = 2, /turf/closed/mineral/bscrystal = 1) //Currently, Adamantine won't spawn as it has no uses. -Durandan var/mineralChance = 13 var/display_icon_state = "rock" /turf/closed/mineral/random/Initialize() mineralSpawnChanceList = typelist("mineralSpawnChanceList", mineralSpawnChanceList) if (display_icon_state) icon_state = display_icon_state . = ..() if (prob(mineralChance)) var/path = pickweight(mineralSpawnChanceList) var/turf/T = ChangeTurf(path,null,CHANGETURF_IGNORE_AIR) if(T && ismineralturf(T)) var/turf/closed/mineral/M = T M.mineralAmt = rand(1, 5) M.environment_type = src.environment_type M.turf_type = src.turf_type M.baseturfs = src.baseturfs src = M M.levelupdate() /turf/closed/mineral/random/high_chance icon_state = "rock_highchance" mineralChance = 25 mineralSpawnChanceList = list( /turf/closed/mineral/uranium = 35, /turf/closed/mineral/diamond = 30, /turf/closed/mineral/gold = 45, /turf/closed/mineral/titanium = 45, /turf/closed/mineral/silver = 50, /turf/closed/mineral/plasma = 50, /turf/closed/mineral/bscrystal = 20) /turf/closed/mineral/random/high_chance/volcanic environment_type = "basalt" turf_type = /turf/open/floor/plating/asteroid/basalt/lava_land_surface baseturfs = /turf/open/floor/plating/asteroid/basalt/lava_land_surface initial_gas_mix = LAVALAND_DEFAULT_ATMOS defer_change = 1 mineralSpawnChanceList = list( /turf/closed/mineral/uranium/volcanic = 35, /turf/closed/mineral/diamond/volcanic = 30, /turf/closed/mineral/gold/volcanic = 45, /turf/closed/mineral/titanium/volcanic = 45, /turf/closed/mineral/silver/volcanic = 50, /turf/closed/mineral/plasma/volcanic = 50, /turf/closed/mineral/bscrystal/volcanic = 20) /turf/closed/mineral/random/low_chance icon_state = "rock_lowchance" mineralChance = 6 mineralSpawnChanceList = list( /turf/closed/mineral/uranium = 2, /turf/closed/mineral/diamond = 1, /turf/closed/mineral/gold = 4, /turf/closed/mineral/titanium = 4, /turf/closed/mineral/silver = 6, /turf/closed/mineral/plasma = 15, /turf/closed/mineral/iron = 40, /turf/closed/mineral/gibtonite = 2, /turf/closed/mineral/bscrystal = 1) /turf/closed/mineral/random/volcanic environment_type = "basalt" turf_type = /turf/open/floor/plating/asteroid/basalt/lava_land_surface baseturfs = /turf/open/floor/plating/asteroid/basalt/lava_land_surface initial_gas_mix = LAVALAND_DEFAULT_ATMOS defer_change = 1 mineralChance = 10 mineralSpawnChanceList = list( /turf/closed/mineral/uranium/volcanic = 5, /turf/closed/mineral/diamond/volcanic = 1, /turf/closed/mineral/gold/volcanic = 10, /turf/closed/mineral/titanium/volcanic = 11, /turf/closed/mineral/silver/volcanic = 12, /turf/closed/mineral/plasma/volcanic = 20, /turf/closed/mineral/iron/volcanic = 40, /turf/closed/mineral/gibtonite/volcanic = 4, /turf/open/floor/plating/asteroid/airless/cave/volcanic = 1, /turf/closed/mineral/bscrystal/volcanic = 1) /turf/closed/mineral/random/labormineral mineralSpawnChanceList = list( /turf/closed/mineral/uranium = 3, /turf/closed/mineral/diamond = 1, /turf/closed/mineral/gold = 8, /turf/closed/mineral/titanium = 8, /turf/closed/mineral/silver = 20, /turf/closed/mineral/plasma = 30, /turf/closed/mineral/iron = 95, /turf/closed/mineral/gibtonite = 2) icon_state = "rock_labor" /turf/closed/mineral/random/labormineral/volcanic environment_type = "basalt" turf_type = /turf/open/floor/plating/asteroid/basalt/lava_land_surface baseturfs = /turf/open/floor/plating/asteroid/basalt/lava_land_surface initial_gas_mix = LAVALAND_DEFAULT_ATMOS defer_change = 1 mineralSpawnChanceList = list( /turf/closed/mineral/uranium/volcanic = 3, /turf/closed/mineral/diamond/volcanic = 1, /turf/closed/mineral/gold/volcanic = 8, /turf/closed/mineral/titanium/volcanic = 8, /turf/closed/mineral/silver/volcanic = 20, /turf/closed/mineral/plasma/volcanic = 30, /turf/closed/mineral/bscrystal/volcanic = 1, /turf/closed/mineral/gibtonite/volcanic = 2, /turf/closed/mineral/iron/volcanic = 95) /turf/closed/mineral/iron mineralType = /obj/item/stack/ore/iron spreadChance = 20 spread = 1 scan_state = "rock_Iron" /turf/closed/mineral/iron/volcanic environment_type = "basalt" turf_type = /turf/open/floor/plating/asteroid/basalt/lava_land_surface baseturfs = /turf/open/floor/plating/asteroid/basalt/lava_land_surface initial_gas_mix = LAVALAND_DEFAULT_ATMOS defer_change = 1 /turf/closed/mineral/iron/ice environment_type = "snow_cavern" icon_state = "icerock_iron" smooth_icon = 'icons/turf/walls/icerock_wall.dmi' turf_type = /turf/open/floor/plating/asteroid/snow/ice baseturfs = /turf/open/floor/plating/asteroid/snow/ice initial_gas_mix = "o2=22;n2=82;TEMP=180" defer_change = TRUE /turf/closed/mineral/uranium mineralType = /obj/item/stack/ore/uranium spreadChance = 5 spread = 1 scan_state = "rock_Uranium" /turf/closed/mineral/uranium/volcanic environment_type = "basalt" turf_type = /turf/open/floor/plating/asteroid/basalt/lava_land_surface baseturfs = /turf/open/floor/plating/asteroid/basalt/lava_land_surface initial_gas_mix = LAVALAND_DEFAULT_ATMOS defer_change = 1 /turf/closed/mineral/diamond mineralType = /obj/item/stack/ore/diamond spreadChance = 0 spread = 1 scan_state = "rock_Diamond" /turf/closed/mineral/diamond/volcanic environment_type = "basalt" turf_type = /turf/open/floor/plating/asteroid/basalt/lava_land_surface baseturfs = /turf/open/floor/plating/asteroid/basalt/lava_land_surface initial_gas_mix = LAVALAND_DEFAULT_ATMOS defer_change = 1 /turf/closed/mineral/diamond/ice environment_type = "snow_cavern" icon_state = "icerock_diamond" smooth_icon = 'icons/turf/walls/icerock_wall.dmi' turf_type = /turf/open/floor/plating/asteroid/snow/ice baseturfs = /turf/open/floor/plating/asteroid/snow/ice initial_gas_mix = "o2=22;n2=82;TEMP=180" defer_change = TRUE /turf/closed/mineral/gold mineralType = /obj/item/stack/ore/gold spreadChance = 5 spread = 1 scan_state = "rock_Gold" /turf/closed/mineral/gold/volcanic environment_type = "basalt" turf_type = /turf/open/floor/plating/asteroid/basalt/lava_land_surface baseturfs = /turf/open/floor/plating/asteroid/basalt/lava_land_surface initial_gas_mix = LAVALAND_DEFAULT_ATMOS defer_change = 1 /turf/closed/mineral/silver mineralType = /obj/item/stack/ore/silver spreadChance = 5 spread = 1 scan_state = "rock_Silver" /turf/closed/mineral/silver/volcanic environment_type = "basalt" turf_type = /turf/open/floor/plating/asteroid/basalt/lava_land_surface baseturfs = /turf/open/floor/plating/asteroid/basalt/lava_land_surface initial_gas_mix = LAVALAND_DEFAULT_ATMOS defer_change = 1 /turf/closed/mineral/titanium mineralType = /obj/item/stack/ore/titanium spreadChance = 5 spread = 1 scan_state = "rock_Titanium" /turf/closed/mineral/titanium/volcanic environment_type = "basalt" turf_type = /turf/open/floor/plating/asteroid/basalt/lava_land_surface baseturfs = /turf/open/floor/plating/asteroid/basalt/lava_land_surface initial_gas_mix = LAVALAND_DEFAULT_ATMOS defer_change = 1 /turf/closed/mineral/plasma mineralType = /obj/item/stack/ore/plasma spreadChance = 8 spread = 1 scan_state = "rock_Plasma" /turf/closed/mineral/plasma/volcanic environment_type = "basalt" turf_type = /turf/open/floor/plating/asteroid/basalt/lava_land_surface baseturfs = /turf/open/floor/plating/asteroid/basalt/lava_land_surface initial_gas_mix = LAVALAND_DEFAULT_ATMOS defer_change = 1 /turf/closed/mineral/plasma/ice environment_type = "snow_cavern" icon_state = "icerock_plasma" smooth_icon = 'icons/turf/walls/icerock_wall.dmi' turf_type = /turf/open/floor/plating/asteroid/snow/ice baseturfs = /turf/open/floor/plating/asteroid/snow/ice initial_gas_mix = "o2=22;n2=82;TEMP=180" defer_change = TRUE /turf/closed/mineral/bananium mineralType = /obj/item/stack/ore/bananium mineralAmt = 3 spreadChance = 0 spread = 0 scan_state = "rock_Bananium" /turf/closed/mineral/bscrystal mineralType = /obj/item/stack/ore/bluespace_crystal mineralAmt = 1 spreadChance = 0 spread = 0 scan_state = "rock_BScrystal" /turf/closed/mineral/bscrystal/volcanic environment_type = "basalt" turf_type = /turf/open/floor/plating/asteroid/basalt/lava_land_surface baseturfs = /turf/open/floor/plating/asteroid/basalt/lava_land_surface initial_gas_mix = LAVALAND_DEFAULT_ATMOS defer_change = 1 /turf/closed/mineral/volcanic environment_type = "basalt" turf_type = /turf/open/floor/plating/asteroid/basalt baseturfs = /turf/open/floor/plating/asteroid/basalt initial_gas_mix = LAVALAND_DEFAULT_ATMOS /turf/closed/mineral/volcanic/lava_land_surface environment_type = "basalt" turf_type = /turf/open/floor/plating/asteroid/basalt/lava_land_surface baseturfs = /turf/open/floor/plating/asteroid/basalt/lava_land_surface defer_change = 1 /turf/closed/mineral/ash_rock //wall piece name = "rock" icon = 'icons/turf/mining.dmi' smooth_icon = 'icons/turf/walls/rock_wall.dmi' icon_state = "rock2" smooth = SMOOTH_MORE|SMOOTH_BORDER canSmoothWith = list (/turf/closed) baseturfs = /turf/open/floor/plating/ashplanet/wateryrock initial_gas_mix = LAVALAND_DEFAULT_ATMOS environment_type = "waste" turf_type = /turf/open/floor/plating/ashplanet/rocky defer_change = 1 /turf/closed/mineral/snowmountain name = "snowy mountainside" icon = 'icons/turf/mining.dmi' smooth_icon = 'icons/turf/walls/mountain_wall.dmi' icon_state = "mountainrock" smooth = SMOOTH_MORE|SMOOTH_BORDER canSmoothWith = list (/turf/closed) baseturfs = /turf/open/floor/plating/asteroid/snow initial_gas_mix = "o2=22;n2=82;TEMP=180" environment_type = "snow" turf_type = /turf/open/floor/plating/asteroid/snow defer_change = TRUE /turf/closed/mineral/snowmountain/cavern name = "ice cavern rock" icon = 'icons/turf/mining.dmi' smooth_icon = 'icons/turf/walls/icerock_wall.dmi' icon_state = "icerock" smooth = SMOOTH_MORE|SMOOTH_BORDER canSmoothWith = list (/turf/closed) baseturfs = /turf/open/floor/plating/asteroid/snow/ice environment_type = "snow_cavern" turf_type = /turf/open/floor/plating/asteroid/snow/ice //GIBTONITE /turf/closed/mineral/gibtonite mineralAmt = 1 spreadChance = 0 spread = 0 scan_state = "rock_Gibtonite" var/det_time = 8 //Countdown till explosion, but also rewards the player for how close you were to detonation when you defuse it var/stage = GIBTONITE_UNSTRUCK //How far into the lifecycle of gibtonite we are var/activated_ckey = null //These are to track who triggered the gibtonite deposit for logging purposes var/activated_name = null var/mutable_appearance/activated_overlay /turf/closed/mineral/gibtonite/Initialize() det_time = rand(8,10) //So you don't know exactly when the hot potato will explode . = ..() /turf/closed/mineral/gibtonite/attackby(obj/item/I, mob/user, params) if(istype(I, /obj/item/mining_scanner) || istype(I, /obj/item/t_scanner/adv_mining_scanner) && stage == 1) user.visible_message("[user] holds [I] to [src]...", "You use [I] to locate where to cut off the chain reaction and attempt to stop it...") defuse() ..() /turf/closed/mineral/gibtonite/proc/explosive_reaction(mob/user = null, triggered_by_explosion = 0) if(stage == GIBTONITE_UNSTRUCK) activated_overlay = mutable_appearance('icons/turf/smoothrocks.dmi', "rock_Gibtonite_active", ON_EDGED_TURF_LAYER) add_overlay(activated_overlay) name = "gibtonite deposit" desc = "An active gibtonite reserve. Run!" stage = GIBTONITE_ACTIVE visible_message("There was gibtonite inside! It's going to explode!") var/turf/bombturf = get_turf(src) var/notify_admins = 0 if(z != 5) notify_admins = 1 if(!triggered_by_explosion) message_admins("[ADMIN_LOOKUPFLW(user)] has triggered a gibtonite deposit reaction at [ADMIN_VERBOSEJMP(bombturf)].") else message_admins("An explosion has triggered a gibtonite deposit reaction at [ADMIN_VERBOSEJMP(bombturf)].") if(!triggered_by_explosion) log_game("[key_name(user)] has triggered a gibtonite deposit reaction at [AREACOORD(bombturf)].") else log_game("An explosion has triggered a gibtonite deposit reaction at [AREACOORD(bombturf)]") countdown(notify_admins) /turf/closed/mineral/gibtonite/proc/countdown(notify_admins = 0) set waitfor = 0 while(istype(src, /turf/closed/mineral/gibtonite) && stage == GIBTONITE_ACTIVE && det_time > 0 && mineralAmt >= 1) det_time-- sleep(5) if(istype(src, /turf/closed/mineral/gibtonite)) if(stage == GIBTONITE_ACTIVE && det_time <= 0 && mineralAmt >= 1) var/turf/bombturf = get_turf(src) mineralAmt = 0 stage = GIBTONITE_DETONATE explosion(bombturf,1,3,5, adminlog = notify_admins) /turf/closed/mineral/gibtonite/proc/defuse() if(stage == GIBTONITE_ACTIVE) cut_overlay(activated_overlay) activated_overlay.icon_state = "rock_Gibtonite_inactive" add_overlay(activated_overlay) desc = "An inactive gibtonite reserve. The ore can be extracted." stage = GIBTONITE_STABLE if(det_time < 0) det_time = 0 visible_message("The chain reaction was stopped! The gibtonite had [det_time] reactions left till the explosion!") /turf/closed/mineral/gibtonite/gets_drilled(mob/user, triggered_by_explosion = 0) if(stage == GIBTONITE_UNSTRUCK && mineralAmt >= 1) //Gibtonite deposit is activated playsound(src,'sound/effects/hit_on_shattered_glass.ogg',50,1) explosive_reaction(user, triggered_by_explosion) return if(stage == GIBTONITE_ACTIVE && mineralAmt >= 1) //Gibtonite deposit goes kaboom var/turf/bombturf = get_turf(src) mineralAmt = 0 stage = GIBTONITE_DETONATE explosion(bombturf,1,2,5, adminlog = 0) if(stage == GIBTONITE_STABLE) //Gibtonite deposit is now benign and extractable. Depending on how close you were to it blowing up before defusing, you get better quality ore. var/obj/item/twohanded/required/gibtonite/G = new (src) if(det_time <= 0) G.quality = 3 G.icon_state = "Gibtonite ore 3" if(det_time >= 1 && det_time <= 2) G.quality = 2 G.icon_state = "Gibtonite ore 2" var/flags = NONE if(defer_change) flags = CHANGETURF_DEFER_CHANGE ScrapeAway(null, flags) addtimer(CALLBACK(src, .proc/AfterChange), 1, TIMER_UNIQUE) /turf/closed/mineral/gibtonite/volcanic environment_type = "basalt" turf_type = /turf/open/floor/plating/asteroid/basalt/lava_land_surface baseturfs = /turf/open/floor/plating/asteroid/basalt/lava_land_surface initial_gas_mix = LAVALAND_DEFAULT_ATMOS defer_change = 1