mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-01-01 05:02:33 +00:00
* Adds the check components * Adds in trailing newlines * Converts all CRLF to LF * Post merge EOF * Post merge line endings * Final commit
117 lines
3.8 KiB
Plaintext
117 lines
3.8 KiB
Plaintext
/**********************Resonator**********************/
|
|
/obj/item/resonator
|
|
name = "resonator"
|
|
icon = 'icons/obj/items.dmi'
|
|
icon_state = "resonator"
|
|
item_state = "resonator"
|
|
origin_tech = "magnets=3;engineering=3"
|
|
desc = "A handheld device that creates small fields of energy that resonate until they detonate, crushing rock. It can also be activated without a target to create a field at the user's location, to act as a delayed time trap. It's more effective in a vaccuum."
|
|
w_class = WEIGHT_CLASS_NORMAL
|
|
force = 15
|
|
throwforce = 10
|
|
var/burst_time = 30
|
|
var/fieldlimit = 4
|
|
var/list/fields = list()
|
|
var/quick_burst_mod = 0.8
|
|
|
|
/obj/item/resonator/upgraded
|
|
name = "upgraded resonator"
|
|
desc = "An upgraded version of the resonator that can produce more fields at once."
|
|
icon_state = "resonator_u"
|
|
origin_tech = "materials=4;powerstorage=3;engineering=3;magnets=3"
|
|
fieldlimit = 6
|
|
quick_burst_mod = 1
|
|
|
|
/obj/item/resonator/attack_self(mob/user)
|
|
if(burst_time == 50)
|
|
burst_time = 30
|
|
to_chat(user, "<span class='info'>You set the resonator's fields to detonate after 3 seconds.</span>")
|
|
else
|
|
burst_time = 50
|
|
to_chat(user, "<span class='info'>You set the resonator's fields to detonate after 5 seconds.</span>")
|
|
|
|
/obj/item/resonator/proc/CreateResonance(target, mob/user)
|
|
var/turf/T = get_turf(target)
|
|
var/obj/effect/temp_visual/resonance/R = locate(/obj/effect/temp_visual/resonance) in T
|
|
if(R)
|
|
R.damage_multiplier = quick_burst_mod
|
|
R.burst()
|
|
return
|
|
if(LAZYLEN(fields) < fieldlimit)
|
|
new /obj/effect/temp_visual/resonance(T, user, src, burst_time)
|
|
user.changeNext_move(CLICK_CD_MELEE)
|
|
|
|
/obj/item/resonator/pre_attackby(atom/target, mob/user, params)
|
|
if(check_allowed_items(target, 1))
|
|
CreateResonance(target, user)
|
|
return TRUE
|
|
|
|
//resonance field, crushes rock, damages mobs
|
|
/obj/effect/temp_visual/resonance
|
|
name = "resonance field"
|
|
desc = "A resonating field that significantly damages anything inside of it when the field eventually ruptures. More damaging in low pressure environments."
|
|
icon = 'icons/effects/effects.dmi'
|
|
icon_state = "shield1"
|
|
layer = ABOVE_ALL_MOB_LAYER
|
|
duration = 50
|
|
var/resonance_damage = 20
|
|
var/damage_multiplier = 1
|
|
var/creator
|
|
var/obj/item/resonator/res
|
|
|
|
/obj/effect/temp_visual/resonance/New(loc, set_creator, set_resonator, set_duration)
|
|
duration = set_duration
|
|
. = ..()
|
|
creator = set_creator
|
|
res = set_resonator
|
|
if(res)
|
|
res.fields += src
|
|
playsound(src,'sound/weapons/resonator_fire.ogg',50,1)
|
|
transform = matrix() * 0.75
|
|
animate(src, transform = matrix() * 1.5, time = duration)
|
|
deltimer(timerid)
|
|
timerid = addtimer(CALLBACK(src, .proc/burst), duration, TIMER_STOPPABLE)
|
|
|
|
/obj/effect/temp_visual/resonance/Destroy()
|
|
if(res)
|
|
res.fields -= src
|
|
res = null
|
|
creator = null
|
|
return ..()
|
|
|
|
/obj/effect/temp_visual/resonance/proc/check_pressure(turf/proj_turf)
|
|
if(!proj_turf)
|
|
proj_turf = get_turf(src)
|
|
resonance_damage = initial(resonance_damage)
|
|
if(lavaland_equipment_pressure_check(proj_turf))
|
|
name = "strong [initial(name)]"
|
|
resonance_damage *= 3
|
|
else
|
|
name = initial(name)
|
|
resonance_damage *= damage_multiplier
|
|
|
|
/obj/effect/temp_visual/resonance/proc/burst()
|
|
var/turf/T = get_turf(src)
|
|
new /obj/effect/temp_visual/resonance_crush(T)
|
|
if(ismineralturf(T))
|
|
var/turf/simulated/mineral/M = T
|
|
M.gets_drilled(creator)
|
|
check_pressure(T)
|
|
playsound(T,'sound/weapons/resonator_blast.ogg',50,1)
|
|
for(var/mob/living/L in T)
|
|
if(creator)
|
|
add_attack_logs(creator, L, "Resonance field'ed")
|
|
to_chat(L, "<span class='userdanger'>[src] ruptured with you in it!</span>")
|
|
L.apply_damage(resonance_damage, BRUTE)
|
|
qdel(src)
|
|
|
|
/obj/effect/temp_visual/resonance_crush
|
|
icon_state = "shield1"
|
|
layer = ABOVE_ALL_MOB_LAYER
|
|
duration = 4
|
|
|
|
/obj/effect/temp_visual/resonance_crush/New()
|
|
..()
|
|
transform = matrix()*1.5
|
|
animate(src, transform = matrix() * 0.1, alpha = 50, time = 4)
|