/tg/ 4/14 (#367)

* outside code stuff

* defines, helpers, etc

* everything not module

* modules

* compiled fixes + missing sounds
This commit is contained in:
Poojawa
2017-04-14 23:28:04 -05:00
committed by GitHub
parent 884fb45516
commit 9e72b1b8fd
170 changed files with 4916 additions and 1221 deletions
@@ -123,9 +123,7 @@
if(hasShocked)
return 0
hasShocked = 1
var/datum/effect_system/spark_spread/s = new /datum/effect_system/spark_spread
s.set_up(5, 1, AM.loc)
s.start()
do_sparks(5, TRUE, AM.loc)
var/atom/target = get_edge_target_turf(AM, get_dir(src, get_step_away(AM, src)))
AM.throw_at(target, 200, 4)
addtimer(CALLBACK(src, .proc/clear_shock), 5)
+210 -28
View File
@@ -1,5 +1,3 @@
/obj/machinery/power/emitter
name = "Emitter"
desc = "A heavy duty industrial laser.\n<span class='notice'>Alt-click to rotate it clockwise.</span>"
@@ -9,6 +7,11 @@
anchored = 0
density = 1
req_access = list(GLOB.access_engine_equip)
// The following 3 vars are mostly for the prototype
var/manual = FALSE
var/charge = 0
var/atom/target = null
use_power = 0
idle_power_usage = 10
@@ -28,6 +31,8 @@
var/projectile_sound = 'sound/weapons/emitter.ogg'
var/datum/effect_system/spark_spread/sparks
/obj/machinery/power/emitter/New()
..()
var/obj/item/weapon/circuitboard/machine/B = new /obj/item/weapon/circuitboard/machine/emitter(null)
@@ -87,11 +92,15 @@
if(state == 2 && anchored)
connect_to_network()
sparks = new
sparks.set_up(5, TRUE, src)
/obj/machinery/power/emitter/Destroy()
if(SSticker && SSticker.current_state == GAME_STATE_PLAYING)
message_admins("Emitter deleted at ([x],[y],[z] - <A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>)",0,1)
log_game("Emitter deleted at ([x],[y],[z])")
investigate_log("<font color='red'>deleted</font> at ([x],[y],[z]) at [get_area(src)]","singulo")
QDEL_NULL(sparks)
return ..()
/obj/machinery/power/emitter/update_icon()
@@ -168,9 +177,11 @@
investigate_log("lost power and turned <font color='red'>off</font> at [get_area(src)]","singulo")
log_game("Emitter lost power in ([x],[y],[z])")
return
if(!check_delay())
if(charge <=80)
charge+=5
if(!check_delay() || manual == TRUE)
return FALSE
fire_beam()
fire_beam(target)
/obj/machinery/power/emitter/proc/check_delay()
if((src.last_shot + src.fire_delay) <= world.time)
@@ -186,36 +197,62 @@
add_load(active_power_usage)
fire_beam()
/obj/machinery/power/emitter/proc/fire_beam()
src.last_shot = world.time
if(src.shot_number < 3)
src.fire_delay = 20
src.shot_number ++
else
src.fire_delay = rand(minimum_fire_delay,maximum_fire_delay)
src.shot_number = 0
var/obj/item/projectile/A = new projectile_type(src.loc)
A.setDir(src.dir)
playsound(src.loc, projectile_sound, 25, 1)
/obj/machinery/power/emitter/proc/fire_beam(atom/targeted_atom, mob/user)
var/turf/targets_from = get_turf(src)
if(targeted_atom == user|| targeted_atom == targets_from)
return
var/obj/item/projectile/P = new projectile_type(targets_from)
playsound(src.loc, projectile_sound, 50, 1)
if(prob(35))
var/datum/effect_system/spark_spread/s = new /datum/effect_system/spark_spread
s.set_up(5, 1, src)
s.start()
sparks.start()
switch(dir)
if(NORTH)
A.yo = 20
A.xo = 0
P.yo = 20
P.xo = 0
if(NORTHEAST)
P.yo = 20
P.xo = 20
if(EAST)
A.yo = 0
A.xo = 20
P.yo = 0
P.xo = 20
if(SOUTHEAST)
P.yo = -20
P.xo = 20
if(WEST)
A.yo = 0
A.xo = -20
P.yo = 0
P.xo = -20
if(SOUTHWEST)
P.yo = -20
P.xo = -20
if(NORTHWEST)
P.yo = 20
P.xo = -20
else // Any other
A.yo = -20
A.xo = 0
A.starting = loc
A.fire()
P.yo = -20
P.xo = 0
if(target)
P.yo = targeted_atom.y - targets_from.y
P.xo = targeted_atom.x - targets_from.x
P.current = targets_from
P.starting = targets_from
P.firer = src
P.original = targeted_atom
if(!manual)
last_shot = world.time
if(shot_number < 3)
fire_delay = 20
shot_number ++
else
fire_delay = rand(minimum_fire_delay,maximum_fire_delay)
shot_number = 0
if(!target)
P.setDir(src.dir)
P.starting = loc
else
if(QDELETED(target))
target = null
P.fire()
return P
/obj/machinery/power/emitter/can_be_unfasten_wrench(mob/user, silent)
if(state == EM_WELDED)
@@ -308,3 +345,148 @@
emagged = 1
if(user)
user.visible_message("[user.name] emags the [src.name].","<span class='notice'>You short out the lock.</span>")
/obj/machinery/power/emitter/prototype
name = "Prototype Emitter"
icon = 'icons/obj/turrets.dmi'
icon_state = "protoemitter"
icon_state_on = "protoemitter_+a"
can_buckle = TRUE
buckle_lying = 0
var/view_range = 12
var/datum/action/innate/protoemitter/firing/auto
//BUCKLE HOOKS
/obj/machinery/power/emitter/prototype/unbuckle_mob(mob/living/buckled_mob,force = 0)
playsound(src,'sound/mecha/mechmove01.ogg', 50, 1)
manual = FALSE
for(var/obj/item/I in buckled_mob.held_items)
if(istype(I, /obj/item/weapon/turret_control))
qdel(I)
if(istype(buckled_mob))
buckled_mob.pixel_x = 0
buckled_mob.pixel_y = 0
if(buckled_mob.client)
buckled_mob.client.change_view(world.view)
auto.Remove(buckled_mob)
. = ..()
/obj/machinery/power/emitter/prototype/user_buckle_mob(mob/living/M, mob/living/carbon/user)
if(user.incapacitated() || !istype(user))
return
for(var/atom/movable/A in get_turf(src))
if(A.density && (A != src && A != M))
return
M.forceMove(get_turf(src))
..()
playsound(src,'sound/mecha/mechmove01.ogg', 50, 1)
M.pixel_y = 14
layer = 4.1
if(M.client)
M.client.change_view(view_range)
if(!auto)
auto = new()
auto.Grant(M, src)
/datum/action/innate/protoemitter
check_flags = AB_CHECK_RESTRAINED | AB_CHECK_STUNNED | AB_CHECK_CONSCIOUS
var/obj/machinery/power/emitter/prototype/PE
var/mob/living/carbon/U
/datum/action/innate/protoemitter/Grant(mob/living/carbon/L, obj/machinery/power/emitter/prototype/proto)
PE = proto
U = L
. = ..()
/datum/action/innate/protoemitter/firing
name = "Switch to Manual Firing"
desc = "The emitter will only fire on your command and at your designated target"
button_icon_state = "mech_zoom_on"
/datum/action/innate/protoemitter/firing/Activate()
if(PE.manual)
playsound(PE,'sound/mecha/mechmove01.ogg', 50, 1)
PE.manual = FALSE
name = "Switch to Manual Firing"
desc = "The emitter will only fire on your command and at your designated target"
button_icon_state = "mech_zoom_on"
for(var/obj/item/I in U.held_items)
if(istype(I, /obj/item/weapon/turret_control))
qdel(I)
UpdateButtonIcon()
return
else
playsound(PE,'sound/mecha/mechmove01.ogg', 50, 1)
name = "Switch to Automatic Firing"
desc = "Emitters will switch to periodic firing at your last target"
button_icon_state = "mech_zoom_off"
PE.manual = TRUE
for(var/V in U.held_items)
var/obj/item/I = V
if(istype(I))
if(U.dropItemToGround(I))
var/obj/item/weapon/turret_control/TC = new /obj/item/weapon/turret_control()
U.put_in_hands(TC)
else //Entries in the list should only ever be items or null, so if it's not an item, we can assume it's an empty hand
var/obj/item/weapon/turret_control/TC = new /obj/item/weapon/turret_control()
U.put_in_hands(TC)
UpdateButtonIcon()
/obj/item/weapon/turret_control
name = "turret controls"
icon_state = "offhand"
w_class = WEIGHT_CLASS_HUGE
flags = ABSTRACT | NODROP
resistance_flags = FIRE_PROOF | UNACIDABLE | ACID_PROOF | NOBLUDGEON
var/delay = 0
/obj/item/weapon/turret_control/afterattack(atom/targeted_atom, mob/user)
..()
var/obj/machinery/power/emitter/E = user.buckled
E.setDir(get_dir(E,targeted_atom))
user.setDir(E.dir)
switch(E.dir)
if(NORTH)
E.layer = 3.9
user.pixel_x = 0
user.pixel_y = -14
if(NORTHEAST)
E.layer = 3.9
user.pixel_x = -8
user.pixel_y = -12
if(EAST)
E.layer = 4.1
user.pixel_x = -14
user.pixel_y = 0
if(SOUTHEAST)
E.layer = 3.9
user.pixel_x = -8
user.pixel_y = 12
if(SOUTH)
E.layer = 4.1
user.pixel_x = 0
user.pixel_y = 14
if(SOUTHWEST)
E.layer = 3.9
user.pixel_x = 8
user.pixel_y = 12
if(WEST)
E.layer = 4.1
user.pixel_x = 14
user.pixel_y = 0
if(NORTHWEST)
E.layer = 3.9
user.pixel_x = 8
user.pixel_y = -12
if(E.charge >= 10 && world.time > delay)
E.charge -= 10
E.target = targeted_atom
E.fire_beam(targeted_atom, user)
delay = world.time + 10
else if (E.charge < 10)
playsound(get_turf(user),'sound/machines/buzz-sigh.ogg', 50, 1)