diff --git a/code/game/objects/effects/effect_system.dm b/code/game/objects/effects/effect_system.dm deleted file mode 100644 index 3f8eb81c6b9..00000000000 --- a/code/game/objects/effects/effect_system.dm +++ /dev/null @@ -1,1289 +0,0 @@ -/* This is an attempt to make some easily reusable "particle" type effect, to stop the code -constantly having to be rewritten. An item like the jetpack that uses the ion_trail_follow system, just has one -defined, then set up when it is created with New(). Then this same system can just be reused each time -it needs to create more trails.A beaker could have a steam_trail_follow system set up, then the steam -would spawn and follow the beaker, even if it is carried or thrown. -*/ - - -/obj/effect/effect - name = "effect" - icon = 'icons/effects/effects.dmi' - mouse_opacity = 0 - unacidable = 1//So effect are not targeted by alien acid. - -/obj/effect/effect/New() - ..() - if(ticker) - cameranet.updateVisibility(src) - -/obj/effect/effect/Destroy() - if(ticker) - cameranet.updateVisibility(src) - return ..() - -/datum/effect/proc/fadeOut(var/atom/A, var/frames = 16) - if(A.alpha == 0) //Handle already transparent case - return - if(frames == 0) - frames = 1 //We will just assume that by 0 frames, the coder meant "during one frame". - var/step = A.alpha / frames - for(var/i = 0, i < frames, i++) - A.alpha -= step - sleep(world.tick_lag) - return - -/obj/effect/effect/water - name = "water" - icon = 'icons/effects/effects.dmi' - icon_state = "extinguish" - var/life = 15.0 - mouse_opacity = 0 - -/obj/effect/effect/smoke - name = "smoke" - icon = 'icons/effects/water.dmi' - icon_state = "smoke" - opacity = 1 - anchored = 0.0 - mouse_opacity = 0 - var/amount = 8.0 - -/obj/effect/proc/delete() - qdel(src) - - -/obj/effect/effect/water/New() - ..() - //var/turf/T = src.loc - //if(istype(T, /turf)) - // T.firelevel = 0 //TODO: FIX - spawn( 70 ) - delete() - return - return - -/obj/effect/effect/water/Move(turf/newloc) - //var/turf/T = src.loc - //if(istype(T, /turf)) - // T.firelevel = 0 //TODO: FIX - if(--src.life < 1) - //SN src = null - delete() - if(newloc.density) - return 0 - .=..() - -/obj/effect/effect/water/Bump(atom/A) - if(reagents) - reagents.reaction(A) - if(istype(A,/atom/movable)) - var/atom/movable/AM = A - AM.water_act(life, COLD_WATER_TEMPERATURE, src) - return ..() - - -/datum/effect/system - var/number = 3 - var/cardinals = 0 - var/turf/location - var/atom/holder - var/setup = 0 - - Destroy() - holder = null - location = null - return ..() - - proc/set_up(n = 3, c = 0, turf/loc) - if(n > 10) - n = 10 - number = n - cardinals = c - location = loc - setup = 1 - - proc/attach(atom/atom) - holder = atom - - proc/start() - - -///////////////////////////////////////////// -// GENERIC STEAM SPREAD SYSTEM - -//Usage: set_up(number of bits of steam, use North/South/East/West only, spawn location) -// The attach(atom/atom) proc is optional, and can be called to attach the effect -// to something, like a smoking beaker, so then you can just call start() and the steam -// will always spawn at the items location, even if it's moved. - -/* Example: - var/datum/effect/system/steam_spread/steam = new /datum/effect/system/steam_spread() -- creates new system - steam.set_up(5, 0, mob.loc) -- sets up variables - OPTIONAL: steam.attach(mob) - steam.start() -- spawns the effect -*/ -///////////////////////////////////////////// -/obj/effect/effect/steam - name = "steam" - icon = 'icons/effects/effects.dmi' - icon_state = "extinguish" - density = 0 - -/datum/effect/system/steam_spread - - set_up(n = 3, c = 0, turf/loc) - if(n > 10) - n = 10 - number = n - cardinals = c - location = loc - - start() - var/i = 0 - for(i=0, i 10) - n = 10 - number = n - cardinals = c - if(istype(loca, /turf/)) - location = loca - else - location = get_turf(loca) - - start() - var/i = 0 - for(i=0, i 20) - return - spawn(0) - if(holder) - src.location = get_turf(holder) - var/obj/effect/effect/sparks/sparks = new /obj/effect/effect/sparks(src.location) - src.total_sparks++ - var/direction - if(src.cardinals) - direction = pick(cardinal) - else - direction = pick(alldirs) - for(i=0, i 10) - n = 10 - number = n - cardinals = c - if(istype(loca, /turf/)) - location = loca - else - location = get_turf(loca) - if(direct) - direction = direct - - - start() - var/i = 0 - for(i=0, i 20) - return - spawn(0) - if(holder) - src.location = get_turf(holder) - var/obj/effect/effect/harmless_smoke/smoke = new /obj/effect/effect/harmless_smoke(src.location) - src.total_smoke++ - var/direction = src.direction - if(!direction) - if(src.cardinals) - direction = pick(cardinal) - else - direction = pick(alldirs) - for(i=0, i 20) - n = 20 - number = n - cardinals = c - if(istype(loca, /turf/)) - location = loca - else - location = get_turf(loca) - if(direct) - direction = direct - - start() - var/i = 0 - for(i=0, i 20) - return - spawn(0) - if(holder) - src.location = get_turf(holder) - var/obj/effect/effect/bad_smoke/smoke = new /obj/effect/effect/bad_smoke(src.location) - src.total_smoke++ - var/direction = src.direction - if(!direction) - if(src.cardinals) - direction = pick(cardinal) - else - direction = pick(alldirs) - for(i=0, i 20) - n = 20 - number = n - cardinals = c - carry.copy_to(chemholder, carry.total_volume) - - - if(istype(loca, /turf/)) - location = loca - else - location = get_turf(loca) - if(direct) - direction = direct - if(!silent) - var/contained = "" - for(var/reagent in carry.reagent_list) - contained += " [reagent] " - if(contained) - contained = "\[[contained]\]" - var/area/A = get_area(location) - - var/where = "[A.name] | [location.x], [location.y]" - var/whereLink = "[where]" - - if(carry && carry.my_atom) - if(carry.my_atom.fingerprintslast) - var/mob/M = get_mob_by_key(carry.my_atom.fingerprintslast) - var/more = "" - if(M) - more = " " - add_attack_logs(M, location, "Caused a chemical smoke reaction containing [contained]. Last associated key is [carry.my_atom.fingerprintslast][more]", ATKLOG_FEW) - log_game("A chemical smoke reaction has taken place in ([where])[contained]. Last associated key is [carry.my_atom.fingerprintslast].") - else - msg_admin_attack("A chemical smoke reaction has taken place in ([whereLink]). No associated key.", 0, 1) - log_game("A chemical smoke reaction has taken place in ([where])[contained]. No associated key.") - else - msg_admin_attack("A chemical smoke reaction has taken place in ([whereLink]). No associated key. CODERS: carry.my_atom may be null.", 0, 1) - log_game("A chemical smoke reaction has taken place in ([where])[contained]. No associated key. CODERS: carry.my_atom may be null.") - - start(effect_range = 2) - var/i = 0 - - var/color = mix_color_from_reagents(chemholder.reagents.reagent_list) - var/obj/effect/effect/chem_smoke/smokeholder = new /obj/effect/effect/chem_smoke(src.location) - for(var/atom/A in view(effect_range, smokeholder)) - chemholder.reagents.reaction(A) - if(iscarbon(A)) - var/mob/living/carbon/C = A - if(C.can_breathe_gas()) - chemholder.reagents.copy_to(C, chemholder.reagents.total_volume) - qdel(smokeholder) - for(i=0, i 20) - return - spawn(0) - if(holder) - src.location = get_turf(holder) - var/obj/effect/effect/chem_smoke/smoke = new /obj/effect/effect/chem_smoke(src.location) - src.total_smoke++ - var/direction = src.direction - if(!direction) - if(src.cardinals) - direction = pick(cardinal) - else - direction = pick(alldirs) - - if(color) - smoke.icon += color // give the smoke color, if it has any to begin with - else - // if no color, just use the old smoke icon - smoke.icon = 'icons/effects/96x96.dmi' - smoke.icon_state = "smoke" - for(i=0, i 20) - n = 20 - number = n - cardinals = c - if(istype(loca, /turf/)) - location = loca - else - location = get_turf(loca) - if(direct) - direction = direct - - - start() - var/i = 0 - for(i=0, i 20) - return - spawn(0) - if(holder) - src.location = get_turf(holder) - var/obj/effect/effect/sleep_smoke/smoke = new /obj/effect/effect/sleep_smoke(src.location) - src.total_smoke++ - var/direction = src.direction - if(!direction) - if(src.cardinals) - direction = pick(cardinal) - else - direction = pick(alldirs) - for(i=0, i 20) - n = 20 - number = n - cardinals = c - if(istype(loca, /turf/)) - location = loca - else - location = get_turf(loca) - if(direct) - direction = direct - - start() - var/i = 0 - for(i=0, i 20) - return - spawn(0) - if(holder) - src.location = get_turf(holder) - var/obj/effect/effect/mustard_gas/smoke = new /obj/effect/effect/mustard_gas(src.location) - src.total_smoke++ - var/direction = src.direction - if(!direction) - if(src.cardinals) - direction = pick(cardinal) - else - direction = pick(alldirs) - for(i=0, i[user] smashes through \the [src].", "You smash through \the [src].") - qdel(src) - else - to_chat(user, "You hit the metal foam but bounce off it.") - -/obj/structure/foamedmetal/attackby(var/obj/item/I, var/mob/user, params) - user.changeNext_move(CLICK_CD_MELEE) - user.do_attack_animation(src) - if(istype(I, /obj/item/grab)) - var/obj/item/grab/G = I - G.affecting.loc = src.loc - user.visible_message("[G.assailant] smashes [G.affecting] through the foamed metal wall.") - qdel(I) - qdel(src) - return - - if(prob(I.force*20 - metal*25)) - user.visible_message("[user] smashes through the foamed metal with \the [I].", "You smash through the foamed metal with \the [I].") - qdel(src) - else - to_chat(user, "You hit the metal foam to no effect.") - -/obj/structure/foamedmetal/attack_animal(mob/living/simple_animal/M) - M.do_attack_animation(src) - if(M.melee_damage_upper == 0) - M.visible_message("[M] nudges \the [src].") - else - if(M.attack_sound) - playsound(loc, M.attack_sound, 50, 1, 1) - M.visible_message("\The [M] [M.attacktext] [src]!") - qdel(src) - -/obj/structure/foamedmetal/attack_alien(mob/living/carbon/alien/humanoid/M) - M.visible_message("[M] tears apart \the [src]!") - qdel(src) - -/obj/structure/foamedmetal/CanPass(atom/movable/mover, turf/target, height=1.5) - return !density - -/obj/structure/foamedmetal/CanAtmosPass() - return !density - -/datum/effect/system/reagents_explosion - var/amount // TNT equivalent - var/flashing = 0 // does explosion creates flash effect? - var/flashing_factor = 0 // factor of how powerful the flash effect relatively to the explosion - - set_up (amt, loc, flash = 0, flash_fact = 0) - amount = amt - if(istype(loc, /turf/)) - location = loc - else - location = get_turf(loc) - - flashing = flash - flashing_factor = flash_fact - - return - - start() - if(amount <= 2) - var/datum/effect/system/spark_spread/s = new /datum/effect/system/spark_spread - s.set_up(2, 1, location) - s.start() - - for(var/mob/M in viewers(5, location)) - to_chat(M, "The solution violently explodes.") - for(var/mob/M in viewers(1, location)) - if(prob (50 * amount)) - to_chat(M, "The explosion knocks you down.") - M.Weaken(rand(1,5)) - return - else - var/devastation = -1 - var/heavy = -1 - var/light = -1 - var/flash = -1 - - // Clamp all values to MAX_EXPLOSION_RANGE - if(round(amount/12) > 0) - devastation = min (MAX_EX_DEVASTATION_RANGE, devastation + round(amount/12)) - - if(round(amount/6) > 0) - heavy = min (MAX_EX_HEAVY_RANGE, heavy + round(amount/6)) - - if(round(amount/3) > 0) - light = min (MAX_EX_LIGHT_RANGE, light + round(amount/3)) - - if(flash && flashing_factor) - flash += (round(amount/4) * flashing_factor) - - for(var/mob/M in viewers(8, location)) - to_chat(M, "The solution violently explodes.") - - explosion(location, devastation, heavy, light, flash) - - proc/holder_damage(var/atom/holder) - if(holder) - var/dmglevel = 4 - - if(round(amount/8) > 0) - dmglevel = 1 - else if(round(amount/4) > 0) - dmglevel = 2 - else if(round(amount/2) > 0) - dmglevel = 3 - - if(dmglevel<4) holder.ex_act(dmglevel) - - -////////////////////////////////// -//////SPARKLE FIREWORKS -///////////////////////////////// -//////////////////////////// -/obj/effect/sparkles - name = "sparkle" - icon = 'icons/obj/fireworks.dmi'//findback - icon_state = "sparkel" - var/amount = 6.0 - anchored = 1.0 - mouse_opacity = 0 - -/obj/effect/sparkles/New() - ..() - var/icon/I = new(src.icon,src.icon_state) - var/r = rand(0,255) - var/g = rand(0,255) - var/b = rand(0,255) - I.Blend(rgb(r,g,b),ICON_MULTIPLY) - src.icon = I - playsound(src.loc, "sparks", 100, 1) - var/turf/T = src.loc - if(istype(T, /turf)) - T.hotspot_expose(3000,100) - spawn (100) - qdel(src) - return - -/obj/effect/sparkles/Destroy() - var/turf/T = src.loc - if(istype(T, /turf)) - T.hotspot_expose(3000,100) - return ..() - -/obj/effect/sparkles/Move() - ..() - var/turf/T = src.loc - if(istype(T, /turf)) - T.hotspot_expose(3000,100) - return - - -/datum/effect/system/sparkle_spread - var/total_sparks = 0 // To stop it being spammed and lagging! - -/datum/effect/system/sparkle_spread/set_up(n = 3, c = 0, loca) - if(n > 10) - n = 10 - number = n - cardinals = c - if(istype(loca, /turf/)) - location = loca - else - location = get_turf(loca) - -/datum/effect/system/sparkle_spread/start() - var/i = 0 - for(i=0, i 20) - return - spawn(0) - if(holder) - src.location = get_turf(holder) - var/obj/effect/sparkles/sparks = new(src.location) - src.total_sparks++ - var/direction - if(src.cardinals) - direction = pick(cardinal) - else - direction = pick(alldirs) - for(i=0, iNo thrusters are installed!") return - if(!ion_trail) - ion_trail = new - ion_trail.set_up(src) - ionpulse_on = !ionpulse_on to_chat(src, "You [ionpulse_on ? null :"de"]activate your ion thrusters.") - if(ionpulse_on) - ion_trail.start() - else - ion_trail.stop() if(thruster_button) thruster_button.icon_state = "ionpulse[ionpulse_on]" diff --git a/code/modules/mob/living/simple_animal/hostile/retaliate/drone.dm b/code/modules/mob/living/simple_animal/hostile/retaliate/drone.dm index b6189d56eac..7dfac96a807 100644 --- a/code/modules/mob/living/simple_animal/hostile/retaliate/drone.dm +++ b/code/modules/mob/living/simple_animal/hostile/retaliate/drone.dm @@ -29,16 +29,18 @@ faction = list("malf_drone") deathmessage = "suddenly breaks apart." del_on_death = 1 - var/datum/effect_system/trail_follow/ion/ion_trail var/passive_mode = TRUE // if true, don't target anything. /mob/living/simple_animal/hostile/malf_drone/Initialize(mapload) . = ..() - ion_trail = new - ion_trail.set_up(src) - ion_trail.start() + RegisterSignal(src, COMSIG_MOVABLE_MOVED, .proc/create_trail) update_icons() +/mob/living/simple_animal/hostile/malf_drone/proc/create_trail(datum/source, atom/oldloc, _dir, forced) + var/turf/T = get_turf(oldloc) + if(!has_gravity(T)) + new /obj/effect/particle_effect/ion_trails(T, _dir) + /mob/living/simple_animal/hostile/malf_drone/Process_Spacemove(check_drift = 0) return 1 diff --git a/code/modules/spacepods/spacepod.dm b/code/modules/spacepods/spacepod.dm index 301e7b05d86..43a9a4a6ee7 100644 --- a/code/modules/spacepods/spacepod.dm +++ b/code/modules/spacepods/spacepod.dm @@ -38,8 +38,6 @@ var/obj/machinery/portable_atmospherics/canister/internal_tank var/use_internal_tank = 0 - var/datum/effect_system/trail_follow/ion/space_trail/ion_trail - var/hatch_open = 0 var/next_firetime = 0 @@ -111,9 +109,6 @@ battery = new battery_type(src) add_cabin() add_airtank() - src.ion_trail = new /datum/effect_system/trail_follow/ion/space_trail() - src.ion_trail.set_up(src) - src.ion_trail.start() src.use_internal_tank = 1 equipment_system = new(src) equipment_system.installed_modules += battery @@ -124,6 +119,29 @@ cargo_hold.max_w_class = 5 //fit almost anything cargo_hold.max_combined_w_class = 0 //you can optimize your stash with larger items START_PROCESSING(SSobj, src) + RegisterSignal(src, COMSIG_MOVABLE_MOVED, .proc/create_trail) + +/obj/spacepod/proc/create_trail() + var/turf/T = get_turf(src) + var/atom/oldposition + var/atom/oldloc + switch(dir) + if(NORTH) + oldposition = get_step(T, SOUTH) + oldloc = get_step(oldposition, EAST) + if(SOUTH) // More difficult, offset to the north! + oldposition = get_step(get_step(src, NORTH), NORTH) + oldloc = get_step(oldposition, EAST) + if(EAST) // Just one to the north should suffice + oldposition = get_step(T, WEST) + oldloc = get_step(oldposition, NORTH) + if(WEST) // One to the east and north from there + oldposition = get_step(get_step(src, EAST), EAST) + oldloc = get_step(oldposition, NORTH) + + if(!has_gravity(T)) + new /obj/effect/particle_effect/ion_trails(oldposition, dir) + new /obj/effect/particle_effect/ion_trails(oldloc, dir) /obj/spacepod/Destroy() if(equipment_system.cargo_system) @@ -133,7 +151,6 @@ QDEL_NULL(battery) QDEL_NULL(cabin_air) QDEL_NULL(internal_tank) - QDEL_NULL(ion_trail) occupant_sanity_check() if(pilot) eject_pilot() @@ -280,7 +297,6 @@ H.forceMove(get_turf(src)) H.ex_act(severity + 1) to_chat(H, "You are forcefully thrown from [src]!") - qdel(ion_trail) qdel(src) if(2) deal_damage(100)