The Spatials: Galactology update for 2016-06-27

Internal development notes, very slightly cleaned up and commented a week later.

TL;DR: vital thresholds, item consumption can require cash, direct action bar in info tool, squads, mods can declare keybindings, minimal event system for station attacks.

This past week marked the end of feature development for the 7th launch, and we are now (more or less) in feature freeze mode. Only fixes and minor enhancements will be done from now until the 7th, and lots of testing. As such the week was full of new developments that set the foundations for entire new game systems and major UI pieces. Who said indies don’t crunch?

- vitals needy thresholds
	optional system for checking needy status
	instead of a fixed min value, use a min value + sated value per vital component (to allow per-entity custom)
	when it transitions under min, a needy flag for the vital is activated, and it's always needy for it
	when it transitions over max, needy flag is removed
	this allows more than a single consumption

The vital algorithm was refined again, to make needy impulses “sticky” until a threshold has been reached. There’s two camps to this, one prefers this behavior, the other doesn’t. It could be interesting to switch individual entities between sticky thresholds and single thresholds. Maybe with a “binge” character trait, once we have those?

- item consumption can require cash
	introduce optional wallets
	wallet procs to check affordability, decrease amount, keep purchases log
	resources and items already have prices
	other objects can have a price-component
	vital sm and its users now check for affordability when searching for items and objects
	vital sm and its users now debit the price from the wallet when required
- stock control must update price-component
- display prices in item info
- pallet objects for vitals: only consume the set resource, not any other
Wallet info

Entities can how hold wallets full or not so full of credits. When they do they spend them in the products that are priced, be it a lunch or some fancy clothes. Despite visitors still not being fleshed out and basically acting as testing placeholders, they have been equipped with wallets, to test this new feature, and to serve as a source of income. Get them to spend their credits!

- direct action bar in info tool
	a slim panel is drawn in the bottom position
	shows a series of buttons, depending on the aspect of the selected entity
		walk to
		work on
	actions can opt into having a modal cursor when activated
		info tool then waits for next click, then calls action with coords
		draw label over action bar when in modal mode
		make action button highlight in modal mode
		disable modal mode with esc or on tool activate deactivate
		switch modal mode when an action is switched
- harden action bar and modal info cursor wrt destroyed entities
- fix spurious error in change notification
- action: center view
Actions in action

There’s finally a GUI for giving direct orders to your officers (or to anything else that accepts them, which will be also robots in the future). It’s flexible and adapts to the current status of the entity, with its action set dynamically calculated. A very basic set of actions has also been provided. The teleport action is too powerful, but for now it’s useful for testing.

The action bar is also available in the station, with the same functionality as in planets.

- squads
	action panel has an add and remove from squad button, then it can display button for each squad member
	click on button targets the member
	timer does ligthweight check to refresh entire bar
		matching ids in hashtable
	button label shows color, hp
	button label is under observer for vulnerable component, for perfect updating
	show mini face in squad button
	single click on squad button resets multiselect to one
	shift click in squad button can do multiselect
	"all" button selects all squad
	multiselect shows all actions for all selected but no dupe actions
		on click it is invoked for all matching
- formalize attack model a bit to allow for action matching
	add one component for each attack kind
	the attack model maker adds the comp and removes any previous one
	add registry for attacks
- create squad on planet by default
- one of each class at start
- add one distinct combat skill for each class
- limit squad size
- optional passed filter for action model, to allow more fine grained matching
- add default squad for new game in station
- update planet basic tutorial to mention squads, tab, actions
Squad bar

And with more V2 parity features, Galactology now has a squad bar. This feature will evolve in the future, but for now it consists of a set of up to 6 officers you can select to be always displayed above the action bar. When you select them all with the All button or the Tab key, all the orders you give will apply to all of them.

Some attack model refactoring was also done as part of this work, with the idea of finally providing targeted attack actions, but in the end there wasn’t enough time to do a good job, so it has been postponed post-release.

- declare keybindings at mod meta level
- allow info actions to request a keybinding name
	info tool must listen for kb and trigger action on keydown when valid
- tab keybinding for "all" button
	introduce concept of ToolShell-level keybindings for tools
	tab can be pressed inside any tool anytime to quickly select the entire squad and perform actions

Mods can now ask for keybindings to be registered in the mod manifest, and they will appear in the Options screen for customization like any built-in keybinding. Mods still have indirect access to the keyboard and must register a Tool to “play nice” with the rest of the GUI. To make this a bit more flexible tools can request a screen-global keyboard listener (only for their screen, not the entire game). Use this sparingly!

- minimal station attack event AI, with plenty warning and/or lead time wrt tick 0
	add spawnable npc lists to civs
	trigger checker
		spawn some from a hostile civ in a random spot of the station
		add teleport fx and sound
		add critical alert
		add "a raid approaches" previous to spawn
			where? need more state?
		spawn one npc from a hostile civ in a random spot of the station in sneak mode
		spawn one visitor npc that is actually an hostile in disguise
More horror

And a very fitting end for a crazy week of coding. The station events system has been inaugurated, and its first guests are angry and armed. The station can now receive visits from raid parties, sneakers that hide unless spotted by a camera, and deceivers who look like a standard visitor. All of those events end up in bullets or worse, as to be expected. This is just three events out of the two dozens we have thought about, so a lot more is coming in the future.