Skip to content

Instantly share code, notes, and snippets.

@Genhis
Genhis / resource-autoplace-function.lua
Created December 22, 2023 13:26
Factorio main resource autoplace function using the new noise expressions format (incomplete)
data:extend{
{
type = "noise-function",
name = "resource_autoplace_all_patches",
parameters =
{
"base_density",
"base_spots_per_km2",
"candidate_spot_count",
"frequency_multiplier",
@Genhis
Genhis / distance.js
Created August 25, 2015 20:09
Computation of distance and angle between two points. It depends on jQuery.
/**
* Get a center of an element.
*
* @method getCenter
* @param {Element} el jQuery element
* @return {Object} Point
* @author Genhis
*/
function getCenter(el){
return {
@Genhis
Genhis / radial_menu.js
Created August 15, 2015 13:14
Calculation of radial menu (JavaScript)
/**
* Compute offsets for radial menu creation.
*
* @method create_radial_menu
* @param {int} size Size of square side
* @param {int} count Count of the objects for display
* @return {Array} Returns array containing generated offsets
* @author Genhis
*/
function create_radial_menu(size, count) {