|
|
|
@@ -1,3 +1,8 @@
|
|
|
|
|
//emitter construction defines
|
|
|
|
|
#define EMITTER_UNWRENCHED 0
|
|
|
|
|
#define EMITTER_WRENCHED 1
|
|
|
|
|
#define EMITTER_WELDED 2
|
|
|
|
|
|
|
|
|
|
/obj/machinery/power/emitter
|
|
|
|
|
name = "emitter"
|
|
|
|
|
desc = "A heavy-duty industrial laser, often used in containment fields and power generation."
|
|
|
|
@@ -14,14 +19,14 @@
|
|
|
|
|
active_power_usage = 300
|
|
|
|
|
|
|
|
|
|
var/icon_state_on = "emitter_+a"
|
|
|
|
|
var/active = 0
|
|
|
|
|
var/powered = 0
|
|
|
|
|
var/active = FALSE
|
|
|
|
|
var/powered = FALSE
|
|
|
|
|
var/fire_delay = 100
|
|
|
|
|
var/maximum_fire_delay = 100
|
|
|
|
|
var/minimum_fire_delay = 20
|
|
|
|
|
var/last_shot = 0
|
|
|
|
|
var/shot_number = 0
|
|
|
|
|
var/state = 0
|
|
|
|
|
var/state = EMITTER_UNWRENCHED
|
|
|
|
|
var/locked = FALSE
|
|
|
|
|
var/allow_switch_interact = TRUE
|
|
|
|
|
|
|
|
|
@@ -46,14 +51,14 @@
|
|
|
|
|
idle_power_usage = FALSE
|
|
|
|
|
locked = TRUE
|
|
|
|
|
req_access_txt = "100"
|
|
|
|
|
state = 2
|
|
|
|
|
state = EMITTER_WELDED
|
|
|
|
|
use_power = FALSE
|
|
|
|
|
|
|
|
|
|
/obj/machinery/power/emitter/Initialize()
|
|
|
|
|
. = ..()
|
|
|
|
|
RefreshParts()
|
|
|
|
|
wires = new /datum/wires/emitter(src)
|
|
|
|
|
if(state == 2 && anchored)
|
|
|
|
|
if(state == EMITTER_WELDED && anchored)
|
|
|
|
|
connect_to_network()
|
|
|
|
|
|
|
|
|
|
sparks = new
|
|
|
|
@@ -93,9 +98,9 @@
|
|
|
|
|
/obj/machinery/power/emitter/Destroy()
|
|
|
|
|
if(SSticker.IsRoundInProgress())
|
|
|
|
|
var/turf/T = get_turf(src)
|
|
|
|
|
message_admins("Emitter deleted at [ADMIN_COORDJMP(T)]",0,1)
|
|
|
|
|
log_game("Emitter deleted at [COORD(T)]")
|
|
|
|
|
investigate_log("<font color='red'>deleted</font> at [get_area(src)] [COORD(T)]", INVESTIGATE_SINGULO)
|
|
|
|
|
message_admins("Emitter deleted at [ADMIN_VERBOSEJMP(T)]")
|
|
|
|
|
log_game("Emitter deleted at [AREACOORD(T)]")
|
|
|
|
|
investigate_log("<font color='red'>deleted</font> at [AREACOORD(T)]", INVESTIGATE_SINGULO)
|
|
|
|
|
QDEL_NULL(sparks)
|
|
|
|
|
return ..()
|
|
|
|
|
|
|
|
|
@@ -108,33 +113,35 @@
|
|
|
|
|
|
|
|
|
|
/obj/machinery/power/emitter/interact(mob/user)
|
|
|
|
|
add_fingerprint(user)
|
|
|
|
|
if(state == 2)
|
|
|
|
|
if(state == EMITTER_WELDED)
|
|
|
|
|
if(!powernet)
|
|
|
|
|
to_chat(user, "<span class='warning'>The emitter isn't connected to a wire!</span>")
|
|
|
|
|
return 1
|
|
|
|
|
to_chat(user, "<span class='warning'>\The [src] isn't connected to a wire!</span>")
|
|
|
|
|
return TRUE
|
|
|
|
|
if(!locked && allow_switch_interact)
|
|
|
|
|
if(src.active==1)
|
|
|
|
|
src.active = 0
|
|
|
|
|
to_chat(user, "<span class='notice'>You turn off \the [src].</span>")
|
|
|
|
|
message_admins("Emitter turned off by [ADMIN_LOOKUPFLW(user)] in [ADMIN_COORDJMP(src)]",0,1)
|
|
|
|
|
log_game("Emitter turned off by [key_name(user)] in [COORD(src)]")
|
|
|
|
|
investigate_log("turned <font color='red'>off</font> by [key_name(user)] at [get_area(src)]", INVESTIGATE_SINGULO)
|
|
|
|
|
if(active == TRUE)
|
|
|
|
|
active = FALSE
|
|
|
|
|
to_chat(user, "<span class='notice'>You turn off [src].</span>")
|
|
|
|
|
else
|
|
|
|
|
src.active = 1
|
|
|
|
|
to_chat(user, "<span class='notice'>You turn on \the [src].</span>")
|
|
|
|
|
src.shot_number = 0
|
|
|
|
|
src.fire_delay = maximum_fire_delay
|
|
|
|
|
investigate_log("turned <font color='green'>on</font> by [key_name(user)] at [get_area(src)]", INVESTIGATE_SINGULO)
|
|
|
|
|
active = TRUE
|
|
|
|
|
to_chat(user, "<span class='notice'>You turn on [src].</span>")
|
|
|
|
|
shot_number = 0
|
|
|
|
|
fire_delay = maximum_fire_delay
|
|
|
|
|
|
|
|
|
|
message_admins("Emitter turned [active ? "ON" : "OFF"] by [ADMIN_LOOKUPFLW(user)] in [ADMIN_VERBOSEJMP(src)]")
|
|
|
|
|
log_game("Emitter turned [active ? "ON" : "OFF"] by [key_name(user)] in [AREACOORD(src)]")
|
|
|
|
|
investigate_log("turned [active ? "<font color='green'>ON</font>" : "<font color='red'>OFF</font>"] by [key_name(user)] at [AREACOORD(src)]", INVESTIGATE_SINGULO)
|
|
|
|
|
|
|
|
|
|
update_icon()
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
to_chat(user, "<span class='warning'>The controls are locked!</span>")
|
|
|
|
|
else
|
|
|
|
|
to_chat(user, "<span class='warning'>[src] needs to be firmly secured to the floor first!</span>")
|
|
|
|
|
return 1
|
|
|
|
|
return TRUE
|
|
|
|
|
|
|
|
|
|
/obj/machinery/power/emitter/attack_animal(mob/living/simple_animal/M)
|
|
|
|
|
if(ismegafauna(M) && anchored)
|
|
|
|
|
state = 0
|
|
|
|
|
state = EMITTER_UNWRENCHED
|
|
|
|
|
anchored = FALSE
|
|
|
|
|
M.visible_message("<span class='warning'>[M] rips [src] free from its moorings!</span>")
|
|
|
|
|
else
|
|
|
|
@@ -145,26 +152,26 @@
|
|
|
|
|
/obj/machinery/power/emitter/process()
|
|
|
|
|
if(stat & (BROKEN))
|
|
|
|
|
return
|
|
|
|
|
if(src.state != 2 || (!powernet && active_power_usage))
|
|
|
|
|
src.active = 0
|
|
|
|
|
if(state != EMITTER_WELDED || (!powernet && active_power_usage))
|
|
|
|
|
active = FALSE
|
|
|
|
|
update_icon()
|
|
|
|
|
return
|
|
|
|
|
if(src.active == 1)
|
|
|
|
|
if(active == TRUE)
|
|
|
|
|
if(!active_power_usage || avail(active_power_usage))
|
|
|
|
|
add_load(active_power_usage)
|
|
|
|
|
if(!powered)
|
|
|
|
|
powered = 1
|
|
|
|
|
powered = TRUE
|
|
|
|
|
update_icon()
|
|
|
|
|
investigate_log("regained power and turned <font color='green'>on</font> at [get_area(src)]", INVESTIGATE_SINGULO)
|
|
|
|
|
investigate_log("regained power and turned <font color='green'>ON</font> at [AREACOORD(src)]", INVESTIGATE_SINGULO)
|
|
|
|
|
else
|
|
|
|
|
if(powered)
|
|
|
|
|
powered = 0
|
|
|
|
|
powered = FALSE
|
|
|
|
|
update_icon()
|
|
|
|
|
investigate_log("lost power and turned <font color='red'>off</font> at [get_area(src)]", INVESTIGATE_SINGULO)
|
|
|
|
|
log_game("Emitter lost power in ([x],[y],[z])")
|
|
|
|
|
investigate_log("lost power and turned <font color='red'>OFF</font> at [AREACOORD(src)]", INVESTIGATE_SINGULO)
|
|
|
|
|
log_game("Emitter lost power in [AREACOORD(src)]")
|
|
|
|
|
return
|
|
|
|
|
if(charge <=80)
|
|
|
|
|
charge+=5
|
|
|
|
|
if(charge <= 80)
|
|
|
|
|
charge += 5
|
|
|
|
|
if(!check_delay() || manual == TRUE)
|
|
|
|
|
return FALSE
|
|
|
|
|
fire_beam()
|
|
|
|
@@ -177,7 +184,7 @@
|
|
|
|
|
/obj/machinery/power/emitter/proc/fire_beam_pulse()
|
|
|
|
|
if(!check_delay())
|
|
|
|
|
return FALSE
|
|
|
|
|
if(state != 2)
|
|
|
|
|
if(state != EMITTER_WELDED)
|
|
|
|
|
return FALSE
|
|
|
|
|
if(avail(active_power_usage))
|
|
|
|
|
add_load(active_power_usage)
|
|
|
|
@@ -185,7 +192,7 @@
|
|
|
|
|
|
|
|
|
|
/obj/machinery/power/emitter/proc/fire_beam(mob/user)
|
|
|
|
|
var/obj/item/projectile/P = new projectile_type(get_turf(src))
|
|
|
|
|
playsound(get_turf(src), projectile_sound, 50, 1)
|
|
|
|
|
playsound(get_turf(src), projectile_sound, 50, TRUE)
|
|
|
|
|
if(prob(35))
|
|
|
|
|
sparks.start()
|
|
|
|
|
P.firer = user? user : src
|
|
|
|
@@ -212,7 +219,7 @@
|
|
|
|
|
to_chat(user, "<span class='warning'>Turn \the [src] off first!</span>")
|
|
|
|
|
return FAILED_UNFASTEN
|
|
|
|
|
|
|
|
|
|
else if(state == EM_WELDED)
|
|
|
|
|
else if(state == EMITTER_WELDED)
|
|
|
|
|
if(!silent)
|
|
|
|
|
to_chat(user, "<span class='warning'>[src] is welded to the floor!</span>")
|
|
|
|
|
return FAILED_UNFASTEN
|
|
|
|
@@ -223,9 +230,9 @@
|
|
|
|
|
. = ..()
|
|
|
|
|
if(. == SUCCESSFUL_UNFASTEN)
|
|
|
|
|
if(anchored)
|
|
|
|
|
state = EM_SECURED
|
|
|
|
|
state = EMITTER_WRENCHED
|
|
|
|
|
else
|
|
|
|
|
state = EM_UNSECURED
|
|
|
|
|
state = EMITTER_UNWRENCHED
|
|
|
|
|
|
|
|
|
|
/obj/machinery/power/emitter/wrench_act(mob/living/user, obj/item/I)
|
|
|
|
|
default_unfasten_wrench(user, I)
|
|
|
|
@@ -237,26 +244,26 @@
|
|
|
|
|
return TRUE
|
|
|
|
|
|
|
|
|
|
switch(state)
|
|
|
|
|
if(EM_UNSECURED)
|
|
|
|
|
if(EMITTER_UNWRENCHED)
|
|
|
|
|
to_chat(user, "<span class='warning'>The [src.name] needs to be wrenched to the floor!</span>")
|
|
|
|
|
if(EM_SECURED)
|
|
|
|
|
if(EMITTER_WRENCHED)
|
|
|
|
|
if(!I.tool_start_check(user, amount=0))
|
|
|
|
|
return TRUE
|
|
|
|
|
user.visible_message("[user.name] starts to weld the [name] to the floor.", \
|
|
|
|
|
"<span class='notice'>You start to weld \the [src] to the floor...</span>", \
|
|
|
|
|
"<span class='italics'>You hear welding.</span>")
|
|
|
|
|
if(I.use_tool(src, user, 20, volume=50))
|
|
|
|
|
state = EM_WELDED
|
|
|
|
|
state = EMITTER_WELDED
|
|
|
|
|
to_chat(user, "<span class='notice'>You weld \the [src] to the floor.</span>")
|
|
|
|
|
connect_to_network()
|
|
|
|
|
if(EM_WELDED)
|
|
|
|
|
if(EMITTER_WELDED)
|
|
|
|
|
if(!I.tool_start_check(user, amount=0))
|
|
|
|
|
return TRUE
|
|
|
|
|
user.visible_message("[user.name] starts to cut the [name] free from the floor.", \
|
|
|
|
|
"<span class='notice'>You start to cut \the [src] free from the floor...</span>", \
|
|
|
|
|
"<span class='italics'>You hear welding.</span>")
|
|
|
|
|
if(I.use_tool(src, user, 20, volume=50))
|
|
|
|
|
state = EM_SECURED
|
|
|
|
|
state = EMITTER_WRENCHED
|
|
|
|
|
to_chat(user, "<span class='notice'>You cut \the [src] free from the floor.</span>")
|
|
|
|
|
disconnect_from_network()
|
|
|
|
|
|
|
|
|
@@ -307,14 +314,14 @@
|
|
|
|
|
icon_state = "protoemitter"
|
|
|
|
|
icon_state_on = "protoemitter_+a"
|
|
|
|
|
can_buckle = TRUE
|
|
|
|
|
buckle_lying = 0
|
|
|
|
|
buckle_lying = FALSE
|
|
|
|
|
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)
|
|
|
|
|
playsound(src,'sound/mecha/mechmove01.ogg', 50, TRUE)
|
|
|
|
|
manual = FALSE
|
|
|
|
|
for(var/obj/item/I in buckled_mob.held_items)
|
|
|
|
|
if(istype(I, /obj/item/turret_control))
|
|
|
|
@@ -335,7 +342,7 @@
|
|
|
|
|
return
|
|
|
|
|
M.forceMove(get_turf(src))
|
|
|
|
|
..()
|
|
|
|
|
playsound(src,'sound/mecha/mechmove01.ogg', 50, 1)
|
|
|
|
|
playsound(src,'sound/mecha/mechmove01.ogg', 50, TRUE)
|
|
|
|
|
M.pixel_y = 14
|
|
|
|
|
layer = 4.1
|
|
|
|
|
if(M.client)
|
|
|
|
@@ -362,7 +369,7 @@
|
|
|
|
|
|
|
|
|
|
/datum/action/innate/protoemitter/firing/Activate()
|
|
|
|
|
if(PE.manual)
|
|
|
|
|
playsound(PE,'sound/mecha/mechmove01.ogg', 50, 1)
|
|
|
|
|
playsound(PE,'sound/mecha/mechmove01.ogg', 50, TRUE)
|
|
|
|
|
PE.manual = FALSE
|
|
|
|
|
name = "Switch to Manual Firing"
|
|
|
|
|
desc = "The emitter will only fire on your command and at your designated target"
|
|
|
|
@@ -373,7 +380,7 @@
|
|
|
|
|
UpdateButtonIcon()
|
|
|
|
|
return
|
|
|
|
|
else
|
|
|
|
|
playsound(PE,'sound/mecha/mechmove01.ogg', 50, 1)
|
|
|
|
|
playsound(PE,'sound/mecha/mechmove01.ogg', 50, TRUE)
|
|
|
|
|
name = "Switch to Automatic Firing"
|
|
|
|
|
desc = "Emitters will switch to periodic firing at your last target"
|
|
|
|
|
button_icon_state = "mech_zoom_off"
|
|
|
|
@@ -444,4 +451,9 @@
|
|
|
|
|
E.fire_beam(user)
|
|
|
|
|
delay = world.time + 10
|
|
|
|
|
else if (E.charge < 10)
|
|
|
|
|
playsound(get_turf(user),'sound/machines/buzz-sigh.ogg', 50, 1)
|
|
|
|
|
playsound(src,'sound/machines/buzz-sigh.ogg', 50, TRUE)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#undef EMITTER_UNWRENCHED
|
|
|
|
|
#undef EMITTER_WRENCHED
|
|
|
|
|
#undef EMITTER_WELDED
|
|
|
|
|