Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 20 additions & 17 deletions code/game/objects/items/devices/forcefieldprojector.dm
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
var/max_fields = 3
var/list/current_fields
var/field_distance_limit = 7
var/creation_time = 30

/obj/item/forcefield_projector/afterattack(atom/target, mob/user, proximity_flag)
. = ..()
Expand All @@ -26,24 +27,26 @@
to_chat(user, "<span class='notice'>You deactivate [F].</span>")
qdel(F)
return
var/turf/T = get_turf(target)
var/obj/structure/projected_forcefield/found_field = locate() in T
if(found_field)
to_chat(user, "<span class='warning'>There is already a forcefield in that location!</span>")
return
if(T.density)
return
if(get_dist(T,src) > field_distance_limit)
return
if(LAZYLEN(current_fields) >= max_fields)
to_chat(user, "<span class='notice'>[src] cannot sustain any more forcefields!</span>")
return
if(do_after(user, creation_time, target = target))
var/turf/T = get_turf(target)
var/obj/structure/projected_forcefield/found_field = locate() in T
if(found_field)
to_chat(user, "<span class='warning'>There is already a forcefield in that location!</span>")
return
if(T.density)
return
if(get_dist(T,src) > field_distance_limit)
return
if(LAZYLEN(current_fields) >= max_fields)
to_chat(user, "<span class='notice'>[src] cannot sustain any more forcefields!</span>")
return


playsound(src,'sound/weapons/resonator_fire.ogg',50,1)
user.visible_message("<span class='warning'>[user] projects a forcefield!</span>","<span class='notice'>You project a forcefield.</span>")
var/obj/structure/projected_forcefield/F = new(T, src)
current_fields += F
user.changeNext_move(CLICK_CD_MELEE)
playsound(src,'sound/weapons/resonator_fire.ogg',50,1)
user.visible_message("<span class='warning'>[user] projects a forcefield!</span>","<span class='notice'>You project a forcefield.</span>")
var/obj/structure/projected_forcefield/F = new(T, src)
current_fields += F
user.changeNext_move(CLICK_CD_MELEE)

/obj/item/forcefield_projector/attack_self(mob/user)
if(LAZYLEN(current_fields))
Expand Down