This repository has been archived by the owner on May 3, 2024. It is now read-only.
forked from SierraBay/SierraBay12
-
Notifications
You must be signed in to change notification settings - Fork 24
[TGUI] Orbit #90
Merged
Merged
[TGUI] Orbit #90
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/obj/screen/ghost | ||
icon = 'icons/mob/screen_ghost.dmi' | ||
|
||
/obj/screen/ghost/MouseEntered(location, control, params) | ||
. = ..() | ||
flick(icon_state + "_anim", src) | ||
|
||
/obj/screen/ghost/jumptomob | ||
name = "Jump to mob" | ||
icon_state = "jumptomob" | ||
screen_loc = ui_ghost_jumptomob | ||
|
||
/obj/screen/ghost/jumptomob/Click() | ||
var/mob/observer/ghost/G = usr | ||
G.jumptomob() | ||
|
||
/obj/screen/ghost/orbit | ||
name = "Orbit" | ||
icon_state = "orbit" | ||
screen_loc = ui_ghost_orbit | ||
|
||
/obj/screen/ghost/orbit/Click() | ||
var/mob/observer/ghost/G = usr | ||
G.follow() | ||
|
||
/obj/screen/ghost/reenter_corpse | ||
name = "Reenter corpse" | ||
icon_state = "reenter_corpse" | ||
screen_loc = ui_ghost_reenter_corpse | ||
|
||
/obj/screen/ghost/reenter_corpse/Click() | ||
var/mob/observer/ghost/G = usr | ||
G.reenter_corpse() | ||
|
||
/obj/screen/ghost/teleport | ||
name = "Teleport" | ||
icon_state = "teleport" | ||
screen_loc = ui_ghost_teleport | ||
|
||
/obj/screen/ghost/teleport/Click() | ||
var/mob/observer/ghost/G = usr | ||
G.dead_tele() | ||
|
||
/obj/screen/ghost/toggle_darkness | ||
name = "Toggle Darkness" | ||
icon_state = "toggle_darkness" | ||
screen_loc = ui_ghost_toggle_darkness | ||
|
||
/obj/screen/ghost/toggle_darkness/Click() | ||
var/mob/observer/ghost/G = usr | ||
G.toggle_darkness() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ var/global/list/image/ghost_sightless_images = list() //this is a list of images | |
var/is_manifest = FALSE | ||
var/next_visibility_toggle = 0 | ||
var/can_reenter_corpse | ||
var/thearea | ||
var/bootime = 0 | ||
var/started_as_observer //This variable is set to 1 when you enter the game as an observer. | ||
//If you died in the game and are a ghost - this will remain as null. | ||
|
@@ -154,6 +155,7 @@ Works together with spawning an observer, noted above. | |
ghost.key = key | ||
if(ghost.client && !ghost.client.holder && !config.antag_hud_allowed) // For new ghosts we remove the verb from even showing up if it's not allowed. | ||
ghost.verbs -= /mob/observer/ghost/verb/toggle_antagHUD // Poor guys, don't know what they are missing! | ||
ghost.add_ghost_buttons() | ||
return ghost | ||
|
||
/mob/observer/ghostize() // Do not create ghosts of ghosts. | ||
|
@@ -222,7 +224,16 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp | |
mind.current.reload_fullscreen() | ||
if(!admin_ghosted) | ||
announce_ghost_joinleave(mind, 0, "They now occupy their body again.") | ||
return 1 | ||
return TRUE | ||
|
||
/mob/observer/ghost/proc/jumptomob() | ||
var/mob/M = tgui_input_list(usr, "К кому вы хотите телепортироваться?", "Выбрать моба", SSmobs.mob_list) | ||
log_and_message_admins("jumped to [key_name(M)]") | ||
var/turf/T = get_turf(M) | ||
if(T && isturf(T)) | ||
jumpTo(T) | ||
else | ||
to_chat(usr, "Этот моб не находится в игровом мире.") | ||
|
||
/mob/observer/ghost/verb/toggle_medHUD() | ||
set category = "Ghost" | ||
|
@@ -231,10 +242,10 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp | |
if(!client) | ||
return | ||
if(medHUD) | ||
medHUD = 0 | ||
medHUD = FALSE | ||
to_chat(src, SPAN_NOTICE("Medical HUD Disabled")) | ||
else | ||
medHUD = 1 | ||
medHUD = TRUE | ||
to_chat(src, SPAN_NOTICE("Medical HUD Enabled")) | ||
|
||
/mob/observer/ghost/verb/toggle_antagHUD() | ||
|
@@ -264,11 +275,12 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp | |
M.antagHUD = 1 | ||
to_chat(src, SPAN_NOTICE("AntagHUD Enabled")) | ||
|
||
/mob/observer/ghost/verb/dead_tele(A in area_repository.get_areas_by_z_level()) | ||
/mob/observer/ghost/verb/dead_tele() | ||
set category = "Ghost" | ||
set name = "Teleport" | ||
set desc= "Teleport to a location" | ||
|
||
var/A = tgui_input_list(usr, "Выберите зону.", "Выбор зоны", area_repository.get_areas_by_z_level()) | ||
var/area/thearea = area_repository.get_areas_by_z_level()[A] | ||
if(!thearea) | ||
to_chat(src, "No area available.") | ||
|
@@ -291,13 +303,12 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp | |
ghost_to_turf(T) | ||
else | ||
to_chat(src, SPAN_WARNING("Invalid coordinates.")) | ||
/mob/observer/ghost/verb/follow(datum/follow_holder/fh in get_follow_targets()) | ||
/mob/observer/ghost/verb/follow() | ||
set category = "Ghost" | ||
set name = "Follow" | ||
set desc = "Follow and haunt a mob." | ||
|
||
if(!fh.show_entry()) return | ||
start_following(fh.followed_instance) | ||
GLOB.orbit_menu.show(src) | ||
|
||
/mob/observer/ghost/proc/ghost_to_turf(turf/target_turf) | ||
if(check_is_holy_turf(target_turf)) | ||
|
@@ -315,7 +326,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp | |
to_chat(src, SPAN_NOTICE("No longer following \the [following]")) | ||
..() | ||
|
||
/mob/observer/ghost/keep_following(atom/movable/am, old_loc, new_loc) | ||
/mob/observer/ghost/keep_following(obj/AM, old_loc, new_loc) | ||
var/turf/T = get_turf(new_loc) | ||
if(check_is_holy_turf(T)) | ||
to_chat(src, SPAN_WARNING("You cannot follow something standing on holy grounds!")) | ||
|
@@ -586,3 +597,15 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp | |
M.respawned_time = world.time | ||
M.key = key | ||
log_and_message_admins("has respawned.", M) | ||
|
||
/mob/observer/ghost/proc/add_ghost_buttons() | ||
var/jumptomob = new /obj/screen/ghost/jumptomob() | ||
var/orbit = new /obj/screen/ghost/orbit() | ||
var/reenter_corpse = new /obj/screen/ghost/reenter_corpse() | ||
var/teleport = new /obj/screen/ghost/teleport() | ||
var/toggle_darkness = new /obj/screen/ghost/toggle_darkness() | ||
client.screen.Add(jumptomob) | ||
client.screen.Add(orbit) | ||
client.screen.Add(reenter_corpse) | ||
client.screen.Add(teleport) | ||
client.screen.Add(toggle_darkness) | ||
Comment on lines
+601
to
+611
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Можно сделать статик лист типов кнопок и проходясь по нему, создавать экземпляры и давать клиенту There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Потом рефакторнем |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
GLOBAL_DATUM_INIT(orbit_menu, /datum/orbit_menu, new) | ||
|
||
/datum/orbit_menu | ||
|
||
/datum/orbit_menu/tgui_state(mob/user) | ||
return GLOB.tgui_observer_state | ||
|
||
/datum/orbit_menu/tgui_interact(mob/user, datum/tgui/ui) | ||
ui = SStgui.try_update_ui(user, src, ui) | ||
if(!ui) | ||
ui = new(user, src, "Orbit") | ||
ui.set_autoupdate(FALSE) | ||
ui.open() | ||
|
||
/datum/orbit_menu/tgui_act(action, list/params) | ||
if(..()) | ||
return | ||
. = TRUE | ||
|
||
switch(action) | ||
if("orbit") | ||
var/datum/follow_holder/follow_holder = locate(params["ref"]) in get_follow_targets() | ||
var/atom/movable/atom = follow_holder.followed_instance | ||
var/mob/observer/ghost/ghost = usr | ||
if(atom != usr) | ||
ghost.start_following(atom) | ||
return TRUE | ||
if("refresh") | ||
update_tgui_static_data() | ||
return TRUE | ||
|
||
/datum/orbit_menu/tgui_static_data(mob/user) | ||
var/list/data = list() | ||
data["misc"] = list() | ||
data["ghosts"] = list() | ||
data["dead"] = list() | ||
data["npcs"] = list() | ||
data["alive"] = list() | ||
data["antagonists"] = list() | ||
for(var/datum/follow_holder/follow_holder in get_follow_targets()) | ||
var/atom/movable/follow_instance = follow_holder.followed_instance | ||
var/list/serialized = list() | ||
serialized["name"] = follow_instance.name | ||
serialized["ref"] = "[REF(follow_holder)]" | ||
|
||
if(!istype(follow_instance, /mob)) | ||
data["misc"] += list(serialized) | ||
continue | ||
var/mob/mob = follow_instance | ||
if(isobserver(mob)) | ||
data["ghosts"] += list(serialized) | ||
continue | ||
|
||
if(mob.stat == DEAD) | ||
data["dead"] += list(serialized) | ||
continue | ||
|
||
if(isnull(mob.mind)) | ||
data["npcs"] += list(serialized) | ||
continue | ||
|
||
data["alive"] += list(serialized) | ||
|
||
var/mob/observer/ghost/observer = user | ||
if(observer.antagHUD && mob.get_antag_info()) | ||
var/antag_serialized = serialized.Copy() | ||
for(var/antag_category in mob.get_antag_info()) | ||
antag_serialized["antag"] += list(antag_category) | ||
data["antagonists"] += list(antag_serialized) | ||
|
||
return data | ||
|
||
/// Shows the UI to the specified user. | ||
/datum/orbit_menu/proc/show(mob/user) | ||
tgui_interact(user) |
Binary file not shown.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.