Merge pull request #12220 from Fox-McCloud/lavaland-update-mech-scanner

Lavaland Update: Mechs and Scanners
This commit is contained in:
variableundefined
2019-09-06 20:22:05 -04:00
committed by GitHub
9 changed files with 164 additions and 157 deletions
+11 -3
View File
@@ -91,10 +91,18 @@
var/C = chassis.loc
set_ready_state(0)
chassis.use_power(energy_drain)
. = do_after(chassis.occupant, equip_cooldown, target=target)
. = do_after(chassis.occupant, equip_cooldown, target = target)
set_ready_state(1)
if(!chassis || chassis.loc != C || src != chassis.selected)
return 0
if(!chassis || chassis.loc != C || src != chassis.selected || !(get_dir(chassis, target) & chassis.dir))
return FALSE
/obj/item/mecha_parts/mecha_equipment/proc/do_after_mecha(atom/target, delay)
if(!chassis)
return
var/C = chassis.loc
. = do_after(chassis.occupant, delay, target = target)
if(!chassis || chassis.loc != C || src != chassis.selected || !(get_dir(chassis, target) & chassis.dir))
return FALSE
/obj/item/mecha_parts/mecha_equipment/proc/can_attach(obj/mecha/M)
if(istype(M))
+81 -62
View File
@@ -1,54 +1,69 @@
// Drill, Diamond drill, Mining scanner
#define DRILL_BASIC 1
#define DRILL_HARDENED 2
/obj/item/mecha_parts/mecha_equipment/drill
name = "exosuit drill"
desc = "Equipment for engineering and combat exosuits. This is the drill that'll pierce the heavens!"
icon_state = "mecha_drill"
equip_cooldown = 30
equip_cooldown = 15
energy_drain = 10
force = 15
sharp = TRUE
var/drill_delay = 7
var/drill_level = DRILL_BASIC
/obj/item/mecha_parts/mecha_equipment/drill/action(atom/target)
if(!action_checks(target))
return
if(istype(target, /turf/space))
if(isspaceturf(target))
return
if(isobj(target))
var/obj/target_obj = target
if(target_obj.unacidable && !istype(target_obj, /obj/mecha))
if(target_obj.unacidable && !ismecha(target_obj))
occupant_message("<span class='danger'>[target] is too durable to drill through.</span>")
return
target.visible_message("<span class='warning'>[chassis] starts to drill [target].</span>",
"<span class='userdanger'>[chassis] starts to drill [target]...</span>",
blind_message = "<span class='italics'>You hear drilling.</span>")
"<span class='italics'>You hear drilling.</span>")
if(do_after_cooldown(target))
set_ready_state(FALSE)
log_message("Started drilling [target]")
if(isturf(target))
var/turf/T = target
T.drill_act(src)
else
log_message("Drilled through [target]")
set_ready_state(TRUE)
return
while(do_after_mecha(target, drill_delay))
if(isliving(target))
if(istype(src , /obj/item/mecha_parts/mecha_equipment/drill/diamonddrill))
drill_mob(target, chassis.occupant, 120)
else
drill_mob(target, chassis.occupant)
drill_mob(target, chassis.occupant)
playsound(src, 'sound/weapons/drill.ogg', 40, TRUE)
else if(istype(target, /obj))
var/obj/O = target
//O.take_damage(15, BRUTE, 0, FALSE, get_dir(chassis, target))
O.ex_act(2)//TO-DO-OBJECT-DAMAGE: Kill off when everything is damageable
playsound(src, 'sound/weapons/drill.ogg', 40, TRUE)
else
target.ex_act(2)
set_ready_state(TRUE)
return
set_ready_state(TRUE)
/turf/proc/drill_act(obj/item/mecha_parts/mecha_equipment/drill/drill)
return
/turf/simulated/floor/drill_act(obj/item/mecha_parts/mecha_equipment/drill/drill)
ex_act(1)
/turf/simulated/wall/drill_act(obj/item/mecha_parts/mecha_equipment/drill/drill)
ex_act(2)
if(drill.do_after_mecha(src, 60 / drill.drill_level))
drill.log_message("Drilled through [src]")
dismantle_wall(TRUE, FALSE)
/turf/simulated/wall/r_wall/drill_act(obj/item/mecha_parts/mecha_equipment/drill/drill)
if(istype(drill, /obj/item/mecha_parts/mecha_equipment/drill/diamonddrill))
if(drill.do_after_cooldown(src))//To slow down how fast mechs can drill through the station
if(drill.drill_level >= DRILL_HARDENED)
if(drill.do_after_mecha(src, 120 / drill.drill_level))
drill.log_message("Drilled through [src]")
ex_act(3)
dismantle_wall(TRUE, FALSE)
else
drill.occupant_message("<span class='danger'>[src] is too durable to drill through.</span>")
@@ -59,24 +74,17 @@
drill.log_message("Drilled through [src]")
drill.move_ores()
/turf/simulated/floor/plating/asteroid/airless/drill_act(obj/item/mecha_parts/mecha_equipment/drill/drill)
if(istype(drill, /obj/item/mecha_parts/mecha_equipment/drill/diamonddrill))
for(var/turf/simulated/floor/plating/asteroid/airless/M in range(1, src))
M.gets_drilled()
else
for(var/turf/simulated/floor/plating/asteroid/airless/M in range(1, drill.chassis))
if(get_dir(drill.chassis, M) & drill.chassis.dir)
M.gets_drilled()
/turf/simulated/floor/plating/asteroid/drill_act(obj/item/mecha_parts/mecha_equipment/drill/drill)
for(var/turf/simulated/floor/plating/asteroid/M in range(1, drill.chassis))
if((get_dir(drill.chassis, M) & drill.chassis.dir) && !M.dug)
M.gets_dug()
drill.log_message("Drilled through [src]")
drill.move_ores()
/obj/item/mecha_parts/mecha_equipment/drill/proc/move_ores()
if(locate(/obj/item/mecha_parts/mecha_equipment/hydraulic_clamp) in chassis.equipment)
var/obj/structure/ore_box/ore_box = locate(/obj/structure/ore_box) in chassis:cargo
if(ore_box)
for(var/obj/item/stack/ore/ore in range(1, chassis))
if(get_dir(chassis, ore) & chassis.dir)
ore.Move(ore_box)
if(locate(/obj/item/mecha_parts/mecha_equipment/hydraulic_clamp) in chassis.equipment && istype(chassis, /obj/mecha/working/ripley))
var/obj/mecha/working/ripley/R = chassis //we could assume that it's a ripley because it has a clamp, but that's ~unsafe~ and ~bad practice~
R.collect_ore()
/obj/item/mecha_parts/mecha_equipment/drill/can_attach(obj/mecha/M)
if(..())
@@ -84,25 +92,44 @@
return 1
return 0
/obj/item/mecha_parts/mecha_equipment/drill/proc/drill_mob(mob/living/target, mob/user, var/drill_damage=80)
target.visible_message("<span class='danger'>[chassis] drills [target] with [src].</span>", \
"<span class='userdanger'>[chassis] drills [target] with [src].</span>")
/obj/item/mecha_parts/mecha_equipment/drill/proc/drill_mob(mob/living/target, mob/user)
target.visible_message("<span class='danger'>[chassis] is drilling [target] with [src]!</span>",
"<span class='userdanger'>[chassis] is drilling you with [src]!</span>")
add_attack_logs(user, target, "DRILLED with [src] (INTENT: [uppertext(user.a_intent)]) (DAMTYPE: [uppertext(damtype)])")
if(target.stat == DEAD && target.butcher_results)
target.harvest(chassis) // Butcher the mob with our drill.
if(target.stat == DEAD && target.getBruteLoss() >= 200)
add_attack_logs(user, target, "gibbed")
if(LAZYLEN(target.butcher_results))
target.harvest(chassis) // Butcher the mob with our drill.
else
target.gib()
else
target.take_organ_damage(drill_damage)
var/splatter_dir = get_dir(chassis, target)
if(ishuman(target))
var/mob/living/carbon/human/H = target
var/obj/item/organ/external/target_part = H.get_organ(ran_zone("chest"))
H.apply_damage(10, BRUTE, "chest", H.run_armor_check(target_part, "melee"))
if(target)
target.Paralyse(10)
//blood splatters
blood_color = H.dna.species.blood_color
new /obj/effect/temp_visual/dir_setting/bloodsplatter(H.drop_location(), splatter_dir, blood_color)
//organs go everywhere
if(target_part && prob(10 * drill_level))
target_part.droplimb()
else
target.adjustBruteLoss(10)
if(isalien(target))
new /obj/effect/temp_visual/dir_setting/bloodsplatter/xenosplatter(target.drop_location(), splatter_dir)
/obj/item/mecha_parts/mecha_equipment/drill/diamonddrill
name = "diamond-tipped exosuit drill"
desc = "Equipment for engineering and combat exosuits. This is an upgraded version of the drill that'll pierce the heavens!"
icon_state = "mecha_diamond_drill"
origin_tech = "materials=4;engineering=4"
equip_cooldown = 20
equip_cooldown = 10
drill_delay = 4
drill_level = DRILL_HARDENED
force = 15
@@ -111,35 +138,27 @@
desc = "Equipment for engineering and combat exosuits. It will automatically check surrounding rock for useful minerals."
icon_state = "mecha_analyzer"
selectable = 0
equip_cooldown = 30
var/scanning = 0
equip_cooldown = 15
var/scanning_time = 0
/obj/item/mecha_parts/mecha_equipment/mining_scanner/attach(obj/mecha/M)
/obj/item/mecha_parts/mecha_equipment/mining_scanner/Initialize(mapload)
. = ..()
START_PROCESSING(SSobj, src)
M.occupant_sight_flags |= SEE_TURFS
if(M.occupant)
M.occupant.update_sight()
START_PROCESSING(SSfastprocess, src)
/obj/item/mecha_parts/mecha_equipment/mining_scanner/detach()
chassis.occupant_sight_flags &= ~SEE_TURFS
STOP_PROCESSING(SSobj, src)
if(chassis.occupant)
chassis.occupant.update_sight()
/obj/item/mecha_parts/mecha_equipment/mining_scanner/Destroy()
STOP_PROCESSING(SSfastprocess, src)
return ..()
/obj/item/mecha_parts/mecha_equipment/mining_scanner/process()
if(!loc)
STOP_PROCESSING(SSfastprocess, src)
qdel(src)
if(scanning)
return
if(istype(loc,/obj/mecha/working))
if(istype(loc, /obj/mecha/working) && scanning_time <= world.time)
var/obj/mecha/working/mecha = loc
if(!mecha.occupant)
return
var/list/occupant = list()
occupant |= mecha.occupant
scanning = 1
mineral_scan_pulse(occupant,get_turf(loc))
spawn(equip_cooldown)
scanning = 0
scanning_time = world.time + equip_cooldown
mineral_scan_pulse(get_turf(src))
#undef DRILL_BASIC
#undef DRILL_HARDENED
+6 -4
View File
@@ -509,18 +509,20 @@
return
/obj/item/mecha_parts/mecha_equipment/weapon/energy/plasma
equip_cooldown = 20
equip_cooldown = 10
name = "217-D Heavy Plasma Cutter"
desc = "A device that shoots resonant plasma bursts at extreme velocity. The blasts are capable of crushing rock and demloishing solid obstacles."
icon_state = "mecha_plasmacutter"
item_state = "plasmacutter"
lefthand_file = 'icons/mob/inhands/guns_lefthand.dmi'
righthand_file = 'icons/mob/inhands/guns_righthand.dmi'
energy_drain = 30
origin_tech = "materials=3;plasmatech=4;engineering=3"
projectile = /obj/item/projectile/plasma/adv/mech
fire_sound = 'sound/weapons/laser.ogg'
/obj/item/mecha_parts/mecha_equipment/weapon/energy/plasma/can_attach(obj/mecha/M as obj)
/obj/item/mecha_parts/mecha_equipment/weapon/energy/plasma/can_attach(obj/mecha/M)
if(istype(M, /obj/mecha/working))
if(M.equipment.len<M.max_equip)
return 1
return 0
return TRUE
return FALSE
+31 -16
View File
@@ -3,7 +3,9 @@
name = "APLU \"Ripley\""
icon_state = "ripley"
initial_icon = "ripley"
step_in = 5
step_in = 4 //Move speed, lower is faster.
var/fast_pressure_step_in = 2 //step_in while in normal pressure conditions
var/slow_pressure_step_in = 4 //step_in while in better pressure conditions
max_temperature = 20000
health = 200
lights_power = 7
@@ -17,8 +19,18 @@
/obj/mecha/working/ripley/Move()
. = ..()
if(.)
collect_ore()
update_pressure()
/obj/mecha/working/ripley/proc/collect_ore()
if(locate(/obj/item/mecha_parts/mecha_equipment/hydraulic_clamp) in equipment)
var/obj/structure/ore_box/ore_box = locate(/obj/structure/ore_box) in cargo
if(ore_box)
for(var/obj/item/stack/ore/ore in range(1, src))
if(ore.Adjacent(src) && ((get_dir(src, ore) & dir) || ore.loc == loc)) //we can reach it and it's in front of us? grab it!
ore.forceMove(ore_box)
/obj/mecha/working/ripley/Destroy()
while(damage_absorption["brute"] < 0.6)
new /obj/item/stack/sheet/animalhide/goliath_hide(loc)
@@ -75,7 +87,8 @@
name = "DEATH-RIPLEY"
icon_state = "deathripley"
initial_icon = "deathripley"
step_in = 2
step_in = 3
slow_pressure_step_in = 3
opacity=0
max_temperature = 65000
health = 300
@@ -97,29 +110,31 @@
/obj/mecha/working/ripley/mining/New()
..()
if(cell)
cell.charge = FLOOR(cell.charge * 0.25, 1) //Starts at very low charge
//Attach drill
if(prob(25)) //Possible diamond drill... Feeling lucky?
var/obj/item/mecha_parts/mecha_equipment/drill/diamonddrill/D = new /obj/item/mecha_parts/mecha_equipment/drill/diamonddrill
D.attach(src)
else
var/obj/item/mecha_parts/mecha_equipment/drill/D = new /obj/item/mecha_parts/mecha_equipment/drill
D.attach(src)
if(prob(70)) //Maybe add a drill
if(prob(15)) //Possible diamond drill... Feeling lucky?
var/obj/item/mecha_parts/mecha_equipment/drill/diamonddrill/D = new
D.attach(src)
else
var/obj/item/mecha_parts/mecha_equipment/drill/D = new
D.attach(src)
//Add possible plasma cutter
if(prob(25))
var/obj/item/mecha_parts/mecha_equipment/M = new /obj/item/mecha_parts/mecha_equipment/weapon/energy/plasma
M.attach(src)
else //Add plasma cutter if no drill
var/obj/item/mecha_parts/mecha_equipment/weapon/energy/plasma/P = new
P.attach(src)
//Add ore box to cargo
cargo.Add(new /obj/structure/ore_box(src))
//Attach hydraulic clamp
var/obj/item/mecha_parts/mecha_equipment/hydraulic_clamp/HC = new /obj/item/mecha_parts/mecha_equipment/hydraulic_clamp
var/obj/item/mecha_parts/mecha_equipment/hydraulic_clamp/HC = new
HC.attach(src)
for(var/obj/item/mecha_parts/mecha_tracking/B in trackers)//Deletes the beacon so it can't be found easily
qdel(B)
var/obj/item/mecha_parts/mecha_equipment/mining_scanner/scanner = new /obj/item/mecha_parts/mecha_equipment/mining_scanner
var/obj/item/mecha_parts/mecha_equipment/mining_scanner/scanner = new
scanner.attach(src)
/obj/mecha/working/ripley/Exit(atom/movable/O)
@@ -173,11 +188,11 @@
var/turf/T = get_turf(loc)
if(lavaland_equipment_pressure_check(T))
step_in = 3
step_in = fast_pressure_step_in
for(var/obj/item/mecha_parts/mecha_equipment/drill/drill in equipment)
drill.equip_cooldown = initial(drill.equip_cooldown)/2
else
step_in = 5
step_in = slow_pressure_step_in
for(var/obj/item/mecha_parts/mecha_equipment/drill/drill in equipment)
drill.equip_cooldown = initial(drill.equip_cooldown)
+3 -6
View File
@@ -96,9 +96,6 @@ var/list/icons_to_ignore_at_floor_init = list("damaged1","damaged2","damaged3","
overlays.Add(current_overlay)
return 1
/turf/simulated/floor/proc/gets_drilled()
return
/turf/simulated/floor/proc/break_tile_to_plating()
var/turf/simulated/floor/plating/T = make_plating()
T.break_tile()
@@ -121,11 +118,11 @@ var/list/icons_to_ignore_at_floor_init = list("damaged1","damaged2","damaged3","
return ChangeTurf(/turf/simulated/floor/plating)
/turf/simulated/floor/ChangeTurf(turf/simulated/floor/T, defer_change = FALSE, keep_icon = TRUE, ignore_air = FALSE)
if(!istype(src, /turf/simulated/floor))
if(!istype(src, /turf/simulated/floor))
return ..() //fucking turfs switch the fucking src of the fucking running procs
if(!ispath(T, /turf/simulated/floor))
if(!ispath(T, /turf/simulated/floor))
return ..()
var/old_icon = icon_regular_floor
var/old_plating = icon_plating
var/old_dir = dir
@@ -79,12 +79,6 @@
ChangeTurf(Z.turf_type, keep_icon = FALSE)
playsound(src, 'sound/weapons/Genhit.ogg', 50, 1)
/turf/simulated/floor/plating/asteroid/gets_drilled()
if(!dug)
gets_dug()
else
..()
/turf/simulated/floor/plating/asteroid/proc/gets_dug()
if(dug)
return
+5 -2
View File
@@ -27,8 +27,9 @@
/turf/simulated/mineral/New()
if (!canSmoothWith)
canSmoothWith = list(/turf/simulated/mineral)
pixel_y = -4
pixel_x = -4
var/matrix/M = new
M.Translate(-4, -4)
transform = M
icon = smooth_icon
..()
@@ -87,6 +88,8 @@
for(i=0; i < mineralAmt; i++)
new mineralType(src)
feedback_add_details("ore_mined","[mineralType]|[mineralAmt]")
for(var/obj/effect/temp_visual/mining_overlay/M in src)
qdel(M)
ChangeTurf(turf_type, defer_change)
addtimer(CALLBACK(src, .proc/AfterChange), 1, TIMER_UNIQUE)
playsound(src, 'sound/effects/break_stone.ogg', 50, 1) //beautiful destruction
@@ -8,19 +8,17 @@
w_class = WEIGHT_CLASS_SMALL
flags = CONDUCT
slot_flags = SLOT_BELT
var/cooldown = 0
var/cooldown = 35
var/current_cooldown = 0
origin_tech = "engineering=1;magnets=1"
/obj/item/mining_scanner/attack_self(mob/user)
if(!user.client)
return
if(!cooldown)
cooldown = 1
spawn(40)
cooldown = 0
var/list/mobs = list()
mobs |= user
mineral_scan_pulse(mobs, get_turf(user))
if(current_cooldown <= world.time)
current_cooldown = world.time + cooldown
mineral_scan_pulse(get_turf(user))
//Debug item to identify all ore spread quickly
@@ -41,76 +39,47 @@
flags = CONDUCT
slot_flags = SLOT_BELT
var/cooldown = 35
var/on_cooldown = 0
var/current_cooldown = 0
var/range = 7
var/meson = TRUE
origin_tech = "engineering=3;magnets=3"
/obj/item/t_scanner/adv_mining_scanner/cyborg
flags = CONDUCT | NODROP
/obj/item/t_scanner/adv_mining_scanner/material
meson = FALSE
desc = "A scanner that automatically checks surrounding rock for useful minerals; it can also be used to stop gibtonite detonations. Wear material scanners for optimal results. This one has an extended range."
/obj/item/t_scanner/adv_mining_scanner/lesser
name = "automatic mining scanner"
desc = "A scanner that automatically checks surrounding rock for useful minerals; it can also be used to stop gibtonite detonations. Wear meson scanners for optimal results."
range = 4
cooldown = 50
/obj/item/t_scanner/adv_mining_scanner/lesser/material
desc = "A scanner that automatically checks surrounding rock for useful minerals; it can also be used to stop gibtonite detonations. Wear material scanners for optimal results."
meson = FALSE
/obj/item/t_scanner/adv_mining_scanner/scan()
if(!on_cooldown)
on_cooldown = 1
spawn(cooldown)
on_cooldown = 0
if(current_cooldown <= world.time)
current_cooldown = world.time + cooldown
var/turf/t = get_turf(src)
var/list/mobs = recursive_mob_check(t, client_check = 1, sight_check = 0, include_radio = 0)
if(!mobs.len)
return
if(meson)
mineral_scan_pulse(mobs, t, range)
else
mineral_scan_pulse_material(mobs, t, range)
mineral_scan_pulse(t, range)
//For use with mesons
/proc/mineral_scan_pulse(list/mobs, turf/T, range = world.view)
/proc/mineral_scan_pulse(turf/T, range = world.view)
var/list/minerals = list()
for(var/turf/simulated/mineral/M in range(range, T))
if(M.scan_state)
minerals += M
if(minerals.len)
for(var/mob/user in mobs)
if(user.client)
var/client/C = user.client
for(var/turf/simulated/mineral/M in minerals)
var/turf/F = get_turf(M)
var/image/I = image('icons/turf/mining.dmi', loc = F, icon_state = M.scan_state, layer = 18)
C.images += I
spawn(30)
if(C)
C.images -= I
//For use with material scanners
/proc/mineral_scan_pulse_material(list/mobs, turf/T, range = world.view)
var/list/minerals = list()
for(var/turf/simulated/mineral/M in range(range, T))
if(M.scan_state)
minerals += M
if(minerals.len)
if(LAZYLEN(minerals))
for(var/turf/simulated/mineral/M in minerals)
var/obj/effect/temp_visual/mining_overlay/C = new/obj/effect/temp_visual/mining_overlay(M)
var/obj/effect/temp_visual/mining_overlay/oldC = locate(/obj/effect/temp_visual/mining_overlay) in M
if(oldC)
qdel(oldC)
var/obj/effect/temp_visual/mining_overlay/C = new /obj/effect/temp_visual/mining_overlay(M)
C.icon_state = M.scan_state
/obj/effect/temp_visual/mining_overlay
layer = 18
icon = 'icons/turf/mining.dmi'
anchored = 1
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
duration = 30
pixel_x = -4
pixel_y = -4
plane = FULLSCREEN_PLANE
layer = FLASH_LAYER
icon = 'icons/effects/ore_visuals.dmi'
appearance_flags = 0 //to avoid having TILE_BOUND in the flags, so that the 480x480 icon states let you see it no matter where you are
duration = 35
pixel_x = -224
pixel_y = -224
/obj/effect/temp_visual/mining_overlay/Initialize(mapload)
. = ..()
animate(src, alpha = 0, time = duration, easing = EASE_IN)
Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB