Skip to content

Commit

Permalink
Language datums; removes the talk wheel (tgstation#25333)
Browse files Browse the repository at this point in the history
* Initial burst of languages

* Scratchings of beginnings

* Code review I

* Compilation!

* You can now understand your own speech

* Fixes whispering

* Gets typecaches working again

* Remie's `PASS`ing

* Back to pass() to stop the compiler whining

* Why can't drones check their languages

* Everyone speaks how they should

* Removes world string debug stuff

* Currently failing to massage radio code into working

* The radio transmits the languages!

* ,0 to talk common

* Replaces speech wheel with language menu

* Observers can speak all languages

* pAIs now speak languages FOREVER

* New action button for language menu

* pAIs have an action button to open their language menu

* AIs can talk and all that

* AIs have a language menu button

* Fixes supermatter making strange noises

* Fixes AI holopads

* Fixes request consoles

* Fixes bots making strange sounds

* Meaningless MMI change

* Some caching of datums

* Brains in MMIs speak common

* Ratvarian AIs can only speak Ratvarian

* Tables can speak common, apparently

* Removes var in args

* Fixes the (AI Eye) problem

Thanks to Shadowmobile for their help with this one.

* Fixes tape recorders

* Fixes humans being able to speak in languages they did not know

* Adds some new posibrain names

Honk.

* The voice analyzer replies in the language you spoke to it

* Gives swarmers only swarmer language

* `initial_languages` var.

* OMNITONGUE, clockwork restrictions

* Fixes barmaid and bardrone language abilities

* Code review I

* Omnitongue correction

* Code review II

* Removes force_compose var
  • Loading branch information
coiax authored and AnturK committed Apr 2, 2017
1 parent f36ee3a commit 7554b5f
Show file tree
Hide file tree
Showing 107 changed files with 941 additions and 707 deletions.
22 changes: 8 additions & 14 deletions code/__DEFINES/flags.dm
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@
#define INFORM_ADMINS_ON_RELOCATE "inform_admins_on_relocate"
#define BANG_PROTECT "bang_protect"

// A mob with OMNITONGUE has no restriction in the ability to speak
// languages that they know. So even if they wouldn't normally be able to
// through mob or tongue restrictions, this flag allows them to ignore
// those restrictions.
#define OMNITONGUE "omnitongue"

//turf-only flags
#define NOJAUNT 1
#define UNUSED_TRANSIT_TURF 2
Expand All @@ -60,20 +66,6 @@
#define GROUND 1
#define FLYING 2


/*
These defines are used specifically with the atom/movable/languages bitmask.
They are used in atom/movable/Hear() and atom/movable/say() to determine whether hearers can understand a message.
*/
#define HUMAN 1
#define MONKEY 2
#define ALIEN 4
#define ROBOT 8
#define SLIME 16
#define DRONE 32
#define SWARMER 64
#define RATVAR 128

// Flags for reagents
#define REAGENT_NOREACT 1

Expand All @@ -85,3 +77,5 @@
#define UNACIDABLE 16 //acid can't even appear on it, let alone melt it.
#define ACID_PROOF 32 //acid stuck on it doesn't melt it.
#define INDESTRUCTIBLE 64 //doesn't take damage

// language secondary flags for atoms
2 changes: 2 additions & 0 deletions code/__DEFINES/language.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#define NO_STUTTER 1
#define TONGUELESS_SPEECH 2
5 changes: 4 additions & 1 deletion code/__HELPERS/_lists.dm
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@
if(!L || !L.len || !A)

return 0
return L[A.type]
if(ispath(A))
. = L[A]
else
. = L[A.type]

//Checks for a string in a list
/proc/is_string_in_list(string, list/L)
Expand Down
1 change: 1 addition & 0 deletions code/__HELPERS/flags.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#define HAS_SECONDARY_FLAG(atom, sflag) (atom.secondary_flags ? atom.secondary_flags[sflag] : FALSE)
#define SET_SECONDARY_FLAG(atom, sflag) if(!atom.secondary_flags) { atom.secondary_flags = list(); } atom.secondary_flags[sflag] = TRUE;
#define CLEAR_SECONDARY_FLAG(atom, sflag) if(atom.secondary_flags) atom.secondary_flags[sflag] = null
#define TOGGLE_SECONDARY_FLAG(atom, sflag) if(HAS_SECONDARY_FLAG(atom, sflag)) { CLEAR_SECONDARY_FLAG(atom, sflag); } else {SET_SECONDARY_FLAG(atom, sflag) ; }
3 changes: 3 additions & 0 deletions code/__HELPERS/unsorted.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1429,3 +1429,6 @@ var/valid_HTTPSGet = FALSE

/proc/to_chat(target, message)
target << message

/proc/pass()
return
3 changes: 2 additions & 1 deletion code/_globalvars/lists/mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ var/global/list/dead_mob_list = list() //all dead mobs, including clientless.
var/global/list/joined_player_list = list() //all clients that have joined the game at round-start or as a latejoin.
var/global/list/silicon_mobs = list() //all silicon mobs
var/global/list/pai_list = list()
var/global/list/available_ai_shells = list()
var/global/list/available_ai_shells = list()
var/global/list/language_datums = list()
1 change: 1 addition & 0 deletions code/_globalvars/lists/names.dm
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ var/list/mime_names = file2list("config/names/mime.txt")
var/list/carp_names = file2list("config/names/carp.txt")
var/list/golem_names = file2list("config/names/golem.txt")
var/list/plasmaman_names = file2list("config/names/plasmaman.txt")
var/list/posibrain_names = list("PBU","HIU","SINA","ARMA","OSI","HBL","MSO","RR","CHRI","CDB","HG","XSI","ORNG","GUN","KOR","MET","FRE","XIS","SLI","PKP","HOG","RZH","GOOF","MRPR","JJR","FIRC","INC","PHL","BGB","ANTR","MIW","WJ","JRD","CHOC","ANCL","JLLO","JNLG","KOS","TKRG","XAL","STLP","CBOS","DUNC","FXMC","DRSD","COI")


var/list/verbs = file2list("config/names/verbs.txt")
Expand Down
5 changes: 3 additions & 2 deletions code/_onclick/hud/_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#define ui_lingstingdisplay "WEST:6,CENTER-3:11"
#define ui_crafting "12:-10,1:5"
#define ui_building "12:-10,1:21"
#define ui_language_menu "11:6,2:-11"

#define ui_devilsouldisplay "WEST:6,CENTER-1:15"

Expand Down Expand Up @@ -61,7 +62,7 @@
#define ui_borg_store "CENTER+2:16,SOUTH:5" //borgs
#define ui_borg_camera "CENTER+3:21,SOUTH:5" //borgs
#define ui_borg_album "CENTER+4:21,SOUTH:5" //borgs
#define ui_borg_talk_wheel "CENTER+4:21,SOUTH+1:5" //borgs
#define ui_borg_language_menu "CENTER+4:21,SOUTH+1:5" //borgs

#define ui_monkey_head "CENTER-4:13,SOUTH:5" //monkey
#define ui_monkey_mask "CENTER-3:14,SOUTH:5" //monkey
Expand All @@ -70,7 +71,7 @@

#define ui_alien_storage_l "CENTER-2:14,SOUTH:5"//alien
#define ui_alien_storage_r "CENTER+1:18,SOUTH:5"//alien
#define ui_alien_talk_wheel "EAST-3:26,SOUTH:5" //alien
#define ui_alien_language_menu "EAST-3:26,SOUTH:5" //alien

#define ui_drone_drop "CENTER+1:18,SOUTH:5" //maintenance drones
#define ui_drone_pull "CENTER+2:2,SOUTH:5" //maintenance drones
Expand Down
5 changes: 5 additions & 0 deletions code/_onclick/hud/ai.dm
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,11 @@
..()
var/obj/screen/using

// Language menu
using = new /obj/screen/language_menu
using.screen_loc = ui_borg_language_menu
static_inventory += using

//AI core
using = new /obj/screen/ai/aicore()
using.screen_loc = ui_ai_core
Expand Down
5 changes: 2 additions & 3 deletions code/_onclick/hud/alien.dm
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,8 @@
H.leap_icon.screen_loc = ui_alien_storage_r
static_inventory += H.leap_icon

using = new/obj/screen/wheel/talk
using.screen_loc = ui_alien_talk_wheel
wheels += using
using = new/obj/screen/language_menu
using.screen_loc = ui_alien_language_menu
static_inventory += using

using = new /obj/screen/drop()
Expand Down
5 changes: 2 additions & 3 deletions code/_onclick/hud/alien_larva.dm
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@
pull_icon.screen_loc = ui_pull_resist
hotkeybuttons += pull_icon

using = new/obj/screen/wheel/talk
using.screen_loc = ui_alien_talk_wheel
wheels += using
using = new/obj/screen/language_menu
using.screen_loc = ui_alien_language_menu
static_inventory += using

zone_select = new /obj/screen/zone_sel/alien()
Expand Down
14 changes: 0 additions & 14 deletions code/_onclick/hud/hud.dm
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@
var/obj/screen/throw_icon
var/obj/screen/module_store_icon

var/list/wheels = list() //list of the wheel screen objects

var/list/static_inventory = list() //the screen objects which are static
var/list/toggleable_inventory = list() //the screen objects which can be hidden
var/list/obj/screen/hotkeybuttons = list() //the buttons that can be used via hotkeys
Expand Down Expand Up @@ -78,8 +76,6 @@
qdel(module_store_icon)
module_store_icon = null

wheels = null //all wheels are also in static_inventory

if(static_inventory.len)
for(var/thing in static_inventory)
qdel(thing)
Expand Down Expand Up @@ -226,16 +222,6 @@
/datum/hud/proc/persistent_inventory_update(mob/viewer)
if(!mymob)
return
var/mob/living/L = mymob

var/mob/screenmob = viewer || L

for(var/X in wheels)
var/obj/screen/wheel/W = X
if(W.toggled)
screenmob.client.screen |= W.buttons_list
else
screenmob.client.screen -= W.buttons_list

//Triggered when F12 is pressed (Unless someone changed something in the DMF)
/mob/verb/button_pressed_F12()
Expand Down
3 changes: 1 addition & 2 deletions code/_onclick/hud/human.dm
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,8 @@
using.icon = ui_style
static_inventory += using

using = new/obj/screen/wheel/talk
using = new/obj/screen/language_menu
using.icon = ui_style
wheels += using
static_inventory += using

using = new /obj/screen/area_creator
Expand Down
3 changes: 1 addition & 2 deletions code/_onclick/hud/monkey.dm
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@
using.screen_loc = ui_movi
static_inventory += using

using = new/obj/screen/wheel/talk
using = new/obj/screen/language_menu
using.icon = ui_style
wheels += using
static_inventory += using

using = new /obj/screen/drop()
Expand Down
5 changes: 2 additions & 3 deletions code/_onclick/hud/robot.dm
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,8 @@
var/mob/living/silicon/robot/mymobR = mymob
var/obj/screen/using

using = new/obj/screen/wheel/talk
using.screen_loc = ui_borg_talk_wheel
wheels += using
using = new/obj/screen/language_menu
using.screen_loc = ui_borg_language_menu
static_inventory += using

//Radio
Expand Down
149 changes: 12 additions & 137 deletions code/_onclick/hud/screen_objects.dm
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,18 @@
return 1
create_area(usr)

/obj/screen/language_menu
name = "language menu"
icon = 'icons/mob/screen_midnight.dmi'
icon_state = "talk_wheel"
screen_loc = ui_language_menu

/obj/screen/language_menu/Click()
var/mob/living/L = usr
if(!istype(L))
return
L.open_language_menu(usr)

/obj/screen/inventory
var/slot_id // The indentifier for the slot. It has nothing to do with ID cards.
var/icon_empty // Icon when empty. For now used only by humans.
Expand Down Expand Up @@ -529,143 +541,6 @@
name = "health doll"
screen_loc = ui_healthdoll



/obj/screen/wheel
name = "wheel"
layer = HUD_LAYER
plane = HUD_PLANE
icon_state = ""
screen_loc = null //if you make a new wheel, remember to give it a screen_loc
var/list/buttons_names = list() //list of the names for each button, its length is the amount of buttons.
var/toggled = 0 //wheel is hidden/shown
var/wheel_buttons_type //the type of buttons used with this wheel.
var/list/buttons_list = list()

/obj/screen/wheel/New()
..()
build_options()


//we create the buttons for the wheel and place them in a square spiral fashion.
/obj/screen/wheel/proc/build_options()
var/obj/screen/wheel_button/close_wheel/CW = new ()
buttons_list += CW //the close option
CW.wheel = src

var/list/offset_x_list = list()
var/list/offset_y_list = list()
var/num = 1
var/N = 1
var/M = 0
var/sign = -1
my_loop:
while(offset_y_list.len < buttons_names.len)
for(var/i=1, i<=num, i++)
offset_y_list += N
offset_x_list += M
if(offset_y_list.len == buttons_names.len)
break my_loop
if(N != 0)
N = 0
M = -sign
else
N = sign
M = 0
sign = -sign
num++

var/screenx = 8
var/screeny = 8
for(var/i = 1, i <= buttons_names.len, i++)
var/obj/screen/wheel_button/WB = new wheel_buttons_type()
WB.wheel = src
buttons_list += WB
screenx += offset_x_list[i]
screeny += offset_y_list[i]
WB.screen_loc = "[screenx], [screeny]"
set_button(WB, i)

/obj/screen/wheel/proc/set_button(obj/screen/wheel_button/WB, button_number)
WB.name = buttons_names[button_number]
return

/obj/screen/wheel/Destroy()
for(var/obj/screen/S in buttons_list)
qdel(S)
return ..()

/obj/screen/wheel/Click()
if(world.time <= usr.next_move)
return
if(usr.stat)
return
if(isliving(usr))
var/mob/living/L = usr
if(toggled)
L.client.screen -= buttons_list
else
L.client.screen |= buttons_list
toggled = !toggled


/obj/screen/wheel/talk
name = "talk wheel"
icon_state = "talk_wheel"
screen_loc = "11:6,2:-11"
wheel_buttons_type = /obj/screen/wheel_button/talk
buttons_names = list("help","hello","bye","stop","thanks","come","out", "yes", "no")
var/list/word_messages = list(list("Help!","Help me!"), list("Hello.", "Hi."), list("Bye.", "Goodbye."),\
list("Stop!", "Halt!"), list("Thanks.", "Thanks!", "Thank you."), \
list("Come.", "Follow me."), list("Out!", "Go away!", "Get out!"), \
list("Yes.", "Affirmative."), list("No.", "Negative"))

/obj/screen/wheel/talk/set_button(obj/screen/wheel_button/WB, button_number)
..()
var/obj/screen/wheel_button/talk/T = WB //we already know what type the button is exactly.
T.icon_state = "talk_[T.name]"
T.word_messages = word_messages[button_number]


/obj/screen/wheel_button
name = "default wheel button"
screen_loc = "8,8"
layer = HUD_LAYER
plane = HUD_PLANE
mouse_opacity = 2
var/obj/screen/wheel/wheel

/obj/screen/wheel_button/Destroy()
wheel = null
return ..()

/obj/screen/wheel_button/close_wheel
name = "close wheel"
icon_state = "x3"

/obj/screen/wheel_button/close_wheel/Click()
if(isliving(usr))
var/mob/living/L = usr
L.client.screen -= wheel.buttons_list
wheel.toggled = !wheel.toggled


/obj/screen/wheel_button/talk
name = "talk option"
icon_state = "talk_help"
var/talk_cooldown = 0
var/list/word_messages = list()

/obj/screen/wheel_button/talk/Click(location, control,params)
if(isliving(usr))
var/mob/living/L = usr
if(L.stat)
return

if(word_messages.len && talk_cooldown < world.time)
talk_cooldown = world.time + 10
L.say(pick(word_messages))

/obj/screen/splash
icon = 'config/title_screens/images/blank.png'
icon_state = ""
Expand Down
13 changes: 13 additions & 0 deletions code/datums/action.dm
Original file line number Diff line number Diff line change
Expand Up @@ -472,3 +472,16 @@
name = "Activate Jump Boots"
desc = "Activates the jump boot's internal propulsion system, allowing the user to dash over 4-wide gaps."
button_icon_state = "jetboot"

/datum/action/language_menu
name = "Language Menu"
desc = "Open the language menu to review your languages, their keys, and select your default language."
button_icon_state = "language_menu"
check_flags = 0

/datum/action/language_menu/Trigger()
if(!..())
return FALSE
if(isliving(owner))
var/mob/living/L = owner
L.open_language_menu(usr)
Loading

0 comments on commit 7554b5f

Please sign in to comment.