mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-22 19:47:22 +01:00
Merge pull request #460 from Markolie/master
Add bandanas, mask toggling, camo armor jacket, minimum drone/ERT age, turret update, NanoUI update and bugfixes
This commit is contained in:
@@ -55,6 +55,13 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts
|
||||
return 0
|
||||
|
||||
return max(0, minimal_player_age_antag - C.player_age)
|
||||
|
||||
/proc/check_client_age(client/C, var/days) // If days isn't provided, returns the age of the client. If it is provided, it returns the days until the player_age is equal to or greater than the days variable
|
||||
if(!days)
|
||||
return C.player_age
|
||||
else
|
||||
return max(0, days - C.player_age)
|
||||
return 0
|
||||
|
||||
var/const/MAX_SAVE_SLOTS = 10
|
||||
|
||||
|
||||
@@ -243,6 +243,37 @@ BLIND // can't see anything
|
||||
icon = 'icons/obj/clothing/masks.dmi'
|
||||
body_parts_covered = HEAD
|
||||
slot_flags = SLOT_MASK
|
||||
var/mask_adjusted = 0
|
||||
var/ignore_maskadjust = 1
|
||||
var/adjusted_flags = null
|
||||
|
||||
//Proc that moves gas/breath masks out of the way
|
||||
/obj/item/clothing/mask/proc/adjustmask(var/mob/user)
|
||||
if(!ignore_maskadjust)
|
||||
if(!user.canmove || user.stat || user.restrained())
|
||||
return
|
||||
if(src.mask_adjusted == 1)
|
||||
src.icon_state = initial(icon_state)
|
||||
gas_transfer_coefficient = initial(gas_transfer_coefficient)
|
||||
permeability_coefficient = initial(permeability_coefficient)
|
||||
user << "You push \the [src] back into place."
|
||||
src.mask_adjusted = 0
|
||||
slot_flags = initial(slot_flags)
|
||||
else
|
||||
src.icon_state += "_up"
|
||||
user << "You push \the [src] out of the way."
|
||||
gas_transfer_coefficient = null
|
||||
permeability_coefficient = null
|
||||
src.mask_adjusted = 1
|
||||
if(adjusted_flags)
|
||||
slot_flags = adjusted_flags
|
||||
if(ishuman(user))
|
||||
var/mob/living/carbon/human/H = user
|
||||
if(H.internal)
|
||||
if(H.internals)
|
||||
H.internals.icon_state = "internal0"
|
||||
H.internal = null
|
||||
usr.update_inv_wear_mask()
|
||||
|
||||
//Shoes
|
||||
/obj/item/clothing/shoes
|
||||
|
||||
@@ -6,10 +6,17 @@
|
||||
flags = BLOCKHAIR
|
||||
flags_inv = HIDEFACE
|
||||
w_class = 2
|
||||
icon_action_button = "action_balaclava"
|
||||
action_button_name = "Adjust Balaclava"
|
||||
ignore_maskadjust = 0
|
||||
species_fit = list("Vox")
|
||||
sprite_sheets = list(
|
||||
"Vox" = 'icons/mob/species/vox/mask.dmi'
|
||||
)
|
||||
|
||||
/obj/item/clothing/mask/balaclava/attack_self(var/mob/user)
|
||||
adjustmask(user)
|
||||
|
||||
/obj/item/clothing/mask/luchador
|
||||
name = "Luchador Mask"
|
||||
desc = "Worn by robust fighters, flying high to defeat their foes!"
|
||||
|
||||
@@ -8,34 +8,17 @@
|
||||
gas_transfer_coefficient = 0.10
|
||||
permeability_coefficient = 0.50
|
||||
species_fit = list("Vox")
|
||||
var/hanging = 0
|
||||
icon_action_button = "action_breath"
|
||||
action_button_name = "Adjust Breath Mask"
|
||||
ignore_maskadjust = 0
|
||||
species_fit = list("Vox", "Vox Armalis")
|
||||
sprite_sheets = list(
|
||||
"Vox" = 'icons/mob/species/vox/mask.dmi',
|
||||
"Vox Armalis" = 'icons/mob/species/armalis/mask.dmi',
|
||||
)
|
||||
|
||||
|
||||
verb/toggle()
|
||||
set category = "Object"
|
||||
set name = "Adjust mask"
|
||||
set src in usr
|
||||
|
||||
if(usr.canmove && !usr.stat && !usr.restrained())
|
||||
if(!src.hanging)
|
||||
src.hanging = !src.hanging
|
||||
gas_transfer_coefficient = 1 //gas is now escaping to the turf and vice versa
|
||||
flags &= ~(MASKCOVERSMOUTH | MASKINTERNALS)
|
||||
icon_state = "[initial(icon_state)]down"
|
||||
usr << "Your mask is now hanging on your neck."
|
||||
|
||||
else
|
||||
src.hanging = !src.hanging
|
||||
gas_transfer_coefficient = 0.10
|
||||
flags |= MASKCOVERSMOUTH | MASKINTERNALS
|
||||
icon_state = "[initial(icon_state)]"
|
||||
usr << "You pull the mask up to cover your face."
|
||||
usr.update_inv_wear_mask()
|
||||
/obj/item/clothing/mask/breath/attack_self(var/mob/user)
|
||||
adjustmask(user)
|
||||
|
||||
/obj/item/clothing/mask/breath/medical
|
||||
desc = "A close-fitting sterile mask that can be connected to an air supply."
|
||||
@@ -52,3 +35,6 @@
|
||||
item_state = "voxmask"
|
||||
permeability_coefficient = 0.01
|
||||
species_restricted = list("Vox")
|
||||
icon_action_button = null
|
||||
action_button_name = null
|
||||
ignore_maskadjust = 1
|
||||
|
||||
@@ -146,18 +146,30 @@
|
||||
name = "security gas mask"
|
||||
desc = "A standard issue Security gas mask with integrated 'Compli-o-nator 3000' device, plays over a dozen pre-recorded compliance phrases designed to get scumbags to stand still whilst you taze them. Do not tamper with the device."
|
||||
action_button_name = "HALT!"
|
||||
icon_state = "officermask"
|
||||
icon_state = "sechailer"
|
||||
var/cooldown = 0
|
||||
var/aggressiveness = 2
|
||||
ignore_maskadjust = 0
|
||||
species_fit = list()
|
||||
action_button_name = "HALT!"
|
||||
icon_action_button = "action_officermask"
|
||||
icon_action_button = "action_sechailer"
|
||||
|
||||
/obj/item/clothing/mask/gas/sechailer/warden
|
||||
icon_state = "wardenmask"
|
||||
|
||||
/obj/item/clothing/mask/gas/sechailer/hos
|
||||
icon_state = "hosmask"
|
||||
|
||||
/obj/item/clothing/mask/gas/sechailer/swat
|
||||
name = "\improper SWAT mask"
|
||||
desc = "A close-fitting tactical mask with an especially aggressive Compli-o-nator 3000."
|
||||
action_button_name = "HALT!"
|
||||
icon_state = "swat"
|
||||
aggressiveness = 3
|
||||
ignore_maskadjust = 1
|
||||
|
||||
/obj/item/clothing/mask/gas/sechailer/verb/adjust()
|
||||
set category = "Object"
|
||||
set name = "Adjust Mask"
|
||||
adjustmask(usr)
|
||||
|
||||
/obj/item/clothing/mask/gas/sechailer/attackby(obj/item/weapon/W as obj, mob/user as mob, params)
|
||||
if(istype(W, /obj/item/weapon/screwdriver))
|
||||
|
||||
@@ -35,10 +35,16 @@
|
||||
gas_transfer_coefficient = 0.90
|
||||
permeability_coefficient = 0.01
|
||||
armor = list(melee = 0, bullet = 0, laser = 0,energy = 0, bomb = 0, bio = 25, rad = 0)
|
||||
action_button_name = "Adjust Sterile Mask"
|
||||
ignore_maskadjust = 0
|
||||
species_fit = list("Vox")
|
||||
sprite_sheets = list(
|
||||
"Vox" = 'icons/mob/species/vox/mask.dmi'
|
||||
)
|
||||
|
||||
/obj/item/clothing/mask/surgical/attack_self(var/mob/user)
|
||||
adjustmask(user)
|
||||
|
||||
/obj/item/clothing/mask/fakemoustache
|
||||
name = "fake moustache"
|
||||
desc = "Warning: moustache is fake."
|
||||
@@ -150,3 +156,51 @@
|
||||
item_state = "pennywise_mask"
|
||||
species_fit = list("Vox")
|
||||
flags = MASKCOVERSMOUTH | MASKCOVERSEYES | BLOCK_GAS_SMOKE_EFFECT | MASKINTERNALS | BLOCKHAIR
|
||||
|
||||
// Bandanas
|
||||
/obj/item/clothing/mask/bandana
|
||||
name = "bandana"
|
||||
desc = "A colorful bandana."
|
||||
flags = MASKCOVERSMOUTH
|
||||
flags_inv = HIDEFACE
|
||||
w_class = 1
|
||||
slot_flags = SLOT_MASK
|
||||
ignore_maskadjust = 0
|
||||
adjusted_flags = SLOT_HEAD
|
||||
icon_state = "bandbotany"
|
||||
icon_action_button = "action_bandana"
|
||||
action_button_name = "Adjust Bandana"
|
||||
|
||||
/obj/item/clothing/mask/bandana/attack_self(var/mob/user)
|
||||
adjustmask(user)
|
||||
|
||||
obj/item/clothing/mask/bandana/red
|
||||
name = "red bandana"
|
||||
icon_state = "bandred"
|
||||
|
||||
obj/item/clothing/mask/bandana/blue
|
||||
name = "blue bandana"
|
||||
icon_state = "bandblue"
|
||||
|
||||
obj/item/clothing/mask/bandana/gold
|
||||
name = "gold bandana"
|
||||
icon_state = "bandgold"
|
||||
|
||||
obj/item/clothing/mask/bandana/green
|
||||
name = "green bandana"
|
||||
icon_state = "bandgreen"
|
||||
|
||||
/obj/item/clothing/mask/bandana/botany
|
||||
name = "botany bandana"
|
||||
desc = "It's a green bandana with some fine nanotech lining."
|
||||
icon_state = "bandbotany"
|
||||
|
||||
/obj/item/clothing/mask/bandana/skull
|
||||
name = "skull bandana"
|
||||
desc = "It's a black bandana with a skull pattern."
|
||||
icon_state = "bandskull"
|
||||
|
||||
/obj/item/clothing/mask/bandana/black
|
||||
name = "black bandana"
|
||||
desc = "It's a black bandana."
|
||||
icon_state = "bandblack"
|
||||
@@ -17,6 +17,13 @@
|
||||
blood_overlay_type = "armor"
|
||||
flags = ONESIZEFITSALL
|
||||
armor = list(melee = 50, bullet = 15, laser = 50, energy = 10, bomb = 25, bio = 0, rad = 0)
|
||||
|
||||
/obj/item/clothing/suit/armor/vest/jacket
|
||||
name = "military jacket"
|
||||
desc = "An old military jacket, it has armoring."
|
||||
icon_state = "militaryjacket"
|
||||
item_state = "militaryjacket"
|
||||
body_parts_covered = UPPER_TORSO|LOWER_TORSO|ARMS
|
||||
|
||||
/obj/item/clothing/suit/armor/vest/combat
|
||||
name = "combat vest"
|
||||
|
||||
@@ -639,8 +639,6 @@
|
||||
item_state = "checkered_suit"
|
||||
_color = "checkered_suit"
|
||||
|
||||
|
||||
|
||||
/obj/item/clothing/under/owl
|
||||
name = "owl uniform"
|
||||
desc = "A soft brown jumpsuit made of synthetic feathers and strong conviction."
|
||||
@@ -653,4 +651,5 @@
|
||||
desc = "A soft brown jumpsuit with a white feather collar made of synthetic feathers and a lust for mayhem."
|
||||
icon_state = "griffin"
|
||||
_color = "griffin"
|
||||
flags = NODROP
|
||||
flags = NODROP
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
announceWhen = 5
|
||||
|
||||
/datum/event/cargo_bonus/announce()
|
||||
command_announcement.Announce("Congratulations! [station_name()] was chosen for supply limit increase, please contact local cargo department for details!", "Supply Alert")
|
||||
command_announcement.Announce("Congratulations! [station_name()] was chosen for a supply limit increase. Please contact the local cargo department for details!", "Supply Alert")
|
||||
|
||||
/datum/event/cargo_bonus/start()
|
||||
supply_controller.points+=rand(100,500)
|
||||
supply_controller.points += rand(100,500)
|
||||
@@ -65,6 +65,9 @@
|
||||
return (tally + move_delay_add + config.alien_delay)
|
||||
|
||||
/mob/living/carbon/alien/humanoid/Process_Spacemove(var/check_drift = 0)
|
||||
if(..())
|
||||
return 1
|
||||
|
||||
return 0
|
||||
|
||||
///mob/living/carbon/alien/humanoid/bullet_act(var/obj/item/projectile/Proj) taken care of in living
|
||||
|
||||
@@ -476,10 +476,10 @@
|
||||
update_inv_wear_mask(0)
|
||||
else if(I == handcuffed)
|
||||
handcuffed = null
|
||||
update_inv_handcuffed(0)
|
||||
update_inv_handcuffed(1)
|
||||
else if(I == legcuffed)
|
||||
legcuffed = null
|
||||
update_inv_legcuffed(0)
|
||||
update_inv_legcuffed(1)
|
||||
|
||||
/mob/living/carbon/show_inv(mob/living/carbon/user as mob)
|
||||
user.set_machine(src)
|
||||
|
||||
@@ -182,7 +182,7 @@
|
||||
update_inv_back(0)
|
||||
else if(I == handcuffed)
|
||||
handcuffed = null
|
||||
update_inv_handcuffed(0)
|
||||
update_inv_handcuffed(1)
|
||||
else if(I == legcuffed)
|
||||
legcuffed = null
|
||||
update_inv_legcuffed(0)
|
||||
|
||||
@@ -97,6 +97,12 @@
|
||||
if(jobban_isbanned(src,"nonhumandept") || jobban_isbanned(src,"Drone"))
|
||||
usr << "\red You are banned from playing drones and cannot spawn as a drone."
|
||||
return
|
||||
|
||||
var/drone_age = 14 // 14 days to play as a drone
|
||||
var/player_age_check = check_client_age(usr.client, drone_age)
|
||||
if(player_age_check && config.use_age_restriction_for_antags)
|
||||
usr << "<span class='warning'>This role is not yet available to you. You need to wait another [player_age_check] days.</span>"
|
||||
return
|
||||
|
||||
var/deathtime = world.time - src.timeofdeath
|
||||
var/joinedasobserver = 0
|
||||
|
||||
@@ -1484,16 +1484,6 @@ var/list/robot_verbs_default = list(
|
||||
radio.recalculateChannels()
|
||||
|
||||
playsound(loc, 'sound/mecha/nominalsyndi.ogg', 75, 0)
|
||||
|
||||
/mob/living/silicon/robot/syndicate/canUseTopic(atom/movable/M)
|
||||
if(stat || lockcharge || stunned || weakened)
|
||||
return
|
||||
if(z in config.admin_levels)
|
||||
return 1
|
||||
/*if(istype(M, /obj/machinery))
|
||||
var/obj/machinery/Machine = M
|
||||
return Machine.emagged*/
|
||||
return 1
|
||||
|
||||
/mob/living/silicon/robot/proc/notify_ai(var/notifytype, var/oldname, var/newname)
|
||||
if(!connected_ai)
|
||||
|
||||
@@ -114,6 +114,11 @@ proc/isembryo(A)
|
||||
if(istype(A, /mob/living/silicon))
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/proc/isSilicon(A) // Bay support
|
||||
if(istype(A, /mob/living/silicon))
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/proc/isliving(A)
|
||||
if(istype(A, /mob/living))
|
||||
@@ -158,6 +163,13 @@ proc/isnewplayer(A)
|
||||
|
||||
proc/hasorgans(A)
|
||||
return ishuman(A)
|
||||
|
||||
proc/iscuffed(A)
|
||||
if(istype(A, /mob/living/carbon))
|
||||
var/mob/living/carbon/C = A
|
||||
if(C.handcuffed)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
proc/isdeaf(A)
|
||||
if(istype(A, /mob))
|
||||
|
||||
@@ -31,18 +31,13 @@
|
||||
* ui_interact is currently defined for /atom/movable
|
||||
*
|
||||
* @param user /mob The mob who is interacting with this ui
|
||||
<<<<<<< HEAD
|
||||
* @param ui_key string A string key to use for this ui. Allows for multiple unique uis on one obj/mob (defaut value "main")
|
||||
* @param ui /datum/nanoui This parameter is passed by the nanoui process() proc when updating an open ui
|
||||
=======
|
||||
* @param ui_key string A string key to use for this ui. Allows for multiple unique uis on one obj/mob (defaut value "main")
|
||||
* @param ui /datum/nanoui This parameter is passed by the nanoui process() proc when updating an open ui
|
||||
* @param force_open boolean Force the UI to (re)open, even if it's already open
|
||||
>>>>>>> 7e7e6cd... Continued work in progress on a major revision of the NanoUI templating system.
|
||||
*
|
||||
* @return nothing
|
||||
*/
|
||||
/atom/movable/proc/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
|
||||
/atom/movable/proc/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1, var/datum/nano_ui/master_ui = null, var/datum/topic_state/custom_state = null)
|
||||
return
|
||||
|
||||
// Used by the Nano UI Manager (/datum/nanomanager) to track UIs opened by this mob
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
/atom/movable/proc/nano_host()
|
||||
return src
|
||||
|
||||
/obj/nano_module/nano_host()
|
||||
return loc
|
||||
|
||||
|
||||
/atom/movable/proc/CanUseTopic(var/mob/user, href_list, var/datum/topic_state/custom_state)
|
||||
return user.can_use_topic(nano_host(), custom_state)
|
||||
|
||||
|
||||
/mob/proc/can_use_topic(var/mob/user, var/datum/topic_state/custom_state)
|
||||
return STATUS_CLOSE // By default no mob can do anything with NanoUI
|
||||
|
||||
/mob/dead/observer/can_use_topic()
|
||||
if(check_rights(R_ADMIN, 0))
|
||||
return STATUS_INTERACTIVE // Admins are more equal
|
||||
return STATUS_UPDATE // Ghosts can view updates
|
||||
|
||||
/mob/living/silicon/pai/can_use_topic(var/src_object)
|
||||
if(src_object == src && !stat)
|
||||
return STATUS_INTERACTIVE
|
||||
else
|
||||
return ..()
|
||||
|
||||
/mob/living/silicon/robot/can_use_topic(var/src_object, var/datum/topic_state/custom_state)
|
||||
if(stat || !client)
|
||||
return STATUS_CLOSE
|
||||
if(lockcharge || stunned || weakened)
|
||||
return STATUS_DISABLED
|
||||
// robots can interact with things they can see within their view range
|
||||
if(!(custom_state.flags & NANO_IGNORE_DISTANCE) && (src_object in view(src)))
|
||||
return STATUS_INTERACTIVE // interactive (green visibility)
|
||||
return STATUS_DISABLED // no updates, completely disabled (red visibility)
|
||||
|
||||
/mob/living/silicon/robot/syndicate/can_use_topic(var/src_object)
|
||||
. = ..()
|
||||
if(. != STATUS_INTERACTIVE)
|
||||
return
|
||||
|
||||
if(z in config.admin_levels) // Syndicate borgs can interact with everything on the admin level
|
||||
return STATUS_INTERACTIVE
|
||||
if(istype(get_area(src), /area/syndicate_station)) // If elsewhere, they can interact with everything on the syndicate shuttle
|
||||
return STATUS_INTERACTIVE
|
||||
if(istype(src_object, /obj/machinery)) // Otherwise they can only interact with emagged machinery
|
||||
var/obj/machinery/Machine = src_object
|
||||
if(Machine.emagged)
|
||||
return STATUS_INTERACTIVE
|
||||
return STATUS_UPDATE
|
||||
|
||||
/mob/living/silicon/ai/can_use_topic(var/src_object)
|
||||
if(!client || check_unable(1))
|
||||
return STATUS_CLOSE
|
||||
// Prevents the AI from using Topic on admin levels (by for example viewing through the court/thunderdome cameras)
|
||||
// unless it's on the same level as the object it's interacting with.
|
||||
var/turf/T = get_turf(src_object)
|
||||
if(!T || !(z == T.z || (T.z in config.player_levels)))
|
||||
return STATUS_CLOSE
|
||||
|
||||
// If an object is in view then we can interact with it
|
||||
if(src_object in view(client.view, src))
|
||||
return STATUS_INTERACTIVE
|
||||
|
||||
// If we're installed in a chassi, rather than transfered to an inteliCard or other container, then check if we have camera view
|
||||
if(is_in_chassis())
|
||||
//stop AIs from leaving windows open and using then after they lose vision
|
||||
//apc_override is needed here because AIs use their own APC when powerless
|
||||
if(cameranet && !cameranet.checkTurfVis(get_turf(src_object)))
|
||||
return apc_override ? STATUS_INTERACTIVE : STATUS_CLOSE
|
||||
return STATUS_INTERACTIVE
|
||||
|
||||
return STATUS_CLOSE
|
||||
|
||||
/mob/living/proc/shared_living_nano_interaction(var/src_object)
|
||||
if (src.stat != CONSCIOUS)
|
||||
return STATUS_CLOSE // no updates, close the interface
|
||||
else if (restrained() || lying || stat || stunned || weakened)
|
||||
return STATUS_UPDATE // update only (orange visibility)
|
||||
return STATUS_INTERACTIVE
|
||||
|
||||
/mob/living/proc/shared_living_nano_distance(var/atom/movable/src_object)
|
||||
if(!isturf(src_object.loc))
|
||||
if(src_object.loc == src) // Item in the inventory
|
||||
return STATUS_INTERACTIVE
|
||||
if(src.contents.Find(src_object.loc)) // A hidden uplink inside an item
|
||||
return STATUS_INTERACTIVE
|
||||
|
||||
if (!(src_object in view(4, src))) // If the src object is not in visable, disable updates
|
||||
return STATUS_CLOSE
|
||||
|
||||
var/dist = get_dist(src_object, src)
|
||||
if (dist <= 1)
|
||||
return STATUS_INTERACTIVE // interactive (green visibility)
|
||||
else if (dist <= 2)
|
||||
return STATUS_UPDATE // update only (orange visibility)
|
||||
else if (dist <= 4)
|
||||
return STATUS_DISABLED // no updates, completely disabled (red visibility)
|
||||
return STATUS_CLOSE
|
||||
|
||||
/mob/living/can_use_topic(var/src_object, var/datum/topic_state/custom_state)
|
||||
. = shared_living_nano_interaction(src_object)
|
||||
if(. == STATUS_INTERACTIVE && !(custom_state.flags & NANO_IGNORE_DISTANCE))
|
||||
. = shared_living_nano_distance(src_object)
|
||||
if(STATUS_INTERACTIVE)
|
||||
return STATUS_UPDATE
|
||||
|
||||
/mob/living/carbon/human/can_use_topic(var/src_object, var/datum/topic_state/custom_state)
|
||||
. = shared_living_nano_interaction(src_object)
|
||||
if(. == STATUS_INTERACTIVE && !(custom_state.flags & NANO_IGNORE_DISTANCE))
|
||||
. = shared_living_nano_distance(src_object)
|
||||
if(. == STATUS_UPDATE && (TK in mutations)) // If we have telekinesis and remain close enough, allow interaction.
|
||||
return STATUS_INTERACTIVE
|
||||
|
||||
/var/global/datum/topic_state/default_state = new()
|
||||
|
||||
/datum/topic_state
|
||||
var/flags = 0
|
||||
|
||||
/datum/topic_state/proc/href_list(var/mob/user)
|
||||
return list()
|
||||
@@ -186,7 +186,8 @@
|
||||
return 0 // wasn't open
|
||||
|
||||
processing_uis.Remove(ui)
|
||||
ui.user.open_uis.Remove(ui)
|
||||
if(ui.user) // Sanity check in case a user has been deleted (say a blown up borg watching the alarm interface)
|
||||
ui.user.open_uis.Remove(ui)
|
||||
var/list/uis = open_uis[src_object_key][ui.ui_key]
|
||||
uis.Remove(ui)
|
||||
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
/atom/movable/proc/nano_host()
|
||||
return src
|
||||
|
||||
/obj/nano_module/nano_host()
|
||||
return loc
|
||||
|
||||
/atom/movable/proc/nano_can_update()
|
||||
return 1
|
||||
|
||||
/obj/machinery/nano_can_update()
|
||||
return !(stat & (NOPOWER|BROKEN))
|
||||
+33
-137
@@ -13,8 +13,6 @@ nanoui is used to open and update nano browser uis
|
||||
var/atom/movable/src_object
|
||||
// the title of this ui
|
||||
var/title
|
||||
// /vg/ - Whether to write debug information to nano/debug.html
|
||||
var/writeDebug=TRUE
|
||||
// the key of this ui, this is to allow multiple (different) uis for each src_object
|
||||
var/ui_key
|
||||
// window_id is used as the window name/identifier for browse and onclose
|
||||
@@ -53,13 +51,14 @@ nanoui is used to open and update nano browser uis
|
||||
var/is_auto_updating = 0
|
||||
// the current status/visibility of the ui
|
||||
var/status = STATUS_INTERACTIVE
|
||||
|
||||
|
||||
// Relationship between a master interface and its children. Used in update_status
|
||||
var/datum/nanoui/master_ui
|
||||
var/list/datum/nanoui/children = list()
|
||||
var/datum/topic_state/custom_state = null
|
||||
|
||||
var/cached_data = null
|
||||
|
||||
|
||||
// Only allow users with a certain user.stat to get updates. Defaults to 0 (concious)
|
||||
var/allowed_user_stat = 0 // -1 = ignore, 0 = alive, 1 = unconcious or alive, 2 = dead concious or alive
|
||||
|
||||
/**
|
||||
* Create a new nanoui instance.
|
||||
*
|
||||
@@ -74,17 +73,22 @@ nanoui is used to open and update nano browser uis
|
||||
*
|
||||
* @return /nanoui new nanoui object
|
||||
*/
|
||||
/datum/nanoui/New(nuser, nsrc_object, nui_key, ntemplate_filename, ntitle = 0, nwidth = 0, nheight = 0, var/atom/nref = null)
|
||||
/datum/nanoui/New(nuser, nsrc_object, nui_key, ntemplate_filename, ntitle = 0, nwidth = 0, nheight = 0, var/atom/nref = null, var/datum/nanoui/master_ui = null, var/datum/topic_state/custom_state = default_state)
|
||||
user = nuser
|
||||
src_object = nsrc_object
|
||||
ui_key = nui_key
|
||||
window_id = "[ui_key]\ref[src_object]"
|
||||
|
||||
src.master_ui = master_ui
|
||||
if(master_ui)
|
||||
master_ui.children += src
|
||||
src.custom_state = custom_state
|
||||
|
||||
// add the passed template filename as the "main" template, this is required
|
||||
add_template("main", ntemplate_filename)
|
||||
|
||||
if (ntitle)
|
||||
title = ntitle
|
||||
title = sanitize(ntitle)
|
||||
if (nwidth)
|
||||
width = nwidth
|
||||
if (nheight)
|
||||
@@ -139,121 +143,13 @@ nanoui is used to open and update nano browser uis
|
||||
*/
|
||||
/datum/nanoui/proc/update_status(var/push_update = 0)
|
||||
var/atom/movable/host = src_object.nano_host()
|
||||
if(!host.nano_can_update())
|
||||
var/new_status = host.CanUseTopic(user, list(), custom_state)
|
||||
if(master_ui)
|
||||
new_status = min(new_status, master_ui.status)
|
||||
|
||||
set_status(new_status, push_update)
|
||||
if(new_status == STATUS_CLOSE)
|
||||
close()
|
||||
return
|
||||
|
||||
var/status = user.can_interact_with_interface(host.nano_host())
|
||||
if(status == STATUS_CLOSE)
|
||||
close()
|
||||
else
|
||||
set_status(status, push_update)
|
||||
|
||||
/*
|
||||
Procs called by update_status()
|
||||
*/
|
||||
|
||||
/mob/living/silicon/pai/can_interact_with_interface(src_object)
|
||||
if(src_object == src && !stat)
|
||||
return STATUS_INTERACTIVE
|
||||
else
|
||||
return ..()
|
||||
|
||||
/mob/proc/can_interact_with_interface(var/src_object)
|
||||
return STATUS_CLOSE // By default no mob can do anything with NanoUI
|
||||
|
||||
/mob/dead/observer/can_interact_with_interface()
|
||||
if(check_rights(R_ADMIN, 0))
|
||||
return STATUS_INTERACTIVE // Admins are more equal
|
||||
return STATUS_UPDATE // Ghosts can view updates
|
||||
|
||||
/mob/living/silicon/robot/can_interact_with_interface(var/src_object)
|
||||
if(stat || !client)
|
||||
return STATUS_CLOSE
|
||||
if(lockcharge || stunned || weakened)
|
||||
return STATUS_DISABLED
|
||||
if (src_object in view(client.view, src)) // robots can see and interact with things they can see within their view range
|
||||
return STATUS_INTERACTIVE // interactive (green visibility)
|
||||
return STATUS_DISABLED // no updates, completely disabled (red visibility)
|
||||
|
||||
/mob/living/silicon/robot/syndicate/can_interact_with_interface(var/src_object)
|
||||
. = ..()
|
||||
if(. != STATUS_INTERACTIVE)
|
||||
return
|
||||
|
||||
if(z in config.admin_levels) // Syndicate borgs can interact with everything on the admin level
|
||||
return STATUS_INTERACTIVE
|
||||
if(istype(get_area(src), /area/syndicate_station) || istype(get_area(src), /area/traitor)) // If elsewhere, they can interact with everything on the syndicate shuttle and traitor station
|
||||
return STATUS_INTERACTIVE
|
||||
if(istype(src_object, /obj/machinery)) // And they can also interact with everything else
|
||||
/*var/obj/machinery/Machine = src_object
|
||||
if(Machine.emagged) // Uncomment so they can only interact with emagged machinery
|
||||
return STATUS_INTERACTIVE*/
|
||||
return STATUS_INTERACTIVE
|
||||
return STATUS_UPDATE
|
||||
|
||||
/mob/living/silicon/ai/can_interact_with_interface(var/src_object)
|
||||
if(!client || check_unable(1))
|
||||
return STATUS_CLOSE
|
||||
// Prevents the AI from using Topic on admin levels (by for example viewing through the court/thunderdome cameras)
|
||||
// unless it's on the same level as the object it's interacting with.
|
||||
var/turf/T = get_turf(src_object)
|
||||
if(!T || !(z == T.z || (T.z in config.player_levels)))
|
||||
return STATUS_CLOSE
|
||||
|
||||
// If an object is in view then we can interact with it
|
||||
if(src_object in view(client.view, src))
|
||||
return STATUS_INTERACTIVE
|
||||
|
||||
// If we're installed in a chassi, rather than transfered to an inteliCard or other container, then check if we have camera view
|
||||
if(is_in_chassis())
|
||||
//stop AIs from leaving windows open and using then after they lose vision
|
||||
//apc_override is needed here because AIs use their own APC when powerless
|
||||
if(cameranet && !cameranet.checkTurfVis(get_turf(src_object)))
|
||||
return apc_override ? STATUS_INTERACTIVE : STATUS_CLOSE
|
||||
return STATUS_INTERACTIVE
|
||||
|
||||
return STATUS_CLOSE
|
||||
|
||||
/mob/living/proc/shared_living_nano_interaction(var/src_object)
|
||||
if (src.stat != CONSCIOUS)
|
||||
return STATUS_CLOSE // no updates, close the interface
|
||||
else if (restrained() || lying || stat || stunned || weakened)
|
||||
return STATUS_UPDATE // update only (orange visibility)
|
||||
return STATUS_INTERACTIVE
|
||||
|
||||
/mob/living/proc/shared_living_nano_distance(var/atom/movable/src_object)
|
||||
if(!isturf(src_object.loc))
|
||||
if(src_object.loc == src) // Item in the inventory
|
||||
return STATUS_INTERACTIVE
|
||||
if(src.contents.Find(src_object.loc)) // A hidden uplink inside an item
|
||||
return STATUS_INTERACTIVE
|
||||
|
||||
if (!(src_object in view(4, src))) // If the src object is not in visable, disable updates
|
||||
return STATUS_CLOSE
|
||||
|
||||
var/dist = get_dist(src_object, src)
|
||||
if (dist <= 1)
|
||||
return STATUS_INTERACTIVE // interactive (green visibility)
|
||||
else if (dist <= 2)
|
||||
return STATUS_UPDATE // update only (orange visibility)
|
||||
else if (dist <= 4)
|
||||
return STATUS_DISABLED // no updates, completely disabled (red visibility)
|
||||
return STATUS_CLOSE
|
||||
|
||||
/mob/living/can_interact_with_interface(var/src_object, var/be_close = 1)
|
||||
. = shared_living_nano_interaction(src_object)
|
||||
if(. == STATUS_INTERACTIVE && be_close)
|
||||
. = shared_living_nano_distance(src_object)
|
||||
if(STATUS_INTERACTIVE)
|
||||
return STATUS_UPDATE
|
||||
|
||||
/mob/living/carbon/human/can_interact_with_interface(var/src_object, var/be_close = 1)
|
||||
. = shared_living_nano_interaction(src_object)
|
||||
if(. == STATUS_INTERACTIVE && be_close)
|
||||
. = shared_living_nano_distance(src_object)
|
||||
if(. == STATUS_UPDATE && (TK in mutations)) // If we have telekinesis and remain close enough, allow interaction.
|
||||
return STATUS_INTERACTIVE
|
||||
|
||||
/**
|
||||
* Set the ui to auto update (every master_controller tick)
|
||||
@@ -409,7 +305,7 @@ nanoui is used to open and update nano browser uis
|
||||
*/
|
||||
/datum/nanoui/proc/set_show_map(nstate)
|
||||
show_map = nstate
|
||||
|
||||
|
||||
/**
|
||||
* Toggle showing the map ui
|
||||
*
|
||||
@@ -496,18 +392,15 @@ nanoui is used to open and update nano browser uis
|
||||
* @return nothing
|
||||
*/
|
||||
/datum/nanoui/proc/open()
|
||||
|
||||
var/window_size = ""
|
||||
if (width && height)
|
||||
window_size = "size=[width]x[height];"
|
||||
update_status(0)
|
||||
var/html=get_html()
|
||||
if(src.writeDebug)
|
||||
var/f = file("nano/debug.html")
|
||||
fdel(f)
|
||||
f << html
|
||||
user << browse(html, "window=[window_id];[window_size][window_options]")
|
||||
winset(user, "mapwindow.map", "focus=true") // Return keyboard focus to map.
|
||||
if(status == STATUS_CLOSE)
|
||||
return
|
||||
|
||||
user << browse(get_html(), "window=[window_id];[window_size][window_options]")
|
||||
winset(user, "mapwindow.map", "focus=true") // return keyboard focus to map
|
||||
on_close_winset()
|
||||
//onclose(user, window_id)
|
||||
nanomanager.ui_opened(src)
|
||||
@@ -521,6 +414,8 @@ nanoui is used to open and update nano browser uis
|
||||
is_auto_updating = 0
|
||||
nanomanager.ui_closed(src)
|
||||
user << browse(null, "window=[window_id]")
|
||||
for(var/datum/nanoui/child in children)
|
||||
child.close()
|
||||
|
||||
/**
|
||||
* Set the UI window to call the nanoclose verb when the window is closed
|
||||
@@ -534,11 +429,12 @@ nanoui is used to open and update nano browser uis
|
||||
var/params = "\ref[src]"
|
||||
|
||||
winset(user, window_id, "on-close=\"nanoclose [params]\"")
|
||||
|
||||
|
||||
/**
|
||||
* Appends already processed json txt to the list2json proc when setting initial-data and data pushes
|
||||
* Used for data that is fucking huge like manifests and camera lists that doesn't change often.
|
||||
* And we only want to process them when they change.
|
||||
* Fuck javascript
|
||||
*
|
||||
* @return nothing
|
||||
*/
|
||||
@@ -546,6 +442,7 @@ nanoui is used to open and update nano browser uis
|
||||
cached_data = data
|
||||
return
|
||||
|
||||
|
||||
/**
|
||||
* Push data to an already open UI window
|
||||
*
|
||||
@@ -578,12 +475,12 @@ nanoui is used to open and update nano browser uis
|
||||
if(href_list["showMap"])
|
||||
set_show_map(text2num(href_list["showMap"]))
|
||||
map_update = 1
|
||||
|
||||
|
||||
if(href_list["mapZLevel"])
|
||||
set_map_z_level(text2num(href_list["mapZLevel"]))
|
||||
map_update = 1
|
||||
|
||||
if ((src_object && src_object.Topic(href, href_list)) || map_update)
|
||||
if ((src_object && src_object.Topic(href, href_list, 0, custom_state)) || map_update)
|
||||
nanomanager.update_uis(src_object) // update all UIs attached to src_object
|
||||
|
||||
/**
|
||||
@@ -610,5 +507,4 @@ nanoui is used to open and update nano browser uis
|
||||
* @return nothing
|
||||
*/
|
||||
/datum/nanoui/proc/update(var/force_open = 0)
|
||||
src_object.ui_interact(user, ui_key, src, force_open)
|
||||
|
||||
src_object.ui_interact(user, ui_key, src, force_open, master_ui, custom_state)
|
||||
|
||||
@@ -691,8 +691,12 @@
|
||||
else
|
||||
beenhit += 1
|
||||
return
|
||||
|
||||
|
||||
|
||||
/obj/machinery/power/apc/attack_ghost(user as mob)
|
||||
if(stat & (BROKEN|MAINT))
|
||||
return
|
||||
return ui_interact(user)
|
||||
|
||||
/obj/machinery/power/apc/interact(mob/user)
|
||||
if(!user)
|
||||
return
|
||||
|
||||
@@ -332,6 +332,9 @@
|
||||
add_fingerprint(user)
|
||||
ui_interact(user)
|
||||
|
||||
/obj/machinery/power/smes/attack_ghost(mob/user)
|
||||
ui_interact(user)
|
||||
|
||||
/obj/machinery/power/smes/attack_hand(mob/user)
|
||||
add_fingerprint(user)
|
||||
ui_interact(user)
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
var/last_fired = 0
|
||||
var/obj/item/device/flashlight/F = null
|
||||
var/can_flashlight = 0
|
||||
var/heavy_weapon = 0
|
||||
|
||||
proc/ready_to_fire()
|
||||
if(world.time >= last_fired + fire_delay)
|
||||
@@ -122,6 +123,12 @@
|
||||
|
||||
if(!in_chamber)
|
||||
return
|
||||
|
||||
if(heavy_weapon)
|
||||
if(user.get_inactive_hand())
|
||||
recoil = 4 //one-handed kick
|
||||
else
|
||||
recoil = initial(recoil)
|
||||
|
||||
in_chamber.firer = user
|
||||
in_chamber.def_zone = user.zone_sel.selecting
|
||||
@@ -142,6 +149,12 @@
|
||||
user.visible_message("<span class='warning'>[user] fires [src][reflex ? " by reflex":""]!</span>", \
|
||||
"<span class='warning'>You fire [src][reflex ? "by reflex":""]!</span>", \
|
||||
"You hear a [istype(in_chamber, /obj/item/projectile/beam) ? "laser blast" : "gunshot"]!")
|
||||
|
||||
if(heavy_weapon)
|
||||
if(user.get_inactive_hand())
|
||||
if(prob(15))
|
||||
user.visible_message("<span class='danger'>[src] flies out of [user]'s hands!</span>", "<span class='userdanger'>[src] kicks out of your grip!</span>")
|
||||
user.drop_item()
|
||||
|
||||
if (istype(in_chamber, /obj/item/projectile/bullet/blank)) // A hacky way of making blank shotgun shells work again. Honk.
|
||||
in_chamber.delete()
|
||||
|
||||
@@ -130,3 +130,43 @@
|
||||
update_charge()
|
||||
update_reactor()
|
||||
update_mode()
|
||||
|
||||
|
||||
/obj/item/weapon/gun/energy/gun/turret
|
||||
name = "hybrid turret gun"
|
||||
desc = "A heavy hybrid energy cannon with two settings: Stun and kill."
|
||||
icon_state = "turretlaser"
|
||||
slot_flags = null
|
||||
w_class = 5
|
||||
heavy_weapon = 1
|
||||
can_flashlight = 0
|
||||
projectile_type = /obj/item/projectile/energy/electrode
|
||||
charge_cost = 1000
|
||||
fire_delay = 20
|
||||
|
||||
/obj/item/weapon/gun/energy/gun/turret/update_icon()
|
||||
icon_state = initial(icon_state)
|
||||
|
||||
/obj/item/weapon/gun/energy/gun/turret/attack_self(mob/living/user as mob)
|
||||
switch(mode)
|
||||
if(0)
|
||||
mode = 1
|
||||
charge_cost = 500
|
||||
fire_sound = 'sound/weapons/Laser.ogg'
|
||||
user << "\red [src.name] is now set to kill."
|
||||
projectile_type = /obj/item/projectile/beam
|
||||
modifystate = "energykill"
|
||||
fire_delay = 0
|
||||
if(1)
|
||||
mode = 0
|
||||
charge_cost = 1000
|
||||
fire_sound = 'sound/weapons/Taser.ogg'
|
||||
user << "\red [src.name] is now set to stun."
|
||||
projectile_type = /obj/item/projectile/energy/electrode
|
||||
modifystate = "energystun"
|
||||
fire_delay = 20
|
||||
update_icon()
|
||||
if(user.l_hand == src)
|
||||
user.update_inv_l_hand()
|
||||
else
|
||||
user.update_inv_r_hand()
|
||||
@@ -399,10 +399,11 @@ datum
|
||||
|
||||
check_gofast(var/mob/M)
|
||||
if(M && istype(M, /mob))
|
||||
if(M.reagents.has_reagent("hyperzine")||M.reagents.has_reagent("nuka_cola"))
|
||||
return 1
|
||||
else
|
||||
M.status_flags &= ~GOTTAGOFAST
|
||||
if(M.reagents)
|
||||
if(M.reagents.has_reagent("hyperzine")||M.reagents.has_reagent("nuka_cola"))
|
||||
return 1
|
||||
else
|
||||
M.status_flags &= ~GOTTAGOFAST
|
||||
|
||||
update_total()
|
||||
total_volume = 0
|
||||
|
||||
Reference in New Issue
Block a user