diff --git a/_maps/RandomRuins/LavaRuins/lavaland_biodome_beach.dmm b/_maps/RandomRuins/LavaRuins/lavaland_biodome_beach.dmm index 790e628cba4..af06c158d99 100644 --- a/_maps/RandomRuins/LavaRuins/lavaland_biodome_beach.dmm +++ b/_maps/RandomRuins/LavaRuins/lavaland_biodome_beach.dmm @@ -1,4 +1,4 @@ -//MAP CONVERTED BY dmm2tgm.py THIS HEADER COMMENT PREVENTS RECONVERSION, DO NOT REMOVE +//MAP CONVERTED BY dmm2tgm.py THIS HEADER COMMENT PREVENTS RECONVERSION, DO NOT REMOVE "aa" = ( /turf/template_noop, /area/template_noop) @@ -146,7 +146,7 @@ /area/ruin/powered/beach) "aF" = ( /obj/machinery/vending/boozeomat{ - emagged = 1; + set_obj_flags = "EMAGGED"; req_access_txt = "0" }, /turf/open/floor/wood, diff --git a/_maps/RandomRuins/LavaRuins/lavaland_surface_greed.dmm b/_maps/RandomRuins/LavaRuins/lavaland_surface_greed.dmm index 28657c7e6de..7847aa3b813 100644 --- a/_maps/RandomRuins/LavaRuins/lavaland_surface_greed.dmm +++ b/_maps/RandomRuins/LavaRuins/lavaland_surface_greed.dmm @@ -1,4 +1,4 @@ -//MAP CONVERTED BY dmm2tgm.py THIS HEADER COMMENT PREVENTS RECONVERSION, DO NOT REMOVE +//MAP CONVERTED BY dmm2tgm.py THIS HEADER COMMENT PREVENTS RECONVERSION, DO NOT REMOVE "a" = ( /turf/open/floor/plating/asteroid/basalt/lava_land_surface, /area/lavaland/surface/outdoors) @@ -55,7 +55,7 @@ /area/ruin/powered/greed) "k" = ( /obj/machinery/computer/arcade/battle{ - emagged = 1 + set_obj_flags = "EMAGGED" }, /turf/open/floor/engine/cult, /area/ruin/powered/greed) diff --git a/_maps/RandomRuins/SpaceRuins/crashedship.dmm b/_maps/RandomRuins/SpaceRuins/crashedship.dmm index 8ff4d4b1ae7..01c4e6a098d 100644 --- a/_maps/RandomRuins/SpaceRuins/crashedship.dmm +++ b/_maps/RandomRuins/SpaceRuins/crashedship.dmm @@ -16,7 +16,7 @@ "ag" = ( /obj/machinery/porta_turret{ dir = 8; - emagged = 1; + set_obj_flags = "EMAGGED"; installation = /obj/item/gun/energy/lasercannon }, /turf/open/floor/engine, @@ -1860,7 +1860,7 @@ "gl" = ( /obj/machinery/porta_turret{ dir = 8; - emagged = 1; + set_obj_flags = "EMAGGED"; installation = /obj/item/gun/energy/lasercannon }, /turf/open/floor/engine, diff --git a/_maps/RandomZLevels/beach.dmm b/_maps/RandomZLevels/beach.dmm index 10fa8be8612..5e910afcbf9 100644 --- a/_maps/RandomZLevels/beach.dmm +++ b/_maps/RandomZLevels/beach.dmm @@ -144,7 +144,7 @@ /area/awaymission/beach) "aA" = ( /obj/machinery/vending/boozeomat{ - emagged = 1 + set_obj_flags = "EMAGGED" }, /turf/open/floor/wood, /area/awaymission/beach) diff --git a/_maps/RandomZLevels/challenge.dmm b/_maps/RandomZLevels/challenge.dmm index b5734cfcd46..c5d253c6bb5 100644 --- a/_maps/RandomZLevels/challenge.dmm +++ b/_maps/RandomZLevels/challenge.dmm @@ -242,7 +242,7 @@ "aX" = ( /obj/machinery/porta_turret{ dir = 8; - emagged = 1; + set_obj_flags = "EMAGGED"; installation = /obj/item/gun/energy/lasercannon }, /turf/open/floor/plating/airless, @@ -384,7 +384,7 @@ "bq" = ( /obj/machinery/porta_turret{ dir = 8; - emagged = 1; + set_obj_flags = "EMAGGED"; installation = /obj/item/gun/energy/lasercannon }, /turf/open/floor/plating, diff --git a/_maps/RandomZLevels/moonoutpost19.dmm b/_maps/RandomZLevels/moonoutpost19.dmm index 589befc3511..4bae843b31c 100644 --- a/_maps/RandomZLevels/moonoutpost19.dmm +++ b/_maps/RandomZLevels/moonoutpost19.dmm @@ -1127,7 +1127,7 @@ "cr" = ( /obj/machinery/door/airlock/public/glass{ density = 0; - emagged = 1; + set_obj_flags = "EMAGGED"; icon_state = "open"; locked = 1; name = "Dormitories" @@ -1438,7 +1438,7 @@ "cT" = ( /obj/machinery/door/airlock{ density = 0; - emagged = 1; + set_obj_flags = "EMAGGED"; icon_state = "open"; id_tag = "awaydorm4"; locked = 1; @@ -1750,7 +1750,7 @@ "du" = ( /obj/machinery/door/airlock/external{ density = 0; - emagged = 1; + set_obj_flags = "EMAGGED"; icon_state = "open"; locked = 1; opacity = 0; @@ -1910,7 +1910,7 @@ "dI" = ( /obj/machinery/door/airlock/external{ density = 0; - emagged = 1; + set_obj_flags = "EMAGGED"; icon_state = "open"; locked = 1; opacity = 0; @@ -2784,7 +2784,7 @@ /obj/machinery/door/firedoor, /obj/machinery/door/airlock/research{ density = 0; - emagged = 1; + set_obj_flags = "EMAGGED"; icon_state = "open"; locked = 1; name = "Xenobiology Lab"; @@ -3948,7 +3948,7 @@ /obj/machinery/door/firedoor, /obj/machinery/door/airlock/command{ density = 0; - emagged = 1; + set_obj_flags = "EMAGGED"; icon_state = "open"; locked = 1; name = "Research Director's Office"; diff --git a/_maps/RandomZLevels/spacebattle.dmm b/_maps/RandomZLevels/spacebattle.dmm index d1b199e8a3c..4dff027d92e 100644 --- a/_maps/RandomZLevels/spacebattle.dmm +++ b/_maps/RandomZLevels/spacebattle.dmm @@ -226,7 +226,7 @@ "bc" = ( /obj/machinery/porta_turret{ dir = 8; - emagged = 1; + set_obj_flags = "EMAGGED"; installation = /obj/item/gun/energy/lasercannon }, /turf/open/floor/plating, @@ -322,7 +322,7 @@ "by" = ( /obj/machinery/porta_turret{ dir = 8; - emagged = 1; + set_obj_flags = "EMAGGED"; installation = /obj/item/gun/energy/lasercannon }, /turf/open/floor/plating, @@ -344,7 +344,7 @@ "bG" = ( /obj/machinery/porta_turret{ dir = 8; - emagged = 1; + set_obj_flags = "EMAGGED"; installation = /obj/item/gun/energy/lasercannon }, /turf/open/floor/plating, @@ -917,7 +917,7 @@ "dZ" = ( /obj/machinery/porta_turret{ dir = 8; - emagged = 1; + set_obj_flags = "EMAGGED"; installation = /obj/item/gun/energy/lasercannon }, /turf/open/floor/engine, @@ -1718,7 +1718,7 @@ "gP" = ( /obj/machinery/porta_turret{ dir = 8; - emagged = 1; + set_obj_flags = "EMAGGED"; installation = /obj/item/gun/energy/lasercannon }, /turf/open/floor/plating/airless, @@ -2613,7 +2613,7 @@ "kq" = ( /obj/machinery/porta_turret{ dir = 8; - emagged = 1; + set_obj_flags = "EMAGGED"; installation = /obj/item/gun/energy/lasercannon }, /turf/open/floor/engine/vacuum, diff --git a/code/__DEFINES/obj_flags.dm b/code/__DEFINES/obj_flags.dm new file mode 100644 index 00000000000..2dffa6b5bb3 --- /dev/null +++ b/code/__DEFINES/obj_flags.dm @@ -0,0 +1,12 @@ +// Flags for the obj_flags var on /obj + + +#define EMAGGED 1 +#define IN_USE 2 // If we have a user using us, this will be set on. We will check if the user has stopped using us, and thus stop updating and LAGGING EVERYTHING! +#define CAN_BE_HIT 4 //can this be bludgeoned by items? +#define BEING_SHOCKED 8 // Whether this thing is currently (already) being shocked by a tesla +#define DANGEROUS_POSSESSION 16 //Admin possession yes/no +#define ON_BLUEPRINTS 32 //Are we visible on the station blueprints at roundstart? +#define UNIQUE_RENAME 64 // can you customize the description/name of the thing? + +// If you add new ones, be sure to add them to /obj/Initialize as well for complete mapping support diff --git a/code/__DEFINES/vv.dm b/code/__DEFINES/vv.dm index 807e5187b08..0617c5d3457 100644 --- a/code/__DEFINES/vv.dm +++ b/code/__DEFINES/vv.dm @@ -18,4 +18,4 @@ #define VV_NULL "NULL" #define VV_RESTORE_DEFAULT "Restore to Default" #define VV_MARKED_DATUM "Marked Datum" - +#define VV_BITFIELD "Bitfield" diff --git a/code/_globalvars/misc.dm b/code/_globalvars/misc.dm index 8b8b8175863..2cc7b38bbe2 100644 --- a/code/_globalvars/misc.dm +++ b/code/_globalvars/misc.dm @@ -17,4 +17,6 @@ GLOBAL_LIST_EMPTY(powernets) GLOBAL_VAR_INIT(bsa_unlock, FALSE) //BSA unlocked by head ID swipes -GLOBAL_LIST_EMPTY(player_details) // ckey -> /datum/player_details \ No newline at end of file +GLOBAL_LIST_EMPTY(player_details) // ckey -> /datum/player_details + +GLOBAL_LIST_INIT(bitfields, list("obj_flags" = list("EMAGGED" = EMAGGED, "IN_USE" = IN_USE, "CAN_BE_HIT" = CAN_BE_HIT, "BEING_SHOCKED" = BEING_SHOCKED, "DANGEROUS_POSSESSION" = DANGEROUS_POSSESSION, "ON_BLUEPRINTS" = ON_BLUEPRINTS, "UNIQUE_RENAME" = UNIQUE_RENAME))) diff --git a/code/_onclick/ai.dm b/code/_onclick/ai.dm index e97f4d5426c..ac034657733 100644 --- a/code/_onclick/ai.dm +++ b/code/_onclick/ai.dm @@ -130,16 +130,16 @@ /* Airlocks */ /obj/machinery/door/airlock/AICtrlClick() // Bolts doors - if(emagged) + if(obj_flags & EMAGGED) return - + if(locked) bolt_raise(usr) else bolt_drop(usr) /obj/machinery/door/airlock/AIAltClick() // Eletrifies doors. - if(emagged) + if(obj_flags & EMAGGED) return if(!secondsElectrified) @@ -148,15 +148,15 @@ shock_restore(usr) /obj/machinery/door/airlock/AIShiftClick() // Opens and closes doors! - if(emagged) + if(obj_flags & EMAGGED) return user_toggle_open(usr) /obj/machinery/door/airlock/AICtrlShiftClick() // Sets/Unsets Emergency Access Override - if(emagged) + if(obj_flags & EMAGGED) return - + if(!emergency) emergency_on(usr) else diff --git a/code/_onclick/item_attack.dm b/code/_onclick/item_attack.dm index 8a5b9ba519b..8f5ed37457d 100644 --- a/code/_onclick/item_attack.dm +++ b/code/_onclick/item_attack.dm @@ -39,7 +39,7 @@ return FALSE /obj/attackby(obj/item/I, mob/living/user, params) - return ..() || (can_be_hit && I.attack_obj(src, user)) + return ..() || ((obj_flags & CAN_BE_HIT) && I.attack_obj(src, user)) /mob/living/attackby(obj/item/I, mob/living/user, params) user.changeNext_move(CLICK_CD_MELEE) @@ -62,7 +62,7 @@ if(force && user.has_disability(DISABILITY_PACIFISM)) to_chat(user, "You don't want to harm other living beings!") return - + if(!force) playsound(loc, 'sound/weapons/tap.ogg', get_clamped_volume(), 1, -1) else if(hitsound) diff --git a/code/datums/browser.dm b/code/datums/browser.dm index f863a5007d3..679285a2720 100644 --- a/code/datums/browser.dm +++ b/code/datums/browser.dm @@ -120,13 +120,7 @@ else WARNING("Browser [title] tried to close with a null ID") -/datum/browser/alert - var/selectedbutton = 0 - var/opentime = 0 - var/timeout - var/stealfocus - -/datum/browser/alert/New(User,Message,Title,Button1="Ok",Button2,Button3,StealFocus = 1,Timeout=6000) +/datum/browser/modal/alert/New(User,Message,Title,Button1="Ok",Button2,Button3,StealFocus = 1,Timeout=6000) if (!User) return @@ -142,44 +136,10 @@ output += {""} - ..(User, ckey("[User]-[Message]-[Title]-[world.time]-[rand(1,10000)]"), Title, 350, 150, src) + ..(User, ckey("[User]-[Message]-[Title]-[world.time]-[rand(1,10000)]"), Title, 350, 150, src, StealFocus, Timeout) set_content(output) - stealfocus = StealFocus - if (!StealFocus) - window_options += "focus=false;" - timeout = Timeout -/datum/browser/alert/open() - set waitfor = 0 - opentime = world.time - - if (stealfocus) - . = ..(use_onclose = 1) - else - var/focusedwindow = winget(user, null, "focus") - . = ..(use_onclose = 1) - - //waits for the window to show up client side before attempting to un-focus it - //winexists sleeps until it gets a reply from the client, so we don't need to bother sleeping - for (var/i in 1 to 10) - if (user && winexists(user, window_id)) - if (focusedwindow) - winset(user, focusedwindow, "focus=true") - else - winset(user, "mapwindow", "focus=true") - break - if (timeout) - addtimer(CALLBACK(src, .proc/close), timeout) - -/datum/browser/alert/close() - .=..() - opentime = 0 - -/datum/browser/alert/proc/wait() - while (opentime && selectedbutton <= 0 && (!timeout || opentime+timeout > world.time)) - stoplag(1) - -/datum/browser/alert/Topic(href,href_list) +/datum/browser/modal/alert/Topic(href,href_list) if (href_list["close"] || !user || !user.client) opentime = 0 return @@ -210,12 +170,135 @@ User = C.mob else return - var/datum/browser/alert/A = new(User, Message, Title, Button1, Button2, Button3, StealFocus, Timeout) + var/datum/browser/modal/alert/A = new(User, Message, Title, Button1, Button2, Button3, StealFocus, Timeout) A.open() A.wait() if (A.selectedbutton) return A.selectedbutton +/datum/browser/modal + var/opentime = 0 + var/timeout + var/selectedbutton = 0 + var/stealfocus + +/datum/browser/modal/New(nuser, nwindow_id, ntitle = 0, nwidth = 0, nheight = 0, var/atom/nref = null, StealFocus = 1, Timeout = 6000) + ..() + stealfocus = StealFocus + if (!StealFocus) + window_options += "focus=false;" + timeout = Timeout + + +/datum/browser/modal/close() + .=..() + opentime = 0 + +/datum/browser/modal/open() + set waitfor = 0 + opentime = world.time + + if (stealfocus) + . = ..(use_onclose = 1) + else + var/focusedwindow = winget(user, null, "focus") + . = ..(use_onclose = 1) + + //waits for the window to show up client side before attempting to un-focus it + //winexists sleeps until it gets a reply from the client, so we don't need to bother sleeping + for (var/i in 1 to 10) + if (user && winexists(user, window_id)) + if (focusedwindow) + winset(user, focusedwindow, "focus=true") + else + winset(user, "mapwindow", "focus=true") + break + if (timeout) + addtimer(CALLBACK(src, .proc/close), timeout) + +/datum/browser/modal/proc/wait() + while (opentime && selectedbutton <= 0 && (!timeout || opentime+timeout > world.time)) + stoplag(1) + +/datum/browser/modal/listpicker + var/valueslist = list() + +/datum/browser/modal/listpicker/New(User,Message,Title,Button1="Ok",Button2,Button3,StealFocus = 1, Timeout = FALSE,list/values,Radio=FALSE) + if (!User) + return + + var/output = {"