global

package
v0.0.0-...-54eea7a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 11, 2020 License: MIT Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddNewUser

func AddNewUser(ws *websocket.Conn, login string, id int)

func Attack

func Attack(user *player.Player, msg Message)

func ChangeSector

func ChangeSector(user *player.Player, mapID int, coor *coordinate.Coordinate)

func CheckBaseRespawn

func CheckBaseRespawn(base *base.Base) (bool, *coordinate.Coordinate)

func CheckTransportCoordinate

func CheckTransportCoordinate(x, y, seconds, distCheck, mapID int) bool

func ClearVisiblePath

func ClearVisiblePath(mapID int)

func CreateLine

func CreateLine(color string, X, Y, ToX, ToY int, rectSize, mapID int, ms int64)

func CreateRect

func CreateRect(color string, startX, startY int, rectSize, mapID int, ms int64)

func DebugMoveWorker

func DebugMoveWorker(user *player.Player)

func DebugSender

func DebugSender()

func DisconnectUser

func DisconnectUser(user *player.Player, onlyMessage bool)

func FireGun

func FireGun(user *player.Player, attackUnit *unit.Unit, mp *_map.Map)

func FlyBullet

func FlyBullet(user *player.Player, bullet *unit.Bullet, gameMap *_map.Map, attackUnit *unit.Unit)

функция которая заставляет лететь снаряды летящие по прямой

func FlyLaser

func FlyLaser(bullet *unit.Bullet, gameMap *_map.Map, attackUnit *unit.Unit)

полет лазера

func FollowTarget

func FollowTarget(user *player.Player, followUnit *unit.Unit, mp *_map.Map)

func FollowUnit

func FollowUnit(user *player.Player, moveUnit *unit.Unit, msg Message)

func ForceEvacuation

func ForceEvacuation(unit *unit.Unit, x, y, seconds, distCheck int)

func FormationInit

func FormationInit(user *player.Player, unitsID []int) bool

func FormationMove

func FormationMove(user *player.Player)

func GetPlaceCoordinate

func GetPlaceCoordinate(placeUnit *unit.Unit, mp *_map.Map)

func GetPlaceSquad

func GetPlaceSquad(user *player.Player, mp *_map.Map)

func GunWorker

func GunWorker(user *player.Player)

функция следит за орудиями всех юнитов если есть цель то орудие всегда повернуто к цели, и функция следит что бы оно так и было независимо от движения если цели нет то орудие всегда идет по курсу тела todo расчет угла по движещейся цели

func HandlerParse

func HandlerParse(user *player.Player, coor *coordinate.Coordinate)

func IntoToBase

func IntoToBase(user *player.Player, baseID int)

func LoadGame

func LoadGame(user *player.Player, msg Message)

func Mining

func Mining(miner *unit.Unit, miningEquip *equip.Equip, reservoir *resource.Map, msg Message, user *player.Player)

func Move

func Move(user *player.Player, msg Message, newAction bool)

func MoveGlobalUnit

func MoveGlobalUnit(msg Message, user *player.Player, path *[]*unit.PathUnit, moveUnit *unit.Unit, mp *_map.Map)

func MoveGlobalUnitEnd

func MoveGlobalUnitEnd(user *player.Player, moveUnit *unit.Unit, moveRepeat bool, msg Message)

func MoveSender

func MoveSender()

func NewFormationPos

func NewFormationPos(user *player.Player, msg Message)

func OutBase

func OutBase(base *base.Base) *coordinate.Coordinate

func PolygonSender

func PolygonSender()

func RadarWorker

func RadarWorker(user *player.Player, mp *_map.Map)

func Reader

func Reader(ws *websocket.Conn, user *player.Player)

func RecoveryPowerWorker

func RecoveryPowerWorker(user *player.Player)

TODO отключить игрока если он отключился

func ReturnUnit

func ReturnUnit(user *player.Player, moveUnit *unit.Unit)

func RotateGun

func RotateGun(user *player.Player, rotateUnit *unit.Unit, tickTime int)

func SelectEquip

func SelectEquip(user *player.Player, msg Message)

func SendMessage

func SendMessage(msg Message)

func SquadDamage

func SquadDamage(user *player.Player, damage int, damageUnit *unit.Unit)

func WeaponFirePos

func WeaponFirePos()

Types

type Cloud

type Cloud struct {
	Name     string  `json:"name"`
	Speed    int     `json:"speed"`
	Alpha    float64 `json:"alpha"`
	X        int     `json:"x"`
	Y        int     `json:"y"`
	Angle    int     `json:"angle"`
	Uuid     string  `json:"uuid"`
	SizeMapX int     `json:"-"`
	SizeMapY int     `json:"-"`
	IDMap    int     `json:"-"`
}

type Message

type Message struct {
	// когда я забил х на эту структуру данных а теперь тут какое то адище
	IDSender       int                                        // переменная не для данных а для отсылки сообщений
	IDUserSend     int                                        // переменная не для данных а для отсылки сообщений
	IDMap          int                                        // переменная не для данных а для отсылки сообщений
	Event          string                                     `json:"event"`
	Map            *_map.Map                                  `json:"map"`
	Error          string                                     `json:"error"`
	Squad          *squad.Squad                               `json:"squad"`
	User           *player.Player                             `json:"user"`
	Bases          map[int]*base.Base                         `json:"bases"`
	X              int                                        `json:"x"`
	Y              int                                        `json:"y"`
	ToX            float64                                    `json:"to_x"`
	ToY            float64                                    `json:"to_y"`
	Bullet         *unit.Bullet                               `json:"bullet"`
	PathUnit       *unit.PathUnit                             `json:"path_unit"`
	Path           []*unit.PathUnit                           `json:"path"`
	BaseID         int                                        `json:"base_id"`
	OtherUser      *player.ShortUserInfo                      `json:"other_user"`
	OtherUsers     []*player.ShortUserInfo                    `json:"other_users"`
	ThrowItems     []inventory.Slot                           `json:"throw_items"`
	Boxes          []*boxInMap.Box                            `json:"boxes"`
	Box            *boxInMap.Box                              `json:"box"`
	BoxID          int                                        `json:"box_id"`
	ToBoxID        int                                        `json:"to_box_id"`
	TypeSlot       int                                        `json:"type_slot"`
	Name           string                                     `json:"name"`
	Slot           int                                        `json:"slot"`
	Slots          []int                                      `json:"slots"`
	Size           float32                                    `json:"size"`
	Inventory      *inventory.Inventory                       `json:"inventory"`
	InventorySlot  int                                        `json:"inventory_slot"`
	TransportID    int                                        `json:"transport_id"`
	ThoriumSlots   map[int]*detail.ThoriumSlot                `json:"thorium_slots"`
	ThoriumSlot    int                                        `json:"thorium_slot"`
	Afterburner    bool                                       `json:"afterburner"`
	Credits        int                                        `json:"credits"`
	Experience     int                                        `json:"experience"`
	Seconds        int                                        `json:"seconds"`
	Count          int                                        `json:"count"`
	Coordinates    []*coordinate.Coordinate                   `json:"coordinates"`
	Radius         int                                        `json:"radius"`
	Anomalies      []globalGame.VisibleAnomaly                `json:"anomalies"`
	Anomaly        *_map.Anomalies                            `json:"anomaly"`
	DynamicObject  *dynamic_map_object.Object                 `json:"dynamic_object"`
	DynamicObjects map[int]map[int]*dynamic_map_object.Object `json:"dynamic_objects"`
	BoxPassword    int                                        `json:"box_password"`
	Reservoir      *resource.Map                              `json:"reservoir"`
	Cloud          *Cloud                                     `json:"cloud"`
	ToSquadID      string                                     `json:"to_squad_id"`
	Bot            bool                                       `json:"bot"`
	MapID          int                                        `json:"map_id"`
	Missions       map[string]*mission.Mission                `json:"missions"`
	MissionUUID    string                                     `json:"mission_uuid"`
	UnitsID        []int                                      `json:"units_id"`
	ShortUnits     map[int]*unit.ShortUnitInfo                `json:"short_units"`
	ShortUnit      *unit.ShortUnitInfo                        `json:"short_unit"`
	Unit           *unit.Unit                                 `json:"unit"`
	UnitID         int                                        `json:"unit_id"`
	Equip          *detail.BodyEquipSlot                      `json:"equip"`
	Weapon         *detail.Weapon                             `json:"weapon"`
	HighGravity    bool                                       `json:"high_gravity"`
	Type           string                                     `json:"type"`

	Color    string `json:"color"`
	RectSize int    `json:"rect_size"`

	Polygon collisions.Polygon `json:"polygon"`

	NeedCheckView bool                  `json:"-"` // если тру то надо проверить сообщение на дальность видимости/радара
	RadarMark     *squad.VisibleObjects `json:"radar_mark"`
	ActionObject  string                `json:"action_object"` // удалить/создать обьект
	ActionMark    string                `json:"action_mark"`   // удалить/создать/скрыть/раскрыть метку
	Object        interface{}           `json:"object"`        // обьект (ящик, транспорт, юнит и тд)
}

func CheckView

func CheckView(client *player.Player, resp *Message) *Message

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL