Merge pull request #3023 from Citadel-Station-13/upstream-merge-31069
[MIRROR] Cleanup to various loc assignments and nearby code
This commit is contained in:
@@ -205,7 +205,7 @@ GLOBAL_LIST_INIT(devil_suffix, list(" the Red", " the Soulless", " the Master",
|
||||
/datum/antagonist/devil/proc/regress_blood_lizard()
|
||||
var/mob/living/carbon/true_devil/D = owner.current
|
||||
to_chat(D, "<span class='warning'>Your powers weaken, have more contracts be signed to regain power.</span>")
|
||||
D.oldform.loc = D.loc
|
||||
D.oldform.forceMove(D.drop_location())
|
||||
owner.transfer_to(D.oldform)
|
||||
give_appropriate_spells()
|
||||
qdel(D)
|
||||
@@ -236,7 +236,7 @@ GLOBAL_LIST_INIT(devil_suffix, list(" the Red", " the Soulless", " the Master",
|
||||
sleep(50)
|
||||
var/mob/living/carbon/true_devil/A = new /mob/living/carbon/true_devil(owner.current.loc)
|
||||
A.faction |= "hell"
|
||||
owner.current.loc = A
|
||||
owner.current.forceMove(A)
|
||||
A.oldform = owner.current
|
||||
owner.transfer_to(A)
|
||||
A.set_name()
|
||||
|
||||
@@ -22,6 +22,6 @@
|
||||
|
||||
/datum/disease/parrot_possession/cure()
|
||||
if(parrot && parrot.loc == affected_mob)
|
||||
parrot.loc = affected_mob.loc
|
||||
parrot.forceMove(affected_mob.drop_location())
|
||||
affected_mob.visible_message("<span class='danger'>[parrot] is violently driven out of [affected_mob]!</span>", "<span class='userdanger'>[parrot] bursts out of your chest!</span>")
|
||||
..()
|
||||
+115
-115
@@ -1,115 +1,115 @@
|
||||
/datum/disease/wizarditis
|
||||
name = "Wizarditis"
|
||||
max_stages = 4
|
||||
spread_text = "Airborne"
|
||||
cure_text = "The Manly Dorf"
|
||||
cures = list("manlydorf")
|
||||
cure_chance = 100
|
||||
agent = "Rincewindus Vulgaris"
|
||||
viable_mobtypes = list(/mob/living/carbon/human)
|
||||
disease_flags = CAN_CARRY|CAN_RESIST|CURABLE
|
||||
permeability_mod = 0.75
|
||||
desc = "Some speculate that this virus is the cause of the Space Wizard Federation's existence. Subjects affected show the signs of mental retardation, yelling obscure sentences or total gibberish. On late stages subjects sometime express the feelings of inner power, and, cite, 'the ability to control the forces of cosmos themselves!' A gulp of strong, manly spirits usually reverts them to normal, humanlike, condition."
|
||||
severity = HARMFUL
|
||||
required_organs = list(/obj/item/bodypart/head)
|
||||
|
||||
/*
|
||||
BIRUZ BENNAR
|
||||
SCYAR NILA - teleport
|
||||
NEC CANTIO - dis techno
|
||||
EI NATH - shocking grasp
|
||||
AULIE OXIN FIERA - knock
|
||||
TARCOL MINTI ZHERI - forcewall
|
||||
STI KALY - blind
|
||||
*/
|
||||
|
||||
/datum/disease/wizarditis/stage_act()
|
||||
..()
|
||||
|
||||
switch(stage)
|
||||
if(2)
|
||||
if(prob(1)&&prob(50))
|
||||
affected_mob.say(pick("You shall not pass!", "Expeliarmus!", "By Merlins beard!", "Feel the power of the Dark Side!"))
|
||||
if(prob(1)&&prob(50))
|
||||
to_chat(affected_mob, "<span class='danger'>You feel [pick("that you don't have enough mana", "that the winds of magic are gone", "an urge to summon familiar")].</span>")
|
||||
|
||||
|
||||
if(3)
|
||||
if(prob(1)&&prob(50))
|
||||
affected_mob.say(pick("NEC CANTIO!","AULIE OXIN FIERA!", "STI KALY!", "TARCOL MINTI ZHERI!"))
|
||||
if(prob(1)&&prob(50))
|
||||
to_chat(affected_mob, "<span class='danger'>You feel [pick("the magic bubbling in your veins","that this location gives you a +1 to INT","an urge to summon familiar")].</span>")
|
||||
|
||||
if(4)
|
||||
|
||||
if(prob(1))
|
||||
affected_mob.say(pick("NEC CANTIO!","AULIE OXIN FIERA!","STI KALY!","EI NATH!"))
|
||||
return
|
||||
if(prob(1)&&prob(50))
|
||||
to_chat(affected_mob, "<span class='danger'>You feel [pick("the tidal wave of raw power building inside","that this location gives you a +2 to INT and +1 to WIS","an urge to teleport")].</span>")
|
||||
spawn_wizard_clothes(50)
|
||||
if(prob(1)&&prob(1))
|
||||
teleport()
|
||||
return
|
||||
|
||||
|
||||
|
||||
/datum/disease/wizarditis/proc/spawn_wizard_clothes(chance = 0)
|
||||
if(ishuman(affected_mob))
|
||||
var/mob/living/carbon/human/H = affected_mob
|
||||
if(prob(chance))
|
||||
if(!istype(H.head, /obj/item/clothing/head/wizard))
|
||||
if(!H.dropItemToGround(H.head))
|
||||
qdel(H.head)
|
||||
H.equip_to_slot_or_del(new /obj/item/clothing/head/wizard(H), slot_head)
|
||||
return
|
||||
if(prob(chance))
|
||||
if(!istype(H.wear_suit, /obj/item/clothing/suit/wizrobe))
|
||||
if(!H.dropItemToGround(H.wear_suit))
|
||||
qdel(H.wear_suit)
|
||||
H.equip_to_slot_or_del(new /obj/item/clothing/suit/wizrobe(H), slot_wear_suit)
|
||||
return
|
||||
if(prob(chance))
|
||||
if(!istype(H.shoes, /obj/item/clothing/shoes/sandal/magic))
|
||||
if(!H.dropItemToGround(H.shoes))
|
||||
qdel(H.shoes)
|
||||
H.equip_to_slot_or_del(new /obj/item/clothing/shoes/sandal/magic(H), slot_shoes)
|
||||
return
|
||||
else
|
||||
var/mob/living/carbon/H = affected_mob
|
||||
if(prob(chance))
|
||||
var/obj/item/staff/S = new(H)
|
||||
if(!H.put_in_hands(S))
|
||||
qdel(S)
|
||||
|
||||
|
||||
/datum/disease/wizarditis/proc/teleport()
|
||||
var/list/theareas = get_areas_in_range(80, affected_mob)
|
||||
for(var/area/space/S in theareas)
|
||||
theareas -= S
|
||||
|
||||
if(!theareas||!theareas.len)
|
||||
return
|
||||
|
||||
var/area/thearea = pick(theareas)
|
||||
|
||||
var/list/L = list()
|
||||
for(var/turf/T in get_area_turfs(thearea.type))
|
||||
if(T.z != affected_mob.z) continue
|
||||
if(T.name == "space") continue
|
||||
if(!T.density)
|
||||
var/clear = 1
|
||||
for(var/obj/O in T)
|
||||
if(O.density)
|
||||
clear = 0
|
||||
break
|
||||
if(clear)
|
||||
L+=T
|
||||
|
||||
if(!L)
|
||||
return
|
||||
|
||||
affected_mob.say("SCYAR NILA [uppertext(thearea.name)]!")
|
||||
affected_mob.loc = pick(L)
|
||||
|
||||
return
|
||||
/datum/disease/wizarditis
|
||||
name = "Wizarditis"
|
||||
max_stages = 4
|
||||
spread_text = "Airborne"
|
||||
cure_text = "The Manly Dorf"
|
||||
cures = list("manlydorf")
|
||||
cure_chance = 100
|
||||
agent = "Rincewindus Vulgaris"
|
||||
viable_mobtypes = list(/mob/living/carbon/human)
|
||||
disease_flags = CAN_CARRY|CAN_RESIST|CURABLE
|
||||
permeability_mod = 0.75
|
||||
desc = "Some speculate that this virus is the cause of the Space Wizard Federation's existence. Subjects affected show the signs of mental retardation, yelling obscure sentences or total gibberish. On late stages subjects sometime express the feelings of inner power, and, cite, 'the ability to control the forces of cosmos themselves!' A gulp of strong, manly spirits usually reverts them to normal, humanlike, condition."
|
||||
severity = HARMFUL
|
||||
required_organs = list(/obj/item/bodypart/head)
|
||||
|
||||
/*
|
||||
BIRUZ BENNAR
|
||||
SCYAR NILA - teleport
|
||||
NEC CANTIO - dis techno
|
||||
EI NATH - shocking grasp
|
||||
AULIE OXIN FIERA - knock
|
||||
TARCOL MINTI ZHERI - forcewall
|
||||
STI KALY - blind
|
||||
*/
|
||||
|
||||
/datum/disease/wizarditis/stage_act()
|
||||
..()
|
||||
|
||||
switch(stage)
|
||||
if(2)
|
||||
if(prob(1)&&prob(50))
|
||||
affected_mob.say(pick("You shall not pass!", "Expeliarmus!", "By Merlins beard!", "Feel the power of the Dark Side!"))
|
||||
if(prob(1)&&prob(50))
|
||||
to_chat(affected_mob, "<span class='danger'>You feel [pick("that you don't have enough mana", "that the winds of magic are gone", "an urge to summon familiar")].</span>")
|
||||
|
||||
|
||||
if(3)
|
||||
if(prob(1)&&prob(50))
|
||||
affected_mob.say(pick("NEC CANTIO!","AULIE OXIN FIERA!", "STI KALY!", "TARCOL MINTI ZHERI!"))
|
||||
if(prob(1)&&prob(50))
|
||||
to_chat(affected_mob, "<span class='danger'>You feel [pick("the magic bubbling in your veins","that this location gives you a +1 to INT","an urge to summon familiar")].</span>")
|
||||
|
||||
if(4)
|
||||
|
||||
if(prob(1))
|
||||
affected_mob.say(pick("NEC CANTIO!","AULIE OXIN FIERA!","STI KALY!","EI NATH!"))
|
||||
return
|
||||
if(prob(1)&&prob(50))
|
||||
to_chat(affected_mob, "<span class='danger'>You feel [pick("the tidal wave of raw power building inside","that this location gives you a +2 to INT and +1 to WIS","an urge to teleport")].</span>")
|
||||
spawn_wizard_clothes(50)
|
||||
if(prob(1)&&prob(1))
|
||||
teleport()
|
||||
return
|
||||
|
||||
|
||||
|
||||
/datum/disease/wizarditis/proc/spawn_wizard_clothes(chance = 0)
|
||||
if(ishuman(affected_mob))
|
||||
var/mob/living/carbon/human/H = affected_mob
|
||||
if(prob(chance))
|
||||
if(!istype(H.head, /obj/item/clothing/head/wizard))
|
||||
if(!H.dropItemToGround(H.head))
|
||||
qdel(H.head)
|
||||
H.equip_to_slot_or_del(new /obj/item/clothing/head/wizard(H), slot_head)
|
||||
return
|
||||
if(prob(chance))
|
||||
if(!istype(H.wear_suit, /obj/item/clothing/suit/wizrobe))
|
||||
if(!H.dropItemToGround(H.wear_suit))
|
||||
qdel(H.wear_suit)
|
||||
H.equip_to_slot_or_del(new /obj/item/clothing/suit/wizrobe(H), slot_wear_suit)
|
||||
return
|
||||
if(prob(chance))
|
||||
if(!istype(H.shoes, /obj/item/clothing/shoes/sandal/magic))
|
||||
if(!H.dropItemToGround(H.shoes))
|
||||
qdel(H.shoes)
|
||||
H.equip_to_slot_or_del(new /obj/item/clothing/shoes/sandal/magic(H), slot_shoes)
|
||||
return
|
||||
else
|
||||
var/mob/living/carbon/H = affected_mob
|
||||
if(prob(chance))
|
||||
var/obj/item/staff/S = new(H)
|
||||
if(!H.put_in_hands(S))
|
||||
qdel(S)
|
||||
|
||||
|
||||
/datum/disease/wizarditis/proc/teleport()
|
||||
var/list/theareas = get_areas_in_range(80, affected_mob)
|
||||
for(var/area/space/S in theareas)
|
||||
theareas -= S
|
||||
|
||||
if(!theareas||!theareas.len)
|
||||
return
|
||||
|
||||
var/area/thearea = pick(theareas)
|
||||
|
||||
var/list/L = list()
|
||||
for(var/turf/T in get_area_turfs(thearea.type))
|
||||
if(T.z != affected_mob.z) continue
|
||||
if(T.name == "space") continue
|
||||
if(!T.density)
|
||||
var/clear = 1
|
||||
for(var/obj/O in T)
|
||||
if(O.density)
|
||||
clear = 0
|
||||
break
|
||||
if(clear)
|
||||
L+=T
|
||||
|
||||
if(!L)
|
||||
return
|
||||
|
||||
affected_mob.say("SCYAR NILA [uppertext(thearea.name)]!")
|
||||
affected_mob.forceMove(pick(L))
|
||||
|
||||
return
|
||||
|
||||
+253
-253
@@ -1,260 +1,260 @@
|
||||
#define MAXIMUM_EMP_WIRES 3
|
||||
|
||||
/proc/is_wire_tool(obj/item/I)
|
||||
if(istype(I, /obj/item/device/multitool))
|
||||
return TRUE
|
||||
if(istype(I, /obj/item/wirecutters))
|
||||
return TRUE
|
||||
if(istype(I, /obj/item/device/assembly))
|
||||
var/obj/item/device/assembly/A = I
|
||||
if(A.attachable)
|
||||
return TRUE
|
||||
return
|
||||
|
||||
/atom
|
||||
var/datum/wires/wires = null
|
||||
|
||||
/datum/wires
|
||||
var/atom/holder = null // The holder (atom that contains these wires).
|
||||
var/holder_type = null // The holder's typepath (used to make wire colors common to all holders).
|
||||
var/proper_name = "Unknown" // The display name for the wire set shown in station blueprints. Not used if randomize is true or it's an item NT wouldn't know about (Explosives/Nuke)
|
||||
|
||||
var/list/wires = list() // List of wires.
|
||||
var/list/cut_wires = list() // List of wires that have been cut.
|
||||
var/list/colors = list() // Dictionary of colors to wire.
|
||||
var/list/assemblies = list() // List of attached assemblies.
|
||||
var/randomize = 0 // If every instance of these wires should be random.
|
||||
// Prevents wires from showing up in station blueprints
|
||||
|
||||
/datum/wires/New(atom/holder)
|
||||
..()
|
||||
if(!istype(holder, holder_type))
|
||||
CRASH("Wire holder is not of the expected type!")
|
||||
return
|
||||
|
||||
src.holder = holder
|
||||
if(randomize)
|
||||
randomize()
|
||||
else
|
||||
if(!GLOB.wire_color_directory[holder_type])
|
||||
randomize()
|
||||
GLOB.wire_color_directory[holder_type] = colors
|
||||
GLOB.wire_name_directory[holder_type] = proper_name
|
||||
else
|
||||
colors = GLOB.wire_color_directory[holder_type]
|
||||
|
||||
/datum/wires/Destroy()
|
||||
holder = null
|
||||
assemblies = list()
|
||||
return ..()
|
||||
|
||||
/datum/wires/proc/add_duds(duds)
|
||||
while(duds)
|
||||
var/dud = WIRE_DUD_PREFIX + "[--duds]"
|
||||
if(dud in wires)
|
||||
continue
|
||||
wires += dud
|
||||
|
||||
/datum/wires/proc/randomize()
|
||||
var/static/list/possible_colors = list(
|
||||
"blue",
|
||||
"brown",
|
||||
"crimson",
|
||||
"cyan",
|
||||
"gold",
|
||||
"grey",
|
||||
"green",
|
||||
"magenta",
|
||||
"orange",
|
||||
"pink",
|
||||
"purple",
|
||||
"red",
|
||||
"silver",
|
||||
"violet",
|
||||
"white",
|
||||
"yellow"
|
||||
)
|
||||
|
||||
var/list/my_possible_colors = possible_colors.Copy()
|
||||
|
||||
for(var/wire in shuffle(wires))
|
||||
colors[pick_n_take(my_possible_colors)] = wire
|
||||
|
||||
/datum/wires/proc/shuffle_wires()
|
||||
colors.Cut()
|
||||
randomize()
|
||||
|
||||
/datum/wires/proc/repair()
|
||||
cut_wires.Cut()
|
||||
|
||||
/datum/wires/proc/get_wire(color)
|
||||
return colors[color]
|
||||
|
||||
/datum/wires/proc/get_attached(color)
|
||||
if(assemblies[color])
|
||||
return assemblies[color]
|
||||
return null
|
||||
|
||||
/datum/wires/proc/is_attached(color)
|
||||
if(assemblies[color])
|
||||
return TRUE
|
||||
|
||||
/datum/wires/proc/is_cut(wire)
|
||||
return (wire in cut_wires)
|
||||
|
||||
/datum/wires/proc/is_color_cut(color)
|
||||
return is_cut(get_wire(color))
|
||||
|
||||
/datum/wires/proc/is_all_cut()
|
||||
if(cut_wires.len == wires.len)
|
||||
return TRUE
|
||||
|
||||
/datum/wires/proc/cut(wire)
|
||||
if(is_cut(wire))
|
||||
cut_wires -= wire
|
||||
on_cut(wire, mend = TRUE)
|
||||
else
|
||||
cut_wires += wire
|
||||
on_cut(wire, mend = FALSE)
|
||||
|
||||
/datum/wires/proc/cut_color(color)
|
||||
cut(get_wire(color))
|
||||
|
||||
/datum/wires/proc/cut_random()
|
||||
cut(wires[rand(1, wires.len)])
|
||||
|
||||
/datum/wires/proc/cut_all()
|
||||
for(var/wire in wires)
|
||||
cut(wire)
|
||||
|
||||
#define MAXIMUM_EMP_WIRES 3
|
||||
|
||||
/proc/is_wire_tool(obj/item/I)
|
||||
if(istype(I, /obj/item/device/multitool))
|
||||
return TRUE
|
||||
if(istype(I, /obj/item/wirecutters))
|
||||
return TRUE
|
||||
if(istype(I, /obj/item/device/assembly))
|
||||
var/obj/item/device/assembly/A = I
|
||||
if(A.attachable)
|
||||
return TRUE
|
||||
return
|
||||
|
||||
/atom
|
||||
var/datum/wires/wires = null
|
||||
|
||||
/datum/wires
|
||||
var/atom/holder = null // The holder (atom that contains these wires).
|
||||
var/holder_type = null // The holder's typepath (used to make wire colors common to all holders).
|
||||
var/proper_name = "Unknown" // The display name for the wire set shown in station blueprints. Not used if randomize is true or it's an item NT wouldn't know about (Explosives/Nuke)
|
||||
|
||||
var/list/wires = list() // List of wires.
|
||||
var/list/cut_wires = list() // List of wires that have been cut.
|
||||
var/list/colors = list() // Dictionary of colors to wire.
|
||||
var/list/assemblies = list() // List of attached assemblies.
|
||||
var/randomize = 0 // If every instance of these wires should be random.
|
||||
// Prevents wires from showing up in station blueprints
|
||||
|
||||
/datum/wires/New(atom/holder)
|
||||
..()
|
||||
if(!istype(holder, holder_type))
|
||||
CRASH("Wire holder is not of the expected type!")
|
||||
return
|
||||
|
||||
src.holder = holder
|
||||
if(randomize)
|
||||
randomize()
|
||||
else
|
||||
if(!GLOB.wire_color_directory[holder_type])
|
||||
randomize()
|
||||
GLOB.wire_color_directory[holder_type] = colors
|
||||
GLOB.wire_name_directory[holder_type] = proper_name
|
||||
else
|
||||
colors = GLOB.wire_color_directory[holder_type]
|
||||
|
||||
/datum/wires/Destroy()
|
||||
holder = null
|
||||
assemblies = list()
|
||||
return ..()
|
||||
|
||||
/datum/wires/proc/add_duds(duds)
|
||||
while(duds)
|
||||
var/dud = WIRE_DUD_PREFIX + "[--duds]"
|
||||
if(dud in wires)
|
||||
continue
|
||||
wires += dud
|
||||
|
||||
/datum/wires/proc/randomize()
|
||||
var/static/list/possible_colors = list(
|
||||
"blue",
|
||||
"brown",
|
||||
"crimson",
|
||||
"cyan",
|
||||
"gold",
|
||||
"grey",
|
||||
"green",
|
||||
"magenta",
|
||||
"orange",
|
||||
"pink",
|
||||
"purple",
|
||||
"red",
|
||||
"silver",
|
||||
"violet",
|
||||
"white",
|
||||
"yellow"
|
||||
)
|
||||
|
||||
var/list/my_possible_colors = possible_colors.Copy()
|
||||
|
||||
for(var/wire in shuffle(wires))
|
||||
colors[pick_n_take(my_possible_colors)] = wire
|
||||
|
||||
/datum/wires/proc/shuffle_wires()
|
||||
colors.Cut()
|
||||
randomize()
|
||||
|
||||
/datum/wires/proc/repair()
|
||||
cut_wires.Cut()
|
||||
|
||||
/datum/wires/proc/get_wire(color)
|
||||
return colors[color]
|
||||
|
||||
/datum/wires/proc/get_attached(color)
|
||||
if(assemblies[color])
|
||||
return assemblies[color]
|
||||
return null
|
||||
|
||||
/datum/wires/proc/is_attached(color)
|
||||
if(assemblies[color])
|
||||
return TRUE
|
||||
|
||||
/datum/wires/proc/is_cut(wire)
|
||||
return (wire in cut_wires)
|
||||
|
||||
/datum/wires/proc/is_color_cut(color)
|
||||
return is_cut(get_wire(color))
|
||||
|
||||
/datum/wires/proc/is_all_cut()
|
||||
if(cut_wires.len == wires.len)
|
||||
return TRUE
|
||||
|
||||
/datum/wires/proc/cut(wire)
|
||||
if(is_cut(wire))
|
||||
cut_wires -= wire
|
||||
on_cut(wire, mend = TRUE)
|
||||
else
|
||||
cut_wires += wire
|
||||
on_cut(wire, mend = FALSE)
|
||||
|
||||
/datum/wires/proc/cut_color(color)
|
||||
cut(get_wire(color))
|
||||
|
||||
/datum/wires/proc/cut_random()
|
||||
cut(wires[rand(1, wires.len)])
|
||||
|
||||
/datum/wires/proc/cut_all()
|
||||
for(var/wire in wires)
|
||||
cut(wire)
|
||||
|
||||
/datum/wires/proc/pulse(wire, user)
|
||||
if(is_cut(wire))
|
||||
return
|
||||
if(is_cut(wire))
|
||||
return
|
||||
on_pulse(wire, user)
|
||||
|
||||
|
||||
/datum/wires/proc/pulse_color(color, mob/living/user)
|
||||
pulse(get_wire(color), user)
|
||||
|
||||
/datum/wires/proc/pulse_assembly(obj/item/device/assembly/S)
|
||||
for(var/color in assemblies)
|
||||
if(S == assemblies[color])
|
||||
pulse_color(color)
|
||||
return TRUE
|
||||
|
||||
/datum/wires/proc/attach_assembly(color, obj/item/device/assembly/S)
|
||||
if(S && istype(S) && S.attachable && !is_attached(color))
|
||||
assemblies[color] = S
|
||||
S.loc = holder
|
||||
S.connected = src
|
||||
return S
|
||||
|
||||
/datum/wires/proc/detach_assembly(color)
|
||||
var/obj/item/device/assembly/S = get_attached(color)
|
||||
if(S && istype(S))
|
||||
assemblies -= color
|
||||
S.connected = null
|
||||
S.loc = holder.loc
|
||||
return S
|
||||
|
||||
/datum/wires/proc/emp_pulse()
|
||||
var/list/possible_wires = shuffle(wires)
|
||||
var/remaining_pulses = MAXIMUM_EMP_WIRES
|
||||
|
||||
for(var/wire in possible_wires)
|
||||
if(prob(33))
|
||||
pulse(wire)
|
||||
remaining_pulses--
|
||||
if(remaining_pulses >= 0)
|
||||
break
|
||||
|
||||
// Overridable Procs
|
||||
/datum/wires/proc/interactable(mob/user)
|
||||
return TRUE
|
||||
|
||||
/datum/wires/proc/get_status()
|
||||
return list()
|
||||
|
||||
/datum/wires/proc/on_cut(wire, mend = FALSE)
|
||||
return
|
||||
|
||||
|
||||
/datum/wires/proc/pulse_assembly(obj/item/device/assembly/S)
|
||||
for(var/color in assemblies)
|
||||
if(S == assemblies[color])
|
||||
pulse_color(color)
|
||||
return TRUE
|
||||
|
||||
/datum/wires/proc/attach_assembly(color, obj/item/device/assembly/S)
|
||||
if(S && istype(S) && S.attachable && !is_attached(color))
|
||||
assemblies[color] = S
|
||||
S.forceMove(holder)
|
||||
S.connected = src
|
||||
return S
|
||||
|
||||
/datum/wires/proc/detach_assembly(color)
|
||||
var/obj/item/device/assembly/S = get_attached(color)
|
||||
if(S && istype(S))
|
||||
assemblies -= color
|
||||
S.connected = null
|
||||
S.forceMove(holder.drop_location())
|
||||
return S
|
||||
|
||||
/datum/wires/proc/emp_pulse()
|
||||
var/list/possible_wires = shuffle(wires)
|
||||
var/remaining_pulses = MAXIMUM_EMP_WIRES
|
||||
|
||||
for(var/wire in possible_wires)
|
||||
if(prob(33))
|
||||
pulse(wire)
|
||||
remaining_pulses--
|
||||
if(remaining_pulses >= 0)
|
||||
break
|
||||
|
||||
// Overridable Procs
|
||||
/datum/wires/proc/interactable(mob/user)
|
||||
return TRUE
|
||||
|
||||
/datum/wires/proc/get_status()
|
||||
return list()
|
||||
|
||||
/datum/wires/proc/on_cut(wire, mend = FALSE)
|
||||
return
|
||||
|
||||
/datum/wires/proc/on_pulse(wire, user)
|
||||
return
|
||||
// End Overridable Procs
|
||||
|
||||
/datum/wires/proc/interact(mob/user)
|
||||
if(!interactable(user))
|
||||
return
|
||||
ui_interact(user)
|
||||
for(var/A in assemblies)
|
||||
var/obj/item/I = assemblies[A]
|
||||
if(istype(I) && I.on_found(user))
|
||||
return
|
||||
|
||||
/datum/wires/ui_host()
|
||||
return holder
|
||||
|
||||
/datum/wires/ui_status(mob/user)
|
||||
if(interactable(user))
|
||||
return ..()
|
||||
return UI_CLOSE
|
||||
|
||||
return
|
||||
// End Overridable Procs
|
||||
|
||||
/datum/wires/proc/interact(mob/user)
|
||||
if(!interactable(user))
|
||||
return
|
||||
ui_interact(user)
|
||||
for(var/A in assemblies)
|
||||
var/obj/item/I = assemblies[A]
|
||||
if(istype(I) && I.on_found(user))
|
||||
return
|
||||
|
||||
/datum/wires/ui_host()
|
||||
return holder
|
||||
|
||||
/datum/wires/ui_status(mob/user)
|
||||
if(interactable(user))
|
||||
return ..()
|
||||
return UI_CLOSE
|
||||
|
||||
/datum/wires/ui_interact(mob/user, ui_key = "wires", datum/tgui/ui = null, force_open = FALSE, \
|
||||
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.physical_state)
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if (!ui)
|
||||
ui = new(user, src, ui_key, "wires", "[holder.name] wires", 350, 150 + wires.len * 30, master_ui, state)
|
||||
ui.open()
|
||||
|
||||
/datum/wires/ui_data(mob/user)
|
||||
var/list/data = list()
|
||||
var/list/payload = list()
|
||||
for(var/color in colors)
|
||||
payload.Add(list(list(
|
||||
"color" = color,
|
||||
"wire" = (IsAdminGhost(user) || (user.is_holding_item_of_type(/obj/item/device/multitool/abductor)) ? get_wire(color) : null),
|
||||
"cut" = is_color_cut(color),
|
||||
"attached" = is_attached(color)
|
||||
)))
|
||||
data["wires"] = payload
|
||||
data["status"] = get_status()
|
||||
return data
|
||||
|
||||
/datum/wires/ui_act(action, params)
|
||||
if(..() || !interactable(usr))
|
||||
return
|
||||
var/target_wire = params["wire"]
|
||||
var/mob/living/L = usr
|
||||
var/obj/item/I = L.get_active_held_item()
|
||||
switch(action)
|
||||
if("cut")
|
||||
if(istype(I, /obj/item/wirecutters) || IsAdminGhost(usr))
|
||||
playsound(holder, I.usesound, 20, 1)
|
||||
cut_color(target_wire)
|
||||
. = TRUE
|
||||
else
|
||||
to_chat(L, "<span class='warning'>You need wirecutters!</span>")
|
||||
if("pulse")
|
||||
if(istype(I, /obj/item/device/multitool) || IsAdminGhost(usr))
|
||||
playsound(holder, 'sound/weapons/empty.ogg', 20, 1)
|
||||
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.physical_state)
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if (!ui)
|
||||
ui = new(user, src, ui_key, "wires", "[holder.name] wires", 350, 150 + wires.len * 30, master_ui, state)
|
||||
ui.open()
|
||||
|
||||
/datum/wires/ui_data(mob/user)
|
||||
var/list/data = list()
|
||||
var/list/payload = list()
|
||||
for(var/color in colors)
|
||||
payload.Add(list(list(
|
||||
"color" = color,
|
||||
"wire" = (IsAdminGhost(user) || (user.is_holding_item_of_type(/obj/item/device/multitool/abductor)) ? get_wire(color) : null),
|
||||
"cut" = is_color_cut(color),
|
||||
"attached" = is_attached(color)
|
||||
)))
|
||||
data["wires"] = payload
|
||||
data["status"] = get_status()
|
||||
return data
|
||||
|
||||
/datum/wires/ui_act(action, params)
|
||||
if(..() || !interactable(usr))
|
||||
return
|
||||
var/target_wire = params["wire"]
|
||||
var/mob/living/L = usr
|
||||
var/obj/item/I = L.get_active_held_item()
|
||||
switch(action)
|
||||
if("cut")
|
||||
if(istype(I, /obj/item/wirecutters) || IsAdminGhost(usr))
|
||||
playsound(holder, I.usesound, 20, 1)
|
||||
cut_color(target_wire)
|
||||
. = TRUE
|
||||
else
|
||||
to_chat(L, "<span class='warning'>You need wirecutters!</span>")
|
||||
if("pulse")
|
||||
if(istype(I, /obj/item/device/multitool) || IsAdminGhost(usr))
|
||||
playsound(holder, 'sound/weapons/empty.ogg', 20, 1)
|
||||
pulse_color(target_wire, L)
|
||||
. = TRUE
|
||||
else
|
||||
to_chat(L, "<span class='warning'>You need a multitool!</span>")
|
||||
if("attach")
|
||||
if(is_attached(target_wire))
|
||||
var/obj/item/O = detach_assembly(target_wire)
|
||||
if(O)
|
||||
L.put_in_hands(O)
|
||||
. = TRUE
|
||||
else
|
||||
if(istype(I, /obj/item/device/assembly))
|
||||
var/obj/item/device/assembly/A = I
|
||||
if(A.attachable)
|
||||
if(!L.drop_item())
|
||||
return
|
||||
attach_assembly(target_wire, A)
|
||||
. = TRUE
|
||||
else
|
||||
to_chat(L, "<span class='warning'>You need an attachable assembly!</span>")
|
||||
|
||||
#undef MAXIMUM_EMP_WIRES
|
||||
. = TRUE
|
||||
else
|
||||
to_chat(L, "<span class='warning'>You need a multitool!</span>")
|
||||
if("attach")
|
||||
if(is_attached(target_wire))
|
||||
var/obj/item/O = detach_assembly(target_wire)
|
||||
if(O)
|
||||
L.put_in_hands(O)
|
||||
. = TRUE
|
||||
else
|
||||
if(istype(I, /obj/item/device/assembly))
|
||||
var/obj/item/device/assembly/A = I
|
||||
if(A.attachable)
|
||||
if(!L.drop_item())
|
||||
return
|
||||
attach_assembly(target_wire, A)
|
||||
. = TRUE
|
||||
else
|
||||
to_chat(L, "<span class='warning'>You need an attachable assembly!</span>")
|
||||
|
||||
#undef MAXIMUM_EMP_WIRES
|
||||
|
||||
Reference in New Issue
Block a user