Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Ready for Testmerge] Implement Diagonal Movement #11358

Merged
merged 44 commits into from
Jul 12, 2019
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
2068ca0
Update mob_movement.dm
Couls Apr 22, 2019
7eb7d72
Implement keybinding system and remove old hotkey modes
Couls Apr 23, 2019
40729f2
spessing and fix compile errors
Couls Apr 23, 2019
317e0ac
SQL entry for hotkey mode
Couls Apr 23, 2019
a188a6b
change some move procs
Couls Apr 23, 2019
09ba038
Remove repeat defines and fix focus
Couls Apr 23, 2019
4921405
make clients inherit from datums
Couls Apr 23, 2019
896340e
Use our quick equip instead of TGs implementation(for my sake) also a…
Couls Apr 24, 2019
6917aec
Fix numpad targetting
Couls Apr 24, 2019
a8db26d
Merge remote-tracking branch 'upstream/master' into diagonal-movement
Couls Apr 26, 2019
5b8c344
Fix resting
Couls Apr 26, 2019
69cbb67
Update preferences_toggles.dm
Couls Apr 26, 2019
5903ad2
Implement AZERTY and numpad targetting options
Couls Apr 26, 2019
c2028e9
Change reverse_dir to not cause a runtime when moving diagonal
Couls Apr 26, 2019
5f492e8
Update interface.dm
Couls Apr 26, 2019
374eda6
Add in debug for input subsystem
Couls Apr 26, 2019
21f5aec
Update client procs.dm
Couls Apr 27, 2019
7cd783c
Change move proc to support diagonal movement(no more slipping over s…
Couls Apr 27, 2019
4826ea1
more fixes and formatting
Couls Apr 27, 2019
39dd7c3
Moving diagonal in pipes no longer ejects you
Couls Apr 27, 2019
fff65f3
Code cleanup time!
Couls Apr 28, 2019
fb61964
Resolve conflicts
Couls May 4, 2019
7860db2
Merge branch 'master' into diagonal-movement
Couls May 4, 2019
fe68c74
Merge branch 'master' into diagonal-movement
Couls May 22, 2019
cdb8674
use \ref until I can figure something out for UID
Couls May 22, 2019
5979166
Merge remote-tracking branch 'upstream/master' into diagonal-movement
Couls Jun 3, 2019
68f8ccf
Merge remote-tracking branch 'upstream/master' into diagonal-movement
Couls Jun 3, 2019
f458485
oops
Couls Jun 3, 2019
e222a1f
Merge remote-tracking branch 'upstream/master' into diagonal-movement
Couls Jun 4, 2019
e3a1984
Merge remote-tracking branch 'upstream/master' into diagonal-movement
Couls Jun 22, 2019
411a6ec
some more tweaks
Couls Jul 1, 2019
33d35eb
Merge branch 'master' into diagonal-movement
Couls Jul 2, 2019
a7b4e0b
Merge remote-tracking branch 'upstream/master' into diagonal-movement
Couls Jul 8, 2019
cee64d5
Merge remote-tracking branch 'upstream/master' into diagonal-movement
Couls Jul 8, 2019
4a832c4
Fix testmerge issues
Couls Jul 8, 2019
6c8fc34
bitflag hotfix
Couls Jul 9, 2019
510181d
Update preferences.dm
Couls Jul 9, 2019
e16b495
More testmerge fixes and improvements
Couls Jul 9, 2019
2d7f2bb
Code cleanup, spacing fixes
Couls Jul 9, 2019
7b102e2
Remove unused winsets
Couls Jul 11, 2019
147f740
Improve diagonal pulling
Couls Jul 11, 2019
3625662
SQL changes
Couls Jul 11, 2019
b0ec92d
update prefixed schema as well
Couls Jul 11, 2019
b11a80b
Update misc.dm
Couls Jul 12, 2019
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
54 changes: 54 additions & 0 deletions code/__DEFINES/colors.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@

#define COLOR_INPUT_DISABLED "#F0F0F0"
Couls marked this conversation as resolved.
Show resolved Hide resolved
#define COLOR_INPUT_ENABLED "#D3B5B5"
#define COLOR_WHITE "#EEEEEE"
#define COLOR_SILVER "#C0C0C0"
#define COLOR_GRAY "#808080"
#define COLOR_FLOORTILE_GRAY "#8D8B8B"
#define COLOR_ALMOST_BLACK "#333333"
#define COLOR_BLACK "#000000"
#define COLOR_RED "#FF0000"
#define COLOR_RED_LIGHT "#FF3333"
#define COLOR_MAROON "#800000"
#define COLOR_YELLOW "#FFFF00"
#define COLOR_OLIVE "#808000"
#define COLOR_LIME "#32CD32"
#define COLOR_GREEN "#008000"
#define COLOR_CYAN "#00FFFF"
#define COLOR_TEAL "#008080"
#define COLOR_BLUE "#0000FF"
#define COLOR_BLUE_LIGHT "#33CCFF"
#define COLOR_NAVY "#000080"
#define COLOR_PINK "#FFC0CB"
#define COLOR_MAGENTA "#FF00FF"
#define COLOR_PURPLE "#800080"
#define COLOR_ORANGE "#FF9900"
#define COLOR_BEIGE "#CEB689"
#define COLOR_BLUE_GRAY "#75A2BB"
#define COLOR_BROWN "#BA9F6D"
#define COLOR_DARK_BROWN "#997C4F"
#define COLOR_DARK_ORANGE "#C3630C"
#define COLOR_GREEN_GRAY "#99BB76"
#define COLOR_RED_GRAY "#B4696A"
#define COLOR_PALE_BLUE_GRAY "#98C5DF"
#define COLOR_PALE_GREEN_GRAY "#B7D993"
#define COLOR_PALE_RED_GRAY "#D59998"
#define COLOR_PALE_PURPLE_GRAY "#CBB1CA"
#define COLOR_PURPLE_GRAY "#AE8CA8"

//Color defines used by the assembly detailer.
#define COLOR_ASSEMBLY_BLACK "#545454"
#define COLOR_ASSEMBLY_BGRAY "#9497AB"
#define COLOR_ASSEMBLY_WHITE "#E2E2E2"
#define COLOR_ASSEMBLY_RED "#CC4242"
#define COLOR_ASSEMBLY_ORANGE "#E39751"
#define COLOR_ASSEMBLY_BEIGE "#AF9366"
#define COLOR_ASSEMBLY_BROWN "#97670E"
#define COLOR_ASSEMBLY_GOLD "#AA9100"
#define COLOR_ASSEMBLY_YELLOW "#CECA2B"
#define COLOR_ASSEMBLY_GURKHA "#999875"
#define COLOR_ASSEMBLY_LGREEN "#789876"
#define COLOR_ASSEMBLY_GREEN "#44843C"
#define COLOR_ASSEMBLY_LBLUE "#5D99BE"
#define COLOR_ASSEMBLY_BLUE "#38559E"
#define COLOR_ASSEMBLY_PURPLE "#6F6192"
20 changes: 20 additions & 0 deletions code/__DEFINES/combat.dm
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@
#define ATTACK_EFFECT_MECHFIRE "mech_fire"
#define ATTACK_EFFECT_MECHTOXIN "mech_toxin"
#define ATTACK_EFFECT_BOOP "boop" //Honk
//NOTE: INTENT_HOTKEY_* defines are not actual intents!
//they are here to support hotkeys
#define INTENT_HOTKEY_LEFT "left"
#define INTENT_HOTKEY_RIGHT "right"

//Embedded objects
#define EMBEDDED_PAIN_CHANCE 15 //Chance for embedded objects to cause pain (damage user)
Expand All @@ -88,6 +92,22 @@
#define EMBEDDED_UNSAFE_REMOVAL_PAIN_MULTIPLIER 8 //Coefficient of multiplication for the damage the item does when removed without a surgery (this*item.w_class)
#define EMBEDDED_UNSAFE_REMOVAL_TIME 30 //A Time in ticks, total removal time = (this*item.w_class)

// Body Parts
#define BODY_ZONE_HEAD "head"
#define BODY_ZONE_CHEST "chest"
#define BODY_ZONE_L_ARM "l_arm"
#define BODY_ZONE_R_ARM "r_arm"
#define BODY_ZONE_L_LEG "l_leg"
#define BODY_ZONE_R_LEG "r_leg"

#define BODY_ZONE_PRECISE_EYES "eyes"
#define BODY_ZONE_PRECISE_MOUTH "mouth"
#define BODY_ZONE_PRECISE_GROIN "groin"
#define BODY_ZONE_PRECISE_L_HAND "l_hand"
#define BODY_ZONE_PRECISE_R_HAND "r_hand"
#define BODY_ZONE_PRECISE_L_FOOT "l_foot"
#define BODY_ZONE_PRECISE_R_FOOT "r_foot"

//Gun Stuff
#define SAWN_INTACT 0
#define SAWN_OFF 1
Expand Down
5 changes: 5 additions & 0 deletions code/__DEFINES/flags.dm
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
#define ALL ~0 //For convenience.
#define NONE 0

// for /datum/var/datum_flags
#define DF_USE_TAG (1<<0)
#define DF_VAR_EDITED (1<<1)
#define DF_ISPROCESSING (1<<2)
Couls marked this conversation as resolved.
Show resolved Hide resolved

Couls marked this conversation as resolved.
Show resolved Hide resolved
//FLAGS BITMASK
#define STOPSPRESSUREDMAGE 1 //This flag is used on the flags variable for SUIT and HEAD items which stop pressure damage. Note that the flag 1 was previous used as ONBACK, so it is possible for some code to use (flags & 1) when checking if something can be put on your back. Replace this code with (inv_flags & SLOT_BACK) if you see it anywhere To successfully stop you taking all pressure damage you must have both a suit and head item with this flag.
#define NODROP 2 // This flag makes it so that an item literally cannot be removed at all, or at least that's how it should be. Only deleted.
Expand Down
11 changes: 0 additions & 11 deletions code/__DEFINES/misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,6 @@
#define MAX_STACK_AMOUNT_GLASS 50
#define MAX_STACK_AMOUNT_RODS 60

//some colors
#define COLOR_RED "#FF0000"
#define COLOR_GREEN "#00FF00"
#define COLOR_BLUE "#0000FF"
#define COLOR_CYAN "#00FFFF"
#define COLOR_PINK "#FF00FF"
#define COLOR_YELLOW "#FFFF00"
#define COLOR_ORANGE "#FF9900"
#define COLOR_WHITE "#FFFFFF"
#define COLOR_GRAY "#808080"

//FONTS:
// Used by Paper and PhotoCopier (and PaperBin once a year).
// Used by PDA's Notekeeper.
Expand Down
6 changes: 3 additions & 3 deletions code/__DEFINES/preferences.dm
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@
#define UI_DARKMODE 131072
#define DISABLE_KARMA 262144
#define CHAT_NO_MENTORTICKETLOGS 524288

Couls marked this conversation as resolved.
Show resolved Hide resolved
#define TYPING_ONCE 1048576

#define TOGGLES_DEFAULT (CHAT_OOC|CHAT_DEAD|CHAT_GHOSTEARS|CHAT_GHOSTSIGHT|CHAT_PRAYER|CHAT_RADIO|CHAT_LOOC|MEMBER_PUBLIC|DONATOR_PUBLIC)
#define NUMPAD_TARGET 2097512
#define AZERTY 4194304
#define TOGGLES_DEFAULT (CHAT_OOC|CHAT_DEAD|CHAT_GHOSTEARS|CHAT_GHOSTSIGHT|CHAT_PRAYER|CHAT_RADIO|CHAT_LOOC|MEMBER_PUBLIC|DONATOR_PUBLIC|NUMPAD_TARGET)

// Admin attack logs filter system, see /proc/add_attack_logs and /proc/msg_admin_attack
#define ATKLOG_ALL 0
Expand Down
16 changes: 8 additions & 8 deletions code/__HELPERS/pronouns.dm
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
. = "e[.]"

//like clients, which do have gender.
/client/proc/p_they(capitalized, temp_gender)
/client/p_they(capitalized, temp_gender)
if(!temp_gender)
temp_gender = gender
. = "they"
Expand All @@ -55,7 +55,7 @@
if(capitalized)
. = capitalize(.)

/client/proc/p_their(capitalized, temp_gender)
/client/p_their(capitalized, temp_gender)
if(!temp_gender)
temp_gender = gender
. = "their"
Expand All @@ -67,7 +67,7 @@
if(capitalized)
. = capitalize(.)

/client/proc/p_them(capitalized, temp_gender)
/client/p_them(capitalized, temp_gender)
if(!temp_gender)
temp_gender = gender
. = "them"
Expand All @@ -79,35 +79,35 @@
if(capitalized)
. = capitalize(.)

/client/proc/p_have(temp_gender)
/client/p_have(temp_gender)
if(!temp_gender)
temp_gender = gender
. = "has"
if(temp_gender == PLURAL || temp_gender == NEUTER)
. = "have"

/client/proc/p_are(temp_gender)
/client/p_are(temp_gender)
if(!temp_gender)
temp_gender = gender
. = "is"
if(temp_gender == PLURAL || temp_gender == NEUTER)
. = "are"

/client/proc/p_were(temp_gender)
/client/p_were(temp_gender)
if(!temp_gender)
temp_gender = gender
. = "was"
if(temp_gender == PLURAL || temp_gender == NEUTER)
. = "were"

/client/proc/p_do(temp_gender)
/client/p_do(temp_gender)
if(!temp_gender)
temp_gender = gender
. = "does"
if(temp_gender == PLURAL || temp_gender == NEUTER)
. = "do"

/client/proc/p_s(temp_gender)
/client/p_s(temp_gender)
if(!temp_gender)
temp_gender = gender
if(temp_gender != PLURAL && temp_gender != NEUTER)
Expand Down
11 changes: 11 additions & 0 deletions code/__HELPERS/type2type.dm
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,17 @@
if(degree < 315) return WEST
return NORTH|WEST

/proc/angle2dir_cardinal(angle)
switch(round(angle, 0.1))
if(315.5 to 360, 0 to 45.5)
return NORTH
if(45.6 to 135.5)
return EAST
if(135.6 to 225.5)
return SOUTH
if(225.6 to 315.5)
return WEST

//returns the north-zero clockwise angle in degrees, given a direction

/proc/dir2angle(var/D)
Expand Down
4 changes: 2 additions & 2 deletions code/__HELPERS/unique_ids.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

var/global/next_unique_datum_id = 1

/client/var/tmp/unique_datum_id = null
// /client/var/tmp/unique_datum_id = null

/datum/proc/UID()
if(!unique_datum_id)
Expand All @@ -26,7 +26,7 @@ var/global/next_unique_datum_id = 1
tag = tag_backup
return unique_datum_id

/client/proc/UID()
/client/UID()
Couls marked this conversation as resolved.
Show resolved Hide resolved
if(!unique_datum_id)
unique_datum_id = "\ref[src]_[next_unique_datum_id++]"
return unique_datum_id
Expand Down
14 changes: 14 additions & 0 deletions code/__HELPERS/unsorted.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2029,3 +2029,17 @@ var/mob/dview/dview_mob = new

/proc/pass()
return

// \ref behaviour got changed in 512 so this is necesary to replicate old behaviour.
// If it ever becomes necesary to get a more performant REF(), this lies here in wait
// #define REF(thing) (thing && istype(thing, /datum) && (thing:datum_flags & DF_USE_TAG) && thing:tag ? "[thing:tag]" : "\ref[thing]")
/proc/REF(input)
Copy link
Member

@Fox-McCloud Fox-McCloud Apr 27, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we use UID instead of REF

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved the code for this under UID can you make sure what I did won't break anything? I tested it for a bit and it didn't seem to break anything major

if(istype(input, /datum))
var/datum/thing = input
if(thing.datum_flags & DF_USE_TAG)
if(!thing.tag)
stack_trace("A ref was requested of an object with DF_USE_TAG set but no tag: [thing]")
thing.datum_flags &= ~DF_USE_TAG
else
return "\[[url_encode(thing.tag)]\]"
return "\ref[input]"
120 changes: 120 additions & 0 deletions code/controllers/subsystem/input.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
SUBSYSTEM_DEF(input)
name = "Input"
wait = 1 //SS_TICKER means this runs every tick
init_order = INIT_ORDER_INPUT
flags = SS_TICKER
priority = FIRE_PRIORITY_INPUT
runlevels = RUNLEVELS_DEFAULT | RUNLEVEL_LOBBY

var/list/macro_sets
var/list/movement_keys
var/list/alt_movement_keys

/datum/controller/subsystem/input/Initialize()
setup_default_macro_sets()

setup_default_movement_keys()

initialized = TRUE

refresh_client_macro_sets()

return ..()

// This is for when macro sets are eventualy datumized
/datum/controller/subsystem/input/proc/setup_default_macro_sets()
var/list/static/default_macro_sets

if(default_macro_sets)
macro_sets = default_macro_sets
return

default_macro_sets = list(
"default" = list(
"Tab" = "\".winset \\\"input.focus=true?map.focus=true input.background-color=[COLOR_INPUT_DISABLED]:input.focus=true input.background-color=[COLOR_INPUT_ENABLED]\\\"\"",
"O" = "ooc",
"T" = "say",
"M" = "me",
"Back" = "\".winset \\\"input.text=\\\"\\\"\\\"\"", // This makes it so backspace can remove default inputs
"Any" = "\"KeyDown \[\[*\]\]\"",
"Any+UP" = "\"KeyUp \[\[*\]\]\"",
),
"old_default" = list(
"Tab" = "\".winset \\\"mainwindow.macro=old_hotkeys map.focus=true input.background-color=[COLOR_INPUT_DISABLED]\\\"\"",
"Ctrl+T" = "say",
"Ctrl+O" = "ooc",
),
"old_hotkeys" = list(
"Tab" = "\".winset \\\"mainwindow.macro=old_default input.focus=true input.background-color=[COLOR_INPUT_ENABLED]\\\"\"",
"O" = "ooc",
"T" = "say",
"M" = "me",
"Back" = "\".winset \\\"input.text=\\\"\\\"\\\"\"", // This makes it so backspace can remove default inputs
"Any" = "\"KeyDown \[\[*\]\]\"",
"Any+UP" = "\"KeyUp \[\[*\]\]\"",
),
)

// Because i'm lazy and don't want to type all these out twice
var/list/old_default = default_macro_sets["old_default"]

var/list/static/oldmode_keys = list(
"North", "East", "South", "West",
"Northeast", "Southeast", "Northwest", "Southwest",
"Insert", "Delete", "Ctrl", "Alt",
"F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12",
)

for(var/i in 1 to oldmode_keys.len)
var/key = oldmode_keys[i]
old_default[key] = "\"KeyDown [key]\""
old_default["[key]+UP"] = "\"KeyUp [key]\""

var/list/static/oldmode_ctrl_override_keys = list(
"W" = "W", "A" = "A", "S" = "S", "D" = "D", // movement
"1" = "1", "2" = "2", "3" = "3", "4" = "4", // intent
"B" = "B", // resist
"E" = "E", // quick equip
"F" = "F", // intent left
"G" = "G", // intent right
"H" = "H", // stop pulling
"Q" = "Q", // drop
"R" = "R", // throw
"X" = "X", // switch hands
"Y" = "Y", // activate item
"Z" = "Z", // activate item
)

for(var/i in 1 to oldmode_ctrl_override_keys.len)
var/key = oldmode_ctrl_override_keys[i]
var/override = oldmode_ctrl_override_keys[key]
old_default["Ctrl+[key]"] = "\"KeyDown [override]\""
old_default["Ctrl+[key]+UP"] = "\"KeyUp [override]\""

macro_sets = default_macro_sets

// For initially setting up or resetting to default the movement keys
/datum/controller/subsystem/input/proc/setup_default_movement_keys()
var/static/list/default_movement_keys = list(
"W" = NORTH, "A" = WEST, "S" = SOUTH, "D" = EAST, // WASD
"North" = NORTH, "West" = WEST, "South" = SOUTH, "East" = EAST, // Arrow keys & Numpad
)
var/static/list/azerty_movement_keys = list(
"Z" = NORTH, "Q" = WEST, "S" = SOUTH, "D" = EAST, // WASD
"North" = NORTH, "West" = WEST, "South" = SOUTH, "East" = EAST, // Arrow keys & Numpad
)
movement_keys = default_movement_keys.Copy()
alt_movement_keys = azerty_movement_keys.Copy()

// Badmins just wanna have fun ♪
/datum/controller/subsystem/input/proc/refresh_client_macro_sets()
var/list/clients = GLOB.clients
for(var/i in 1 to clients.len)
var/client/user = clients[i]
user.set_macros()

/datum/controller/subsystem/input/fire()
var/list/clients = GLOB.clients // Let's sing the list cache song
for(var/i in 1 to clients.len)
var/client/C = clients[i]
C.keyLoop()
5 changes: 4 additions & 1 deletion code/controllers/verbs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

/client/proc/debug_controller(controller in list("failsafe","Scheduler","StonedMaster","Ticker","Air","Jobs","Sun","Radio","Configuration","pAI",
"Cameras","Garbage", "Transfer Controller","Event","Alarm","Nano","Vote","Fires",
"Mob","NPC AI","Shuttle","Timer","Weather","Space","Mob Hunt Server"))
"Mob","NPC AI","Shuttle","Timer","Weather","Space","Mob Hunt Server","Input"))
set category = "Debug"
set name = "Debug Controller"
set desc = "Debug the various periodic loop controllers for the game (be careful!)"
Expand Down Expand Up @@ -98,6 +98,9 @@
if("Mob Hunt Server")
debug_variables(SSmob_hunt)
feedback_add_details("admin_verb","DMobHuntServer")
if("Input")
debug_variables(SSinput)
feedback_add_details("admin_verb","DInput")

message_admins("Admin [key_name_admin(usr)] is debugging the [controller] controller.")
return
Loading