mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2025-12-26 10:03:45 +00:00
miscellaneous fixes to various anomaly utiliser effects involving location/holder issues, fixed anomaly harvester runtime, reworks anomaly utiliser to be a lot easier/nicer to use, balance tweaks:
- caps stun effect values for pulsing - sets max utiliser battery charge to 300 (30 sec) - changes energy consumption for utiliser pulse effects to "effect max charge level" * "effect range" ^ 2 - changes energy consumption for utiliser touch effects to 100 (10 sec worth of consumption) Signed-off-by: Cael Aislinn <cael_aislinn@yahoo.com.au>
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
|
||||
/datum/artifact_effect/cold/DoEffectTouch(var/mob/user)
|
||||
if(holder)
|
||||
user << "\blue A chill passes up your spine!"
|
||||
var/datum/gas_mixture/env = holder.loc.return_air()
|
||||
if(env)
|
||||
env.temperature = max(env.temperature - rand(5,50), 0)
|
||||
|
||||
@@ -41,7 +41,8 @@
|
||||
|
||||
/datum/artifact_effect/badfeeling/DoEffectAura()
|
||||
if(holder)
|
||||
for (var/mob/living/carbon/human/H in range(src.effectrange,holder))
|
||||
var/turf/T = get_turf(holder)
|
||||
for (var/mob/living/carbon/human/H in range(src.effectrange,T))
|
||||
if(prob(5))
|
||||
if(prob(75))
|
||||
H << "<font color='red'>[pick(messages)]</font>"
|
||||
@@ -54,7 +55,8 @@
|
||||
|
||||
/datum/artifact_effect/badfeeling/DoEffectPulse()
|
||||
if(holder)
|
||||
for (var/mob/living/carbon/human/H in range(src.effectrange,holder))
|
||||
var/turf/T = get_turf(holder)
|
||||
for (var/mob/living/carbon/human/H in range(src.effectrange,T))
|
||||
if(prob(50))
|
||||
if(prob(95))
|
||||
H << "<font color='red' size='[num2text(rand(1,5))]'><b>[pick(drastic_messages)]</b></font>"
|
||||
|
||||
@@ -15,7 +15,8 @@
|
||||
|
||||
/datum/artifact_effect/cellcharge/DoEffectAura()
|
||||
if(holder)
|
||||
for (var/obj/machinery/power/apc/C in range(200, holder))
|
||||
var/turf/T = get_turf(holder)
|
||||
for (var/obj/machinery/power/apc/C in range(200, T))
|
||||
for (var/obj/item/weapon/cell/B in C.contents)
|
||||
B.charge += 25
|
||||
for (var/obj/machinery/power/smes/S in range (src.effectrange,src))
|
||||
@@ -28,7 +29,8 @@
|
||||
|
||||
/datum/artifact_effect/cellcharge/DoEffectPulse()
|
||||
if(holder)
|
||||
for (var/obj/machinery/power/apc/C in range(200, holder))
|
||||
var/turf/T = get_turf(holder)
|
||||
for (var/obj/machinery/power/apc/C in range(200, T))
|
||||
for (var/obj/item/weapon/cell/B in C.contents)
|
||||
B.charge += rand() * 100
|
||||
for (var/obj/machinery/power/smes/S in range (src.effectrange,src))
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
|
||||
/datum/artifact_effect/celldrain/DoEffectAura()
|
||||
if(holder)
|
||||
for (var/obj/machinery/power/apc/C in range(200, holder))
|
||||
var/turf/T = get_turf(holder)
|
||||
for (var/obj/machinery/power/apc/C in range(200, T))
|
||||
for (var/obj/item/weapon/cell/B in C.contents)
|
||||
B.charge = max(B.charge - 50,0)
|
||||
for (var/obj/machinery/power/smes/S in range (src.effectrange,src))
|
||||
@@ -30,7 +31,8 @@
|
||||
|
||||
/datum/artifact_effect/celldrain/DoEffectPulse()
|
||||
if(holder)
|
||||
for (var/obj/machinery/power/apc/C in range(200, holder))
|
||||
var/turf/T = get_turf(holder)
|
||||
for (var/obj/machinery/power/apc/C in range(200, T))
|
||||
for (var/obj/item/weapon/cell/B in C.contents)
|
||||
B.charge = max(B.charge - rand() * 150,0)
|
||||
for (var/obj/machinery/power/smes/S in range (src.effectrange,src))
|
||||
|
||||
@@ -30,7 +30,8 @@
|
||||
|
||||
/datum/artifact_effect/dnaswitch/DoEffectAura()
|
||||
if(holder)
|
||||
for(var/mob/living/carbon/human/H in range(src.effectrange,holder))
|
||||
var/turf/T = get_turf(holder)
|
||||
for(var/mob/living/carbon/human/H in range(src.effectrange,T))
|
||||
var/weakness = GetAnomalySusceptibility(H)
|
||||
if(prob(weakness * 100))
|
||||
if(prob(30))
|
||||
@@ -48,7 +49,8 @@
|
||||
|
||||
/datum/artifact_effect/dnaswitch/DoEffectPulse()
|
||||
if(holder)
|
||||
for(var/mob/living/carbon/human/H in range(200, holder))
|
||||
var/turf/T = get_turf(holder)
|
||||
for(var/mob/living/carbon/human/H in range(200, T))
|
||||
var/weakness = GetAnomalySusceptibility(H)
|
||||
if(prob(weakness * 100))
|
||||
if(prob(75))
|
||||
|
||||
@@ -9,5 +9,6 @@
|
||||
|
||||
/datum/artifact_effect/emp/DoEffectPulse()
|
||||
if(holder)
|
||||
empulse(get_turf(holder), effectrange/2, effectrange)
|
||||
var/turf/T = get_turf(holder)
|
||||
empulse(T, effectrange/2, effectrange)
|
||||
return 1
|
||||
|
||||
@@ -39,7 +39,8 @@
|
||||
|
||||
/datum/artifact_effect/goodfeeling/DoEffectAura()
|
||||
if(holder)
|
||||
for (var/mob/living/carbon/human/H in range(src.effectrange,holder))
|
||||
var/turf/T = get_turf(holder)
|
||||
for (var/mob/living/carbon/human/H in range(src.effectrange,T))
|
||||
if(prob(5))
|
||||
if(prob(75))
|
||||
H << "<font color='blue'>[pick(messages)]</font>"
|
||||
@@ -52,7 +53,8 @@
|
||||
|
||||
/datum/artifact_effect/goodfeeling/DoEffectPulse()
|
||||
if(holder)
|
||||
for (var/mob/living/carbon/human/H in range(src.effectrange,holder))
|
||||
var/turf/T = get_turf(holder)
|
||||
for (var/mob/living/carbon/human/H in range(src.effectrange,T))
|
||||
if(prob(50))
|
||||
if(prob(95))
|
||||
H << "<font color='blue' size='[num2text(rand(1,5))]'><b>[pick(drastic_messages)]</b></font>"
|
||||
|
||||
@@ -36,7 +36,8 @@
|
||||
/datum/artifact_effect/heal/DoEffectAura()
|
||||
//todo: check over this properly
|
||||
if(holder)
|
||||
for (var/mob/living/carbon/C in range(src.effectrange,holder))
|
||||
var/turf/T = get_turf(holder)
|
||||
for (var/mob/living/carbon/C in range(src.effectrange,T))
|
||||
var/weakness = GetAnomalySusceptibility(C)
|
||||
if(prob(weakness * 100))
|
||||
if(prob(10))
|
||||
@@ -51,7 +52,8 @@
|
||||
/datum/artifact_effect/heal/DoEffectPulse()
|
||||
//todo: check over this properly
|
||||
if(holder)
|
||||
for (var/mob/living/carbon/C in range(src.effectrange,holder))
|
||||
var/turf/T = get_turf(holder)
|
||||
for (var/mob/living/carbon/C in range(src.effectrange,T))
|
||||
var/weakness = GetAnomalySusceptibility(C)
|
||||
if(prob(weakness * 100))
|
||||
C << "\blue A wave of energy invigorates you."
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
/datum/artifact_effect/heat/DoEffectTouch(var/mob/user)
|
||||
if(holder)
|
||||
user << "\red You feel a wave of heat travel up your spine!"
|
||||
var/datum/gas_mixture/env = holder.loc.return_air()
|
||||
if(env)
|
||||
env.temperature += rand(5,50)
|
||||
|
||||
@@ -21,7 +21,8 @@
|
||||
|
||||
/datum/artifact_effect/hurt/DoEffectAura()
|
||||
if(holder)
|
||||
for (var/mob/living/carbon/C in range(src.effectrange,holder))
|
||||
var/turf/T = get_turf(holder)
|
||||
for (var/mob/living/carbon/C in range(src.effectrange,T))
|
||||
var/weakness = GetAnomalySusceptibility(C)
|
||||
if(prob(weakness * 100))
|
||||
if(prob(10))
|
||||
@@ -35,7 +36,8 @@
|
||||
|
||||
/datum/artifact_effect/hurt/DoEffectPulse()
|
||||
if(holder)
|
||||
for (var/mob/living/carbon/C in range(effectrange, holder))
|
||||
var/turf/T = get_turf(holder)
|
||||
for (var/mob/living/carbon/C in range(effectrange, T))
|
||||
var/weakness = GetAnomalySusceptibility(C)
|
||||
if(prob(weakness * 100))
|
||||
C << "\red A wave of painful energy strikes you!"
|
||||
|
||||
@@ -16,14 +16,16 @@
|
||||
|
||||
/datum/artifact_effect/radiate/DoEffectAura()
|
||||
if(holder)
|
||||
for (var/mob/living/M in range(src.effectrange,holder))
|
||||
var/turf/T = get_turf(holder)
|
||||
for (var/mob/living/M in range(src.effectrange,T))
|
||||
M.apply_effect(radiation_amount,IRRADIATE,0)
|
||||
M.updatehealth()
|
||||
return 1
|
||||
|
||||
/datum/artifact_effect/radiate/DoEffectPulse()
|
||||
if(holder)
|
||||
for (var/mob/living/M in range(src.effectrange,holder))
|
||||
var/turf/T = get_turf(holder)
|
||||
for (var/mob/living/M in range(src.effectrange,T))
|
||||
M.apply_effect(radiation_amount * 25,IRRADIATE,0)
|
||||
M.updatehealth()
|
||||
return 1
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
|
||||
/datum/artifact_effect/roboheal/DoEffectAura()
|
||||
if(holder)
|
||||
for (var/mob/living/silicon/robot/M in range(src.effectrange,holder))
|
||||
var/turf/T = get_turf(holder)
|
||||
for (var/mob/living/silicon/robot/M in range(src.effectrange,T))
|
||||
if(prob(10))
|
||||
M << "\blue SYSTEM ALERT: Beneficial energy field detected!"
|
||||
M.adjustBruteLoss(-1)
|
||||
@@ -27,7 +28,8 @@
|
||||
|
||||
/datum/artifact_effect/roboheal/DoEffectPulse()
|
||||
if(holder)
|
||||
for (var/mob/living/silicon/robot/M in range(src.effectrange,holder))
|
||||
var/turf/T = get_turf(holder)
|
||||
for (var/mob/living/silicon/robot/M in range(src.effectrange,T))
|
||||
M << "\blue SYSTEM ALERT: Structural damage has been repaired by energy pulse!"
|
||||
M.adjustBruteLoss(-10)
|
||||
M.adjustFireLoss(-10)
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
|
||||
/datum/artifact_effect/robohurt/DoEffectAura()
|
||||
if(holder)
|
||||
for (var/mob/living/silicon/robot/M in range(src.effectrange,holder))
|
||||
var/turf/T = get_turf(holder)
|
||||
for (var/mob/living/silicon/robot/M in range(src.effectrange,T))
|
||||
if(prob(10)) M << "\red SYSTEM ALERT: Harmful energy field detected!"
|
||||
M.adjustBruteLoss(1)
|
||||
M.adjustFireLoss(1)
|
||||
@@ -26,7 +27,8 @@
|
||||
|
||||
/datum/artifact_effect/robohurt/DoEffectPulse()
|
||||
if(holder)
|
||||
for (var/mob/living/silicon/robot/M in range(src.effectrange,holder))
|
||||
var/turf/T = get_turf(holder)
|
||||
for (var/mob/living/silicon/robot/M in range(src.effectrange,T))
|
||||
M << "\red SYSTEM ALERT: Structural damage inflicted by energy pulse!"
|
||||
M.adjustBruteLoss(10)
|
||||
M.adjustFireLoss(10)
|
||||
|
||||
@@ -22,7 +22,8 @@
|
||||
|
||||
/datum/artifact_effect/sleepy/DoEffectAura()
|
||||
if(holder)
|
||||
for (var/mob/living/carbon/human/H in range(src.effectrange,holder))
|
||||
var/turf/T = get_turf(holder)
|
||||
for (var/mob/living/carbon/human/H in range(src.effectrange,T))
|
||||
var/weakness = GetAnomalySusceptibility(H)
|
||||
if(prob(weakness * 100))
|
||||
if(prob(10))
|
||||
@@ -35,7 +36,8 @@
|
||||
|
||||
/datum/artifact_effect/sleepy/DoEffectPulse()
|
||||
if(holder)
|
||||
for(var/mob/living/carbon/human/H in range(src.effectrange, holder))
|
||||
var/turf/T = get_turf(holder)
|
||||
for(var/mob/living/carbon/human/H in range(src.effectrange, T))
|
||||
var/weakness = GetAnomalySusceptibility(H)
|
||||
if(prob(weakness * 100))
|
||||
H << pick("\blue You feel like taking a nap.","\blue You feel a yawn coming on.","\blue You feel a little tired.")
|
||||
|
||||
@@ -9,33 +9,35 @@
|
||||
/datum/artifact_effect/stun/DoEffectTouch(var/mob/toucher)
|
||||
if(toucher && iscarbon(toucher))
|
||||
var/mob/living/carbon/C = toucher
|
||||
var/weakness = GetAnomalySusceptibility(C)
|
||||
if(prob(weakness * 100))
|
||||
var/susceptibility = GetAnomalySusceptibility(C)
|
||||
if(prob(susceptibility * 100))
|
||||
C << "\red A powerful force overwhelms your consciousness."
|
||||
C.weakened += 45 * weakness
|
||||
C.stuttering += 45 * weakness
|
||||
C.stunned += rand(1,10) * weakness
|
||||
C.Weaken(rand(1,10) * susceptibility)
|
||||
C.stuttering += 30 * susceptibility
|
||||
C.Stun(rand(1,10) * susceptibility)
|
||||
|
||||
/datum/artifact_effect/stun/DoEffectAura()
|
||||
if(holder)
|
||||
for (var/mob/living/carbon/C in range(src.effectrange,holder))
|
||||
var/weakness = GetAnomalySusceptibility(C)
|
||||
if(prob(10 * weakness))
|
||||
var/turf/T = get_turf(holder)
|
||||
for (var/mob/living/carbon/C in range(src.effectrange,T))
|
||||
var/susceptibility = GetAnomalySusceptibility(C)
|
||||
if(prob(10 * susceptibility))
|
||||
C << "\red Your body goes numb for a moment."
|
||||
C.weakened += 2
|
||||
C.Weaken(2)
|
||||
C.stuttering += 2
|
||||
if(prob(10))
|
||||
C.stunned += 1
|
||||
C.Stun(1)
|
||||
else if(prob(10))
|
||||
C << "\red You feel numb."
|
||||
|
||||
/datum/artifact_effect/stun/DoEffectPulse()
|
||||
if(holder)
|
||||
for (var/mob/living/carbon/C in range(src.effectrange,holder))
|
||||
var/weakness = GetAnomalySusceptibility(C)
|
||||
if(prob(100 * weakness))
|
||||
var/turf/T = get_turf(holder)
|
||||
for (var/mob/living/carbon/C in range(src.effectrange,T))
|
||||
var/susceptibility = GetAnomalySusceptibility(C)
|
||||
if(prob(100 * susceptibility))
|
||||
C << "\red A wave of energy overwhelms your senses!"
|
||||
C.weakened += 4 * weakness
|
||||
C.stuttering += 4 * weakness
|
||||
C.SetWeakened(4 * susceptibility)
|
||||
C.stuttering = 4 * susceptibility
|
||||
if(prob(10))
|
||||
C.stunned += 1 * weakness
|
||||
C.SetStunned(1 * susceptibility)
|
||||
|
||||
@@ -6,60 +6,53 @@
|
||||
/datum/artifact_effect/teleport/DoEffectTouch(var/mob/user)
|
||||
var/weakness = GetAnomalySusceptibility(user)
|
||||
if(prob(100 * weakness))
|
||||
var/list/randomturfs = new/list()
|
||||
for(var/turf/simulated/floor/T in orange(user, 50))
|
||||
randomturfs.Add(T)
|
||||
if(randomturfs.len > 0)
|
||||
user << "\red You are suddenly zapped away elsewhere!"
|
||||
if (user.buckled)
|
||||
user.buckled.unbuckle()
|
||||
user << "\red You are suddenly zapped away elsewhere!"
|
||||
if (user.buckled)
|
||||
user.buckled.unbuckle()
|
||||
|
||||
var/datum/effect/effect/system/spark_spread/sparks = new /datum/effect/effect/system/spark_spread()
|
||||
sparks.set_up(3, 0, get_turf(user))
|
||||
sparks.start()
|
||||
user.loc = pick(randomturfs)
|
||||
sparks = new /datum/effect/effect/system/spark_spread()
|
||||
sparks.set_up(3, 0, get_turf(user))
|
||||
sparks.start()
|
||||
var/datum/effect/effect/system/spark_spread/sparks = new /datum/effect/effect/system/spark_spread()
|
||||
sparks.set_up(3, 0, get_turf(user))
|
||||
sparks.start()
|
||||
//
|
||||
user.loc = pick(orange(get_turf(holder), 50))
|
||||
sparks = new /datum/effect/effect/system/spark_spread()
|
||||
sparks.set_up(3, 0, get_turf(user))
|
||||
sparks.start()
|
||||
|
||||
/datum/artifact_effect/teleport/DoEffectAura()
|
||||
if(holder)
|
||||
for (var/mob/living/M in range(src.effectrange,holder))
|
||||
var/turf/T = get_turf(holder)
|
||||
for (var/mob/living/M in range(src.effectrange,T))
|
||||
var/weakness = GetAnomalySusceptibility(M)
|
||||
if(prob(100 * weakness))
|
||||
var/list/randomturfs = new/list()
|
||||
for(var/turf/simulated/floor/T in orange(M, 30))
|
||||
randomturfs.Add(T)
|
||||
if(randomturfs.len > 0)
|
||||
M << "\red You are displaced by a strange force!"
|
||||
if(M.buckled)
|
||||
M.buckled.unbuckle()
|
||||
M << "\red You are displaced by a strange force!"
|
||||
if(M.buckled)
|
||||
M.buckled.unbuckle()
|
||||
|
||||
var/datum/effect/effect/system/spark_spread/sparks = new /datum/effect/effect/system/spark_spread()
|
||||
sparks.set_up(3, 0, get_turf(M))
|
||||
sparks.start()
|
||||
M.loc = pick(randomturfs)
|
||||
sparks = new /datum/effect/effect/system/spark_spread()
|
||||
sparks.set_up(3, 0, get_turf(M))
|
||||
sparks.start()
|
||||
var/datum/effect/effect/system/spark_spread/sparks = new /datum/effect/effect/system/spark_spread()
|
||||
sparks.set_up(3, 0, get_turf(M))
|
||||
sparks.start()
|
||||
//
|
||||
M.loc = pick(orange(get_turf(T), 50))
|
||||
sparks = new /datum/effect/effect/system/spark_spread()
|
||||
sparks.set_up(3, 0, get_turf(M))
|
||||
sparks.start()
|
||||
|
||||
/datum/artifact_effect/teleport/DoEffectPulse()
|
||||
if(holder)
|
||||
for (var/mob/living/M in range(src.effectrange, holder))
|
||||
var/turf/T = get_turf(holder)
|
||||
for (var/mob/living/M in range(src.effectrange, T))
|
||||
var/weakness = GetAnomalySusceptibility(M)
|
||||
if(prob(100 * weakness))
|
||||
var/list/randomturfs = new/list()
|
||||
for(var/turf/simulated/floor/T in orange(M, 15))
|
||||
randomturfs.Add(T)
|
||||
if(randomturfs.len > 0)
|
||||
M << "\red You are displaced by a strange force!"
|
||||
M << "\red You are displaced by a strange force!"
|
||||
if(M.buckled)
|
||||
M.buckled.unbuckle()
|
||||
|
||||
var/datum/effect/effect/system/spark_spread/sparks = new /datum/effect/effect/system/spark_spread()
|
||||
sparks.set_up(3, 0, get_turf(M))
|
||||
sparks.start()
|
||||
if(M.buckled)
|
||||
M.buckled.unbuckle()
|
||||
M.loc = pick(randomturfs)
|
||||
sparks = new /datum/effect/effect/system/spark_spread()
|
||||
sparks.set_up(3, 0, get_turf(M))
|
||||
sparks.start()
|
||||
var/datum/effect/effect/system/spark_spread/sparks = new /datum/effect/effect/system/spark_spread()
|
||||
sparks.set_up(3, 0, get_turf(M))
|
||||
sparks.start()
|
||||
//
|
||||
M.loc = pick(orange(get_turf(T), 50))
|
||||
sparks = new /datum/effect/effect/system/spark_spread()
|
||||
sparks.set_up(3, 0, get_turf(M))
|
||||
sparks.start()
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
var/obj/item/weapon/anobattery/inserted_battery
|
||||
var/obj/machinery/artifact/cur_artifact
|
||||
var/obj/machinery/artifact_scanpad/owned_scanner = null
|
||||
var/last_process = 0
|
||||
|
||||
/obj/machinery/artifact_harvester/New()
|
||||
..()
|
||||
@@ -74,8 +75,9 @@
|
||||
return
|
||||
|
||||
if(harvesting > 0)
|
||||
//gain a bit of charge
|
||||
inserted_battery.stored_charge += 0.5
|
||||
//charge at 33% consumption rate
|
||||
inserted_battery.stored_charge += (last_process - last_process) / 3
|
||||
last_process = world.time
|
||||
|
||||
//check if we've finished
|
||||
if(inserted_battery.stored_charge >= inserted_battery.capacity)
|
||||
@@ -135,7 +137,7 @@
|
||||
mundane++
|
||||
break
|
||||
|
||||
if(analysed.being_used)
|
||||
if(analysed && analysed.being_used)
|
||||
var/message = "<b>[src]</b> states, \"Cannot harvest. Too much interference.\""
|
||||
src.visible_message(message)
|
||||
else if(articount == 1 && !mundane)
|
||||
@@ -162,6 +164,7 @@
|
||||
icon_state = "incubator_on"
|
||||
var/message = "<b>[src]</b> states, \"Beginning artifact energy harvesting.\""
|
||||
src.visible_message(message)
|
||||
last_process = world.time
|
||||
|
||||
//duplicate the artifact's effect datum
|
||||
if(!inserted_battery.battery_effect)
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
icon = 'icons/obj/xenoarchaeology.dmi'
|
||||
icon_state = "anobattery0"
|
||||
var/datum/artifact_effect/battery_effect
|
||||
var/capacity = 200
|
||||
var/capacity = 300
|
||||
var/stored_charge = 0
|
||||
var/effect_id = ""
|
||||
|
||||
@@ -20,13 +20,15 @@
|
||||
name = "Anomaly power utilizer"
|
||||
icon = 'icons/obj/xenoarchaeology.dmi'
|
||||
icon_state = "anodev"
|
||||
var/cooldown = 0
|
||||
var/activated = 0
|
||||
var/timing = 0
|
||||
var/time = 50
|
||||
var/archived_time = 50
|
||||
var/duration = 0
|
||||
var/interval = 0
|
||||
var/time_end = 0
|
||||
var/last_activation = 0
|
||||
var/last_process = 0
|
||||
var/obj/item/weapon/anobattery/inserted_battery
|
||||
var/turf/archived_loc
|
||||
var/energy_consumed_on_touch = 100
|
||||
|
||||
/obj/item/weapon/anodevice/New()
|
||||
..()
|
||||
@@ -47,54 +49,35 @@
|
||||
return src.interact(user)
|
||||
|
||||
/obj/item/weapon/anodevice/interact(var/mob/user)
|
||||
user.set_machine(src)
|
||||
var/dat = "<b>Anomalous Materials Energy Utiliser</b><br>"
|
||||
if(inserted_battery)
|
||||
if(cooldown)
|
||||
dat += "Cooldown in progress, please wait.<br>"
|
||||
else if(activated)
|
||||
if(timing)
|
||||
dat += "Device active.<br>"
|
||||
else
|
||||
dat += "Device active in timed mode.<br>"
|
||||
if(activated)
|
||||
dat += "Device active.<br>"
|
||||
|
||||
dat += "[inserted_battery] inserted, anomaly ID: [inserted_battery.battery_effect.artifact_id ? inserted_battery.battery_effect.artifact_id : "NA"]<BR>"
|
||||
dat += "<b>Total Power:</b> [inserted_battery.stored_charge]/[inserted_battery.capacity]<BR><BR>"
|
||||
dat += "<b>Timed activation:</b> <A href='?src=\ref[src];neg_changetime_max=-100'>--</a> <A href='?src=\ref[src];neg_changetime=-10'>-</a> [time >= 1000 ? "[time/10]" : time >= 100 ? " [time/10]" : " [time/10]" ] <A href='?src=\ref[src];changetime=10'>+</a> <A href='?src=\ref[src];changetime_max=100'>++</a><BR>"
|
||||
if(cooldown)
|
||||
dat += "<font color=red>Cooldown in progress.</font><BR>"
|
||||
dat += "<br>"
|
||||
else if(!activated)
|
||||
dat += "<A href='?src=\ref[src];startup=1'>Start</a><BR>"
|
||||
dat += "<A href='?src=\ref[src];startup=1;starttimer=1'>Start in timed mode</a><BR>"
|
||||
dat += "<b>Charge:</b> [inserted_battery.stored_charge] / [inserted_battery.capacity]<BR>"
|
||||
dat += "<b>Time left activated:</b> [round(max((time_end - last_process) / 10, 0))]<BR>"
|
||||
if(activated)
|
||||
dat += "<a href='?src=\ref[src];shutdown=1'>Shutdown</a><br>"
|
||||
else
|
||||
dat += "<a href='?src=\ref[src];shutdown=1'>Shutdown emission</a><br>"
|
||||
dat += "<br>"
|
||||
dat += "<A href='?src=\ref[src];startup=1'>Start</a><BR>"
|
||||
dat += "<BR>"
|
||||
|
||||
dat += "<b>Activate duration (sec):</b> <A href='?src=\ref[src];changetime=-100;duration=1'>--</a> <A href='?src=\ref[src];changetime=-10;duration=1'>-</a> [duration/10] <A href='?src=\ref[src];changetime=10;duration=1'>+</a> <A href='?src=\ref[src];changetime=100;duration=1'>++</a><BR>"
|
||||
dat += "<b>Activate interval (sec):</b> <A href='?src=\ref[src];changetime=-100;interval=1'>--</a> <A href='?src=\ref[src];changetime=-10;interval=1'>-</a> [interval/10] <A href='?src=\ref[src];changetime=10;interval=1'>+</a> <A href='?src=\ref[src];changetime=100;interval=1'>++</a><BR>"
|
||||
dat += "<br>"
|
||||
dat += "<A href='?src=\ref[src];ejectbattery=1'>Eject battery</a><BR>"
|
||||
else
|
||||
dat += "Please insert battery<br>"
|
||||
|
||||
dat += "<br>"
|
||||
dat += "<br>"
|
||||
dat += "<br>"
|
||||
|
||||
dat += "<br>"
|
||||
dat += "<br>"
|
||||
dat += "<br>"
|
||||
|
||||
dat += "<hr>"
|
||||
dat += "<a href='?src=\ref[src]'>Refresh</a> <a href='?src=\ref[src];close=1'>Close</a>"
|
||||
dat += "<a href='?src=\ref[src];refresh=1'>Refresh</a> <a href='?src=\ref[src];close=1'>Close</a>"
|
||||
|
||||
user << browse(dat, "window=anodevice;size=400x500")
|
||||
onclose(user, "anodevice")
|
||||
|
||||
/obj/item/weapon/anodevice/process()
|
||||
if(cooldown > 0)
|
||||
cooldown -= 1
|
||||
if(cooldown <= 0)
|
||||
cooldown = 0
|
||||
src.visible_message("\blue \icon[src] [src] chimes.", "\blue \icon[src] You hear something chime.")
|
||||
else if(activated)
|
||||
if(activated)
|
||||
if(inserted_battery && inserted_battery.battery_effect)
|
||||
//make sure the effect is active
|
||||
if(!inserted_battery.battery_effect.activated)
|
||||
@@ -106,71 +89,83 @@
|
||||
archived_loc = T
|
||||
inserted_battery.battery_effect.UpdateMove()
|
||||
|
||||
//process the effect
|
||||
inserted_battery.battery_effect.process()
|
||||
//if someone is holding the device, do the effect on them
|
||||
if(inserted_battery.battery_effect.effect == 0 && ismob(src.loc))
|
||||
inserted_battery.battery_effect.DoEffectTouch(src.loc)
|
||||
var/mob/holder
|
||||
if(ismob(src.loc))
|
||||
holder = src.loc
|
||||
|
||||
//handle charge
|
||||
inserted_battery.stored_charge -= 1
|
||||
if(inserted_battery.stored_charge <= 0)
|
||||
shutdown_emission()
|
||||
if(world.time - last_activation > interval)
|
||||
if(inserted_battery.battery_effect.effect == EFFECT_TOUCH)
|
||||
if(interval > 0)
|
||||
//apply the touch effect to the holder
|
||||
if(holder)
|
||||
holder << "the \icon[src] [src] held by [holder] shudders in your grasp."
|
||||
else
|
||||
src.loc.visible_message("the \icon[src] [src] shudders.")
|
||||
inserted_battery.battery_effect.DoEffectTouch(holder)
|
||||
|
||||
//handle timed mode
|
||||
if(timing)
|
||||
time -= 1
|
||||
if(time <= 0)
|
||||
shutdown_emission()
|
||||
//consume power
|
||||
inserted_battery.stored_charge -= energy_consumed_on_touch
|
||||
else
|
||||
//consume power equal to time passed
|
||||
inserted_battery.stored_charge -= world.time - last_process
|
||||
|
||||
else if(inserted_battery.battery_effect.effect == EFFECT_PULSE)
|
||||
inserted_battery.battery_effect.chargelevel = inserted_battery.battery_effect.chargelevelmax
|
||||
|
||||
//consume power relative to the time the artifact takes to charge and the effect range
|
||||
inserted_battery.stored_charge -= inserted_battery.battery_effect.effectrange * inserted_battery.battery_effect.effectrange * inserted_battery.battery_effect.chargelevelmax
|
||||
|
||||
else
|
||||
//consume power equal to time passed
|
||||
inserted_battery.stored_charge -= world.time - last_process
|
||||
|
||||
last_activation = world.time
|
||||
|
||||
//process the effect
|
||||
inserted_battery.battery_effect.process()
|
||||
|
||||
//work out if we need to shutdown
|
||||
if(inserted_battery.stored_charge <= 0)
|
||||
src.loc.visible_message("\blue \icon[src] [src] buzzes.", "\blue \icon[src] You hear something buzz.")
|
||||
shutdown_emission()
|
||||
else if(world.time > time_end)
|
||||
src.loc.visible_message("\blue \icon[src] [src] chimes.", "\blue \icon[src] You hear something chime.")
|
||||
shutdown_emission()
|
||||
else
|
||||
shutdown()
|
||||
src.visible_message("\blue \icon[src] [src] buzzes.", "\blue \icon[src] You hear something buzz.")
|
||||
shutdown_emission()
|
||||
last_process = world.time
|
||||
|
||||
/obj/item/weapon/anodevice/proc/shutdown_emission()
|
||||
if(activated)
|
||||
activated = 0
|
||||
timing = 0
|
||||
src.visible_message("\blue \icon[src] [src] buzzes.", "\icon[src]\blue You hear something buzz.")
|
||||
|
||||
cooldown = archived_time / 2
|
||||
|
||||
if(inserted_battery.battery_effect.activated)
|
||||
inserted_battery.battery_effect.ToggleActivate(1)
|
||||
|
||||
/obj/item/weapon/anodevice/Topic(href, href_list)
|
||||
|
||||
if(href_list["neg_changetime_max"])
|
||||
time += -100
|
||||
if(time > inserted_battery.capacity)
|
||||
time = inserted_battery.capacity
|
||||
else if (time < 0)
|
||||
time = 0
|
||||
if(href_list["neg_changetime"])
|
||||
time += -10
|
||||
if(time > inserted_battery.capacity)
|
||||
time = inserted_battery.capacity
|
||||
else if (time < 0)
|
||||
time = 0
|
||||
if(href_list["changetime"])
|
||||
time += 10
|
||||
if(time > inserted_battery.capacity)
|
||||
time = inserted_battery.capacity
|
||||
else if (time < 0)
|
||||
time = 0
|
||||
if(href_list["changetime_max"])
|
||||
time += 100
|
||||
if(time > inserted_battery.capacity)
|
||||
time = inserted_battery.capacity
|
||||
else if (time < 0)
|
||||
time = 0
|
||||
var/timedif = text2num(href_list["changetime"])
|
||||
if(href_list["duration"])
|
||||
duration += timedif
|
||||
//max 30 sec duration
|
||||
duration = min(max(duration, 0), 300)
|
||||
if(activated)
|
||||
time_end += timedif
|
||||
else if(href_list["interval"])
|
||||
interval += timedif
|
||||
//max 10 sec interval
|
||||
interval = min(max(interval, 0), 100)
|
||||
if(href_list["startup"])
|
||||
activated = 1
|
||||
src.visible_message("\blue \icon[src] [src] whirrs.", "\icon[src]\blue You hear something whirr.")
|
||||
if(!inserted_battery.battery_effect.activated)
|
||||
inserted_battery.battery_effect.ToggleActivate(1)
|
||||
time_end = world.time + duration
|
||||
if(href_list["shutdown"])
|
||||
activated = 0
|
||||
if(href_list["starttimer"])
|
||||
timing = 1
|
||||
archived_time = time
|
||||
if(href_list["ejectbattery"])
|
||||
shutdown_emission()
|
||||
inserted_battery.loc = get_turf(src)
|
||||
@@ -178,10 +173,10 @@
|
||||
UpdateSprite()
|
||||
if(href_list["close"])
|
||||
usr << browse(null, "window=anodevice")
|
||||
usr.unset_machine(src)
|
||||
|
||||
else if(ismob(src.loc))
|
||||
var/mob/M = src.loc
|
||||
src.interact(M)
|
||||
..()
|
||||
updateDialog()
|
||||
|
||||
/obj/item/weapon/anodevice/proc/UpdateSprite()
|
||||
if(!inserted_battery)
|
||||
@@ -194,3 +189,23 @@
|
||||
/obj/item/weapon/anodevice/Del()
|
||||
processing_objects.Remove(src)
|
||||
..()
|
||||
|
||||
/obj/item/weapon/anodevice/attack(mob/living/M as mob, mob/living/user as mob, def_zone)
|
||||
if (!istype(M))
|
||||
return
|
||||
|
||||
if(activated && inserted_battery.battery_effect.effect == EFFECT_TOUCH && !isnull(inserted_battery))
|
||||
inserted_battery.battery_effect.DoEffectTouch(M)
|
||||
inserted_battery.stored_charge -= energy_consumed_on_touch
|
||||
user.visible_message("\blue [user] taps [M] with [src], and it shudders on contact.")
|
||||
else
|
||||
user.visible_message("\blue [user] taps [M] with [src], but nothing happens.")
|
||||
|
||||
//admin logging
|
||||
user.lastattacked = M
|
||||
M.lastattacker = user
|
||||
|
||||
if(inserted_battery.battery_effect)
|
||||
user.attack_log += "\[[time_stamp()]\]<font color='red'> Tapped [M.name] ([M.ckey]) with [name] (EFFECT: [inserted_battery.battery_effect.effecttype])</font>"
|
||||
M.attack_log += "\[[time_stamp()]\]<font color='orange'> Tapped by [user.name] ([user.ckey]) with [name] (EFFECT: [inserted_battery.battery_effect.effecttype])</font>"
|
||||
msg_admin_attack("[key_name(user)] tapped [key_name(M)] with [name] (EFFECT: [inserted_battery.battery_effect.effecttype])" )
|
||||
|
||||
Reference in New Issue
Block a user