pub struct ServerContext {Show 71 fields
pub tree_regions_id: Uuid,
pub tree_characters_id: Uuid,
pub tree_items_id: Uuid,
pub tree_tilemaps_id: Uuid,
pub tree_screens_id: Uuid,
pub tree_avatars_id: Uuid,
pub tree_assets_id: Uuid,
pub tree_assets_fonts_id: Uuid,
pub tree_assets_audio_id: Uuid,
pub tree_palette_id: Uuid,
pub tree_settings_id: Uuid,
pub curr_region: Uuid,
pub curr_region_content: ContentContext,
pub curr_character: ContentContext,
pub curr_item: ContentContext,
pub cc: ContentContext,
pub pc: ProjectContext,
pub curr_grid_id: Option<Uuid>,
pub curr_screen: Uuid,
pub interactions: HashMap<Uuid, Vec<Interaction>, FxBuildHasher>,
pub curr_tile_id: Option<Uuid>,
pub curr_tile_frame_index: usize,
pub palette_opacity: f32,
pub curr_model_id: Option<Uuid>,
pub curr_material_id: Option<Uuid>,
pub screen_editor_mode_foreground: bool,
pub hover: (Option<u32>, Option<u32>, Option<u32>),
pub hover_cursor: Option<Vec2<f32>>,
pub hover_cursor_3d: Option<Vec3<f32>>,
pub hover_height: Option<f32>,
pub curr_map_tool_type: MapToolType,
pub content_click_from_map: bool,
pub no_rect_geo_on_map: bool,
pub profile_view: Option<u32>,
pub editing_surface: Option<Surface>,
pub curr_action_id: Option<Uuid>,
pub auto_action: bool,
pub moved_entities: HashMap<Uuid, (Vec3<f32>, Vec3<f32>), FxBuildHasher>,
pub moved_items: HashMap<Uuid, (Vec3<f32>, Vec3<f32>), FxBuildHasher>,
pub rotated_entities: HashMap<Uuid, (Vec2<f32>, Vec2<f32>), FxBuildHasher>,
pub selected_wall_row: Option<i32>,
pub editor_view_mode: EditorViewMode,
pub world_mode: bool,
pub game_mode: bool,
pub clipboard: Map,
pub paste_clipboard: Option<Map>,
pub background_progress: Option<String>,
pub character_region_override: bool,
pub item_region_override: bool,
pub animation_counter: usize,
pub geo_hit: Option<GeoId>,
pub geo_hit_pos: Vec3<f32>,
pub editing_pos_buffer: Option<Vec3<f32>>,
pub editing_view_pos_by_map: HashMap<(Uuid, i32), Vec3<f32>, FxBuildHasher>,
pub editing_view_look_by_map: HashMap<(Uuid, i32), Vec3<f32>, FxBuildHasher>,
pub editing_view_2d_by_map: HashMap<Uuid, (Vec2<f32>, f32), FxBuildHasher>,
pub editing_view_iso_scale_by_map: HashMap<Uuid, f32, FxBuildHasher>,
pub selected_hud_icon_index: i32,
pub show_editing_geometry: bool,
pub editing_slice: f32,
pub editing_slice_height: f32,
pub gizmo_mode: GizmoMode,
pub rect_sector_id_3d: Option<u32>,
pub rect_tile_id_3d: (i32, i32),
pub rect_terrain_id: Option<(i32, i32)>,
pub rect_blend_preset: VertexBlendPreset,
pub game_input_mode: bool,
pub help_mode: bool,
pub editing_ctx: PixelEditingContext,
pub body_marker_color: Option<[u8; 4]>,
pub avatar_anchor_slot: AvatarAnchorEditSlot,
/* private fields */
}Expand description
This gives context to the server of the editing state for live highlighting.
Fields§
§tree_regions_id: Uuid§tree_characters_id: Uuid§tree_items_id: Uuid§tree_tilemaps_id: Uuid§tree_screens_id: Uuid§tree_avatars_id: Uuid§tree_assets_id: Uuid§tree_assets_fonts_id: Uuid§tree_assets_audio_id: Uuid§tree_palette_id: Uuid§tree_settings_id: Uuid§curr_region: UuidThe currently selected region in the editor.
curr_region_content: ContentContextThe current region content.
curr_character: ContentContextThe currently selected character in the editor.
curr_item: ContentContextThe currently selected item in the editor.
cc: ContentContextThe current content context.
pc: ProjectContextThe current project context.
curr_grid_id: Option<Uuid>The currently selected codegrid in the code editor.
curr_screen: UuidThe currently selected screen.
interactions: HashMap<Uuid, Vec<Interaction>, FxBuildHasher>The logged interactions of the characters.
curr_tile_id: Option<Uuid>The currently selected tile
curr_tile_frame_index: usizeThe current frame/texture index being edited in tile editor
palette_opacity: f32The palette opacity for drawing tools
curr_model_id: Option<Uuid>The currently selected model
curr_material_id: Option<Uuid>The currently selected material
screen_editor_mode_foreground: boolThe screen editor drawing mode.
hover: (Option<u32>, Option<u32>, Option<u32>)Hover geometry info
hover_cursor: Option<Vec2<f32>>The current grid hover position
hover_cursor_3d: Option<Vec3<f32>>The current 3d hover position
hover_height: Option<f32>The current grid hover height
curr_map_tool_type: MapToolTypeCurrent Tool Type
content_click_from_map: boolA click on map content originated from the map
no_rect_geo_on_map: boolDont show rect based geometry on map
profile_view: Option<u32>Show wall profile in linedef mode.
editing_surface: Option<Surface>The current editing surface
curr_action_id: Option<Uuid>The currently selected action
auto_action: boolAutomatially apply actions
moved_entities: HashMap<Uuid, (Vec3<f32>, Vec3<f32>), FxBuildHasher>Pending entity position changes: (from, to)
moved_items: HashMap<Uuid, (Vec3<f32>, Vec3<f32>), FxBuildHasher>Pending item position changes: (from, to)
rotated_entities: HashMap<Uuid, (Vec2<f32>, Vec2<f32>), FxBuildHasher>Pending character orientation changes: (from, to)
selected_wall_row: Option<i32>Selected wall row, set by the linedef Hud
editor_view_mode: EditorViewModeView mode of the editor
world_mode: boolWorld mode is active
game_mode: boolGame server is running
clipboard: MapMap clipboard
paste_clipboard: Option<Map>Map clipboard which is currently being pasted
background_progress: Option<String>Background Progress Text
character_region_override: boolCharacter Region Override
item_region_override: boolItem Region Override
animation_counter: usizeAnimation counter for tile previews
geo_hit: Option<GeoId>The current 3D hover hit
geo_hit_pos: Vec3<f32>The current geometry hover hit position
editing_pos_buffer: Option<Vec3<f32>>Temporary storage for the editing positon
editing_view_pos_by_map: HashMap<(Uuid, i32), Vec3<f32>, FxBuildHasher>Per-map, per-3D-view camera anchor (editing position).
editing_view_look_by_map: HashMap<(Uuid, i32), Vec3<f32>, FxBuildHasher>Per-map, per-3D-view look target.
editing_view_2d_by_map: HashMap<Uuid, (Vec2<f32>, f32), FxBuildHasher>Per-map 2D camera state: (offset, grid_size).
editing_view_iso_scale_by_map: HashMap<Uuid, f32, FxBuildHasher>Per-map Iso camera scale.
selected_hud_icon_index: i32The index of the selected icon in the hud
show_editing_geometry: boolSwitch for showing 3D editing geometry
editing_slice: f32Position of the 2D editing slice.
editing_slice_height: f32Height/thickness of the 2D editing slice.
gizmo_mode: GizmoModeThe current plane for 3D movement
rect_sector_id_3d: Option<u32>§rect_tile_id_3d: (i32, i32)§rect_terrain_id: Option<(i32, i32)>§rect_blend_preset: VertexBlendPreset§game_input_mode: boolGame input mode
help_mode: boolHelp mode state
editing_ctx: PixelEditingContextThe current editing context for texture editor tools.
body_marker_color: Option<[u8; 4]>The selected body marker color for avatar painting.
avatar_anchor_slot: AvatarAnchorEditSlotActive avatar anchor edit slot for pixel editor clicks.
Implementations§
Source§impl ServerContext
impl ServerContext
pub fn new() -> ServerContext
Sourcepub fn polyview_has_focus(&self, ctx: &TheContext) -> bool
pub fn polyview_has_focus(&self, ctx: &TheContext) -> bool
Checks if the PolyView has focus.
Sourcepub fn get_map_context(&self) -> MapContext
pub fn get_map_context(&self) -> MapContext
Returns the current map context
pub fn set_map_context(&mut self, map_context: MapContext)
pub fn store_edit_view_for_map( &mut self, map_id: Uuid, mode: EditorViewMode, pos: Vec3<f32>, look: Vec3<f32>, )
pub fn load_edit_view_for_map( &self, map_id: Uuid, mode: EditorViewMode, ) -> Option<(Vec3<f32>, Vec3<f32>)>
pub fn store_edit_view_2d_for_map( &mut self, map_id: Uuid, offset: Vec2<f32>, grid_size: f32, )
pub fn load_edit_view_2d_for_map( &self, map_id: Uuid, ) -> Option<(Vec2<f32>, f32)>
pub fn store_edit_view_iso_scale_for_map(&mut self, map_id: Uuid, scale: f32)
pub fn load_edit_view_iso_scale_for_map(&self, map_id: Uuid) -> Option<f32>
pub fn clear_interactions(&mut self)
Sourcepub fn local_to_map_grid(
&self,
screen_size: Vec2<f32>,
coord: Vec2<f32>,
map: &Map,
subdivisions: f32,
) -> Vec2<f32>
pub fn local_to_map_grid( &self, screen_size: Vec2<f32>, coord: Vec2<f32>, map: &Map, subdivisions: f32, ) -> Vec2<f32>
Convert local screen position to a map grid position
Sourcepub fn local_to_map_cell(
&self,
screen_size: Vec2<f32>,
coord: Vec2<f32>,
map: &Map,
subdivisions: f32,
) -> Vec2<f32>
pub fn local_to_map_cell( &self, screen_size: Vec2<f32>, coord: Vec2<f32>, map: &Map, subdivisions: f32, ) -> Vec2<f32>
Snap to a grid cell
Sourcepub fn map_grid_to_local(
screen_size: Vec2<f32>,
grid_pos: Vec2<f32>,
map: &Map,
) -> Vec2<f32>
pub fn map_grid_to_local( screen_size: Vec2<f32>, grid_pos: Vec2<f32>, map: &Map, ) -> Vec2<f32>
Convert a map grid position to a local screen position
Sourcepub fn center_map_at_grid_pos(
&mut self,
_screen_size: Vec2<f32>,
grid_pos: Vec2<f32>,
map: &mut Map,
)
pub fn center_map_at_grid_pos( &mut self, _screen_size: Vec2<f32>, grid_pos: Vec2<f32>, map: &mut Map, )
Centers the map at the given grid position.
Sourcepub fn geometry_at(
&self,
screen_size: Vec2<f32>,
screen_pos: Vec2<f32>,
map: &Map,
) -> (Option<u32>, Option<u32>, Option<u32>)
pub fn geometry_at( &self, screen_size: Vec2<f32>, screen_pos: Vec2<f32>, map: &Map, ) -> (Option<u32>, Option<u32>, Option<u32>)
Returns the geometry at the given screen_position
Sourcepub fn geometry_in_rectangle(
&self,
top_left: Vec2<f32>,
bottom_right: Vec2<f32>,
map: &Map,
) -> (Vec<u32>, Vec<u32>, Vec<u32>)
pub fn geometry_in_rectangle( &self, top_left: Vec2<f32>, bottom_right: Vec2<f32>, map: &Map, ) -> (Vec<u32>, Vec<u32>, Vec<u32>)
Returns all geometry within the given rectangle.
Sourcepub fn hover_is_empty(&self) -> bool
pub fn hover_is_empty(&self) -> bool
Returns false if the hover is empty
Sourcepub fn hover_to_arrays(&self) -> (Vec<u32>, Vec<u32>, Vec<u32>)
pub fn hover_to_arrays(&self) -> (Vec<u32>, Vec<u32>, Vec<u32>)
Converts the hover into arrays.
Sourcepub fn add_interactions(&mut self, interactions: Vec<Interaction>)
pub fn add_interactions(&mut self, interactions: Vec<Interaction>)
Adds the given interactions provided by a server tick to the context.
Trait Implementations§
Source§impl Default for ServerContext
impl Default for ServerContext
Source§fn default() -> ServerContext
fn default() -> ServerContext
Auto Trait Implementations§
impl Freeze for ServerContext
impl RefUnwindSafe for ServerContext
impl Send for ServerContext
impl Sync for ServerContext
impl Unpin for ServerContext
impl UnsafeUnpin for ServerContext
impl UnwindSafe for ServerContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.