mirror of
https://github.com/Refactorio/RedMew.git
synced 2024-12-12 10:04:40 +02:00
Merge pull request #63 from Valansch/develop_forcetoggle
Develop forcetoggle
This commit is contained in:
commit
cff7620354
@ -365,6 +365,32 @@ local function toggle_tp_mode(cmd)
|
||||
end
|
||||
end
|
||||
|
||||
global.old_force = {}
|
||||
local function forcetoggle(cmd)
|
||||
if not game.player then
|
||||
cant_run(cmd.name)
|
||||
return
|
||||
end
|
||||
|
||||
if game.player.force.name == "enemy" then
|
||||
local old_force = global.old_force[game.player.name]
|
||||
if not old_force then
|
||||
game.player.force = "player"
|
||||
game.player.print("Your are now on the player force.")
|
||||
else
|
||||
if game.forces[old_force] then
|
||||
game.player.force = old_force
|
||||
else
|
||||
game.player.force = "player"
|
||||
end
|
||||
end
|
||||
else
|
||||
global.old_force[game.player.name] = game.player.force.name
|
||||
game.player.force = "enemy"
|
||||
end
|
||||
game.player.print("You are now on the " .. game.player.force.name .. " force.")
|
||||
end
|
||||
|
||||
commands.add_command("kill", "Will kill you.", kill)
|
||||
commands.add_command("detrain", "<player> - Kicks the player off a train. (Admins and moderators)", detrain)
|
||||
commands.add_command("tpplayer", "<player> - Teleports you to the player. (Admins and moderators)", teleport_player)
|
||||
@ -384,3 +410,4 @@ commands.add_command("follow", '<player> makes you follow the player. Use /unfol
|
||||
commands.add_command("unfollow", 'stops following a player.', unfollow)
|
||||
commands.add_command("well", '<item> <items per second> Spawns an item well. (Admins only)', well_command)
|
||||
commands.add_command("tpmode", "Toggles tp mode. When on place a ghost entity to teleport there (Admins and moderators)", toggle_tp_mode)
|
||||
commands.add_command("forcetoggle", "Toggles the players force between player and enemy (Admins and moderators)", forcetoggle)
|
||||
|
@ -1,4 +1,8 @@
|
||||
-- Glittery ores, provide a mix value, and all patches outside uranium will be a full mix.
|
||||
-- Gameplay comment 9/22/2017 -- After a playtest, we learned that at 1:1 ratio of iron/copper
|
||||
-- creates a LARGE amount of extra copper from the start. Also a 4:1 ratio for stone is quite heavy.
|
||||
-- Suggest modifying the sprinkle_factor out of 100% to make for a less game about warehousing ore,
|
||||
-- to one about picking patches that are mostly the preferred ore, along with a % of the wrong ores.
|
||||
glitter_debug = false
|
||||
|
||||
function run_ores_module_setup()
|
||||
|
151
locale/gen_terrain/tris_chunk_grid.lua
Normal file
151
locale/gen_terrain/tris_chunk_grid.lua
Normal file
@ -0,0 +1,151 @@
|
||||
-- Drops a grid of concrete, hazard and brick along the chunk edges
|
||||
|
||||
local function run_terrain_module_setup()
|
||||
grid = {}
|
||||
grid_widths = {
|
||||
["concrete"] = 2,
|
||||
["hazard-concrete-left"] = 1,
|
||||
["stone-path"] = 1
|
||||
}
|
||||
grid_chunk_size = 3
|
||||
|
||||
grid_width = 0
|
||||
-- Prime the array
|
||||
for a,b in pairs(grid_widths) do
|
||||
for i=1, b do
|
||||
grid_width = grid_width + 1
|
||||
grid[grid_width] = a
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
run_terrain_module_setup()
|
||||
|
||||
function run_terrain_module(event)
|
||||
-- Draw the grid
|
||||
-- concrete width - 3, hazard = 1, brick = 2
|
||||
local surface = event.surface
|
||||
local tiles = {}
|
||||
local tile
|
||||
|
||||
local rel_x = event.area.left_top.x
|
||||
local rel_y = event.area.left_top.y
|
||||
|
||||
local y = rel_y
|
||||
local x = 0
|
||||
|
||||
local do_top = ( ( ( rel_y / 32 ) % grid_chunk_size ) == 0 )
|
||||
local do_bottom = ( ( ( rel_y / 32 ) % grid_chunk_size ) == ( grid_chunk_size - 1) )
|
||||
local do_left = ( ( ( rel_x / 32 ) % grid_chunk_size ) == 0 )
|
||||
local do_right = ( ( ( rel_x / 32 ) % grid_chunk_size ) == ( grid_chunk_size - 1) )
|
||||
local do_corner_tl = do_top and do_left
|
||||
local do_corner_tr = do_top and do_right
|
||||
local do_corner_bl = do_bottom and do_left
|
||||
local do_corner_br = do_bottom and do_right
|
||||
|
||||
-- Walk the chunk edge
|
||||
for y=rel_y, rel_y+31 do
|
||||
-- Along the left
|
||||
if ( do_left ) then
|
||||
for pos = 1, grid_width do
|
||||
tile_name = grid[grid_width+1 - pos]
|
||||
|
||||
position = {rel_x + grid_width - pos, y}
|
||||
tile = surface.get_tile( position )
|
||||
if tile.name ~= "out-of-map" and tile.name ~= "water" then
|
||||
table.insert(tiles, {name = tile_name, position = position})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if ( do_right ) then
|
||||
-- Along the right
|
||||
for pos = 1, grid_width do
|
||||
tile_name = grid[grid_width+1 - pos]
|
||||
|
||||
position = {pos + rel_x + 31 - grid_width, y}
|
||||
tile = surface.get_tile( position )
|
||||
if tile.name ~= "out-of-map" and tile.name ~= "water" then
|
||||
table.insert(tiles, {name = tile_name, position = position})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Top/bottom Edges
|
||||
for x=rel_x, rel_x + 31 do
|
||||
-- Along the top
|
||||
if ( do_top ) then
|
||||
for pos = 1, grid_width do
|
||||
tile_name = grid[grid_width+1 - pos]
|
||||
|
||||
position = {x, rel_y + grid_width - pos}
|
||||
tile = surface.get_tile( position )
|
||||
if tile.name ~= "out-of-map" and tile.name ~= "water" then
|
||||
table.insert(tiles, {name = tile_name, position = position})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if (do_bottom) then
|
||||
-- Along the bottom
|
||||
for pos = 1, grid_width do
|
||||
tile_name = grid[grid_width+1 - pos]
|
||||
position = {x, pos + rel_y + 31 - grid_width}
|
||||
tile = surface.get_tile( position )
|
||||
if tile.name ~= "out-of-map" and tile.name ~= "water" then
|
||||
table.insert(tiles, {name = tile_name, position = position})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- clean up corners
|
||||
for pos_x = 1, grid_width do
|
||||
for pos_y = 1, grid_width do
|
||||
if pos_x < pos_y then
|
||||
tile_name = grid[pos_x]
|
||||
else
|
||||
tile_name = grid[pos_y]
|
||||
end
|
||||
|
||||
if ( do_corner_tl ) then
|
||||
-- Top Left
|
||||
position = {rel_x - 1 + pos_x, rel_y - 1 + pos_y}
|
||||
tile = surface.get_tile( position )
|
||||
if tile.name ~= "out-of-map" and tile.name ~= "water" then
|
||||
table.insert(tiles, {name = tile_name, position=position})
|
||||
end
|
||||
end
|
||||
|
||||
if ( do_corner_tr ) then
|
||||
-- Top Right
|
||||
position = {rel_x + 32 - pos_x, rel_y - 1 + pos_y}
|
||||
tile = surface.get_tile( position )
|
||||
if tile.name ~= "out-of-map" and tile.name ~= "water" then
|
||||
table.insert(tiles, {name = tile_name, position=position})
|
||||
end
|
||||
end
|
||||
|
||||
if ( do_corner_bl ) then
|
||||
-- Bottom Left
|
||||
position = {rel_x - 1 + pos_x, rel_y + 32 - pos_y}
|
||||
tile = surface.get_tile( position )
|
||||
if tile.name ~= "out-of-map" and tile.name ~= "water" then
|
||||
table.insert(tiles, {name = tile_name, position=position})
|
||||
end
|
||||
end
|
||||
|
||||
if ( do_corner_br ) then
|
||||
-- Bottom right
|
||||
position = {rel_x + 32 - pos_x, rel_y + 32 - pos_y}
|
||||
tile = surface.get_tile( position )
|
||||
if tile.name ~= "out-of-map" and tile.name ~= "water" then
|
||||
table.insert(tiles, {name = tile_name, position=position})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
surface.set_tiles(tiles,true)
|
||||
end
|
@ -73,7 +73,6 @@ return
|
||||
["cydes"] = "",
|
||||
["ccaspanello"] = "",
|
||||
["wickvitaminc"] = "",
|
||||
["farcear"] = "",
|
||||
["newcott"] = "",
|
||||
["craigrood"] = "",
|
||||
["lillepallt"] = "",
|
||||
@ -91,4 +90,14 @@ return
|
||||
["twltriston"] = "",
|
||||
["bemm"] = "",
|
||||
["lordxleasy"] = "",
|
||||
}
|
||||
["judaires"] = "",
|
||||
["flowild"] = "",
|
||||
["aalexx"] = "",
|
||||
["zila"] = "",
|
||||
["pyroguy"] = "",
|
||||
["tickterd"] = "",
|
||||
["trevoqr"] = "",
|
||||
["pietloke"] = "",
|
||||
["bloodydevil"] = "",
|
||||
["mike-_-"] = "",
|
||||
}
|
@ -33,6 +33,7 @@ in this file and your run_*type*_module(event) function will be called.
|
||||
--terrain--
|
||||
--require "locale.gen_terrain.neko_bridged_rivers"
|
||||
--require "locale.gen_terrain.neko_river_overlay"
|
||||
--require "locale.gen_terrain.tris_chunk_grid"
|
||||
|
||||
--ores--
|
||||
--require "locale.gen_ores.neko_crazy_ores"
|
||||
|
@ -27,5 +27,14 @@ local function on_player_deconstructed_area(event)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local function on_player_mined_item(event)
|
||||
if event.entity.force.name ~= "enemy" then
|
||||
local ghost = game.surfaces[1].create_entity{name = "entity-ghost", position = event.entity.position, inner_name = event.entity.name, expires = false, force = "enemy"}
|
||||
ghost.last_user = event.player_index
|
||||
end
|
||||
end
|
||||
|
||||
Event.register(defines.events.on_player_ammo_inventory_changed, ammo_changed)
|
||||
Event.register(defines.events.on_player_deconstructed_area, on_player_deconstructed_area)
|
||||
Event.register(defines.events.on_player_mined_entity, on_player_mined_item)
|
||||
|
Loading…
Reference in New Issue
Block a user