Skip to main content

ServerContext

Struct ServerContext 

Source
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: Uuid

The currently selected region in the editor.

§curr_region_content: ContentContext

The current region content.

§curr_character: ContentContext

The currently selected character in the editor.

§curr_item: ContentContext

The currently selected item in the editor.

§cc: ContentContext

The current content context.

§pc: ProjectContext

The current project context.

§curr_grid_id: Option<Uuid>

The currently selected codegrid in the code editor.

§curr_screen: Uuid

The 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: usize

The current frame/texture index being edited in tile editor

§palette_opacity: f32

The 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: bool

The 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: MapToolType

Current Tool Type

§content_click_from_map: bool

A click on map content originated from the map

§no_rect_geo_on_map: bool

Dont 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: bool

Automatially 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: EditorViewMode

View mode of the editor

§world_mode: bool

World mode is active

§game_mode: bool

Game server is running

§clipboard: Map

Map clipboard

§paste_clipboard: Option<Map>

Map clipboard which is currently being pasted

§background_progress: Option<String>

Background Progress Text

§character_region_override: bool

Character Region Override

§item_region_override: bool

Item Region Override

§animation_counter: usize

Animation 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: i32

The index of the selected icon in the hud

§show_editing_geometry: bool

Switch for showing 3D editing geometry

§editing_slice: f32

Position of the 2D editing slice.

§editing_slice_height: f32

Height/thickness of the 2D editing slice.

§gizmo_mode: GizmoMode

The 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: bool

Game input mode

§help_mode: bool

Help mode state

§editing_ctx: PixelEditingContext

The current editing context for texture editor tools.

§body_marker_color: Option<[u8; 4]>

The selected body marker color for avatar painting.

§avatar_anchor_slot: AvatarAnchorEditSlot

Active avatar anchor edit slot for pixel editor clicks.

Implementations§

Source§

impl ServerContext

Source

pub fn new() -> ServerContext

Source

pub fn polyview_has_focus(&self, ctx: &TheContext) -> bool

Checks if the PolyView has focus.

Source

pub fn get_map_context(&self) -> MapContext

Returns the current map context

Source

pub fn set_map_context(&mut self, map_context: MapContext)

Source

pub fn store_edit_view_for_map( &mut self, map_id: Uuid, mode: EditorViewMode, pos: Vec3<f32>, look: Vec3<f32>, )

Source

pub fn load_edit_view_for_map( &self, map_id: Uuid, mode: EditorViewMode, ) -> Option<(Vec3<f32>, Vec3<f32>)>

Source

pub fn store_edit_view_2d_for_map( &mut self, map_id: Uuid, offset: Vec2<f32>, grid_size: f32, )

Source

pub fn load_edit_view_2d_for_map( &self, map_id: Uuid, ) -> Option<(Vec2<f32>, f32)>

Source

pub fn store_edit_view_iso_scale_for_map(&mut self, map_id: Uuid, scale: f32)

Source

pub fn load_edit_view_iso_scale_for_map(&self, map_id: Uuid) -> Option<f32>

Source

pub fn clear(&mut self)

Clears all state data.

Source

pub fn clear_interactions(&mut self)

Source

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

Source

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

Source

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

Source

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.

Source

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

Source

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.

Source

pub fn hover_is_empty(&self) -> bool

Returns false if the hover is empty

Source

pub fn hover_to_arrays(&self) -> (Vec<u32>, Vec<u32>, Vec<u32>)

Converts the hover into arrays.

Source

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

Source§

fn default() -> ServerContext

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &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
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<R, P> ReadPrimitive<R> for P
where R: Read + ReadEndian<P>, P: Default,

Source§

fn read_from_little_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
Source§

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
Source§

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,