mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-02-03 13:12:11 +02:00
player > character
these were all what I could find.
This commit is contained in:
parent
93d8745ff5
commit
0e8c2dc760
@ -189,7 +189,7 @@ local blacklisted_types = {
|
||||
--Friendly Fire History
|
||||
local function on_entity_died(event)
|
||||
if not event.cause then return end
|
||||
if event.cause.name ~= "player" then return end
|
||||
if event.cause.name ~= "character" then return end
|
||||
if event.cause.force.name ~= event.entity.force.name then return end
|
||||
if blacklisted_types[event.entity.type] then return end
|
||||
local player = event.cause.player
|
||||
|
@ -51,7 +51,7 @@ local function bring_player(player, source_player)
|
||||
source_player.print("Target player is in a vehicle, teleport not available.", { r=0.88, g=0.88, b=0.88})
|
||||
return
|
||||
end
|
||||
local pos = source_player.surface.find_non_colliding_position("player", source_player.position, 50, 1)
|
||||
local pos = source_player.surface.find_non_colliding_position("character", source_player.position, 50, 1)
|
||||
if pos then
|
||||
player.teleport(pos, source_player.surface)
|
||||
game.print(player.name .. " has been teleported to " .. source_player.name .. ". " .. bring_player_messages[math.random(1, #bring_player_messages)], { r=0.98, g=0.66, b=0.22})
|
||||
@ -63,7 +63,7 @@ local go_to_player_messages = {
|
||||
"What are you up to?"
|
||||
}
|
||||
local function go_to_player(player, source_player)
|
||||
local pos = player.surface.find_non_colliding_position("player", player.position, 50, 1)
|
||||
local pos = player.surface.find_non_colliding_position("character", player.position, 50, 1)
|
||||
if pos then
|
||||
source_player.teleport(pos, player.surface)
|
||||
game.print(source_player.name .. " is visiting " .. player.name .. ". " .. go_to_player_messages[math.random(1, #go_to_player_messages)], { r=0.98, g=0.66, b=0.22})
|
||||
|
@ -62,7 +62,7 @@ function dump_layout()
|
||||
str = str .. ', force = "'
|
||||
str = str .. e.force.name
|
||||
str = str .. '"},'
|
||||
if e.name ~= "player" then
|
||||
if e.name ~= "character" then
|
||||
game.write_file("layout.lua", str .. '\n' , true)
|
||||
end
|
||||
end
|
||||
|
@ -249,7 +249,7 @@ local function create_biter_battle_menu(player)
|
||||
local l = t.add { type = "label", caption = #game.forces["north"].connected_players .. " Players "}
|
||||
l.style.font_color = { r=0.22, g=0.88, b=0.22}
|
||||
|
||||
if player.force.name ~= "player" then
|
||||
if player.force.name ~= "character" then
|
||||
|
||||
if global.biter_battle_view_players[player.name] == true then
|
||||
local t = frame.add { type = "table", column_count = 4 }
|
||||
@ -319,7 +319,7 @@ local function create_biter_battle_menu(player)
|
||||
local l = t.add { type = "label", caption = #game.forces["south"].connected_players .. " Players "}
|
||||
l.style.font_color = { r=0.22, g=0.88, b=0.22}
|
||||
|
||||
if player.force.name ~= "player" then
|
||||
if player.force.name ~= "character" then
|
||||
|
||||
if global.biter_battle_view_players[player.name] == true then
|
||||
local t = frame.add { type = "table", column_count = 4 }
|
||||
@ -423,7 +423,7 @@ local function join_team(player, team)
|
||||
if #game.forces[team].connected_players > #game.forces[enemy_team].connected_players and global.team_chosen[player.name] == nil then
|
||||
player.print("Team " .. team .. " has too many players currently.", { r=0.98, g=0.66, b=0.22})
|
||||
else
|
||||
player.teleport(surface.find_non_colliding_position("player", game.forces[team].get_spawn_position(surface), 3, 1))
|
||||
player.teleport(surface.find_non_colliding_position("character", game.forces[team].get_spawn_position(surface), 3, 1))
|
||||
player.force=game.forces[team]
|
||||
if global.team_chosen[player.name] then
|
||||
local p = game.permissions.get_group("Default")
|
||||
@ -431,7 +431,7 @@ local function join_team(player, team)
|
||||
game.print("Team " .. player.force.name .. " player " .. player.name .. " is no longer spectating.", { r=0.98, g=0.66, b=0.22})
|
||||
else
|
||||
game.print(player.name .. " has joined team " .. player.force.name .. "!", { r=0.98, g=0.66, b=0.22})
|
||||
local i = player.get_inventory(defines.inventory.player_main)
|
||||
local i = player.get_inventory(defines.inventory.character_main)
|
||||
player.insert {name = 'pistol', count = 1}
|
||||
player.insert {name = 'raw-fish', count = 3}
|
||||
player.insert {name = 'firearm-magazine', count = 16}
|
||||
@ -443,7 +443,7 @@ local function join_team(player, team)
|
||||
end
|
||||
|
||||
if team == "spectator" then
|
||||
player.teleport(surface.find_non_colliding_position("player", {0,0}, 2, 1))
|
||||
player.teleport(surface.find_non_colliding_position("character", {0,0}, 2, 1))
|
||||
player.force=game.forces[team]
|
||||
game.print(player.name .. " is spectating.", { r=0.98, g=0.66, b=0.22})
|
||||
local permission_group = game.permissions.get_group("spectator")
|
||||
@ -569,7 +569,7 @@ local function on_player_joined_game(event)
|
||||
end
|
||||
|
||||
if player.online_time < 5 and game.surfaces["surface"].is_chunk_generated({0,0}) then
|
||||
player.teleport(game.surfaces["surface"].find_non_colliding_position("player", {0,0}, 2, 1), "surface")
|
||||
player.teleport(game.surfaces["surface"].find_non_colliding_position("character", {0,0}, 2, 1), "surface")
|
||||
else
|
||||
if not global.team_chosen[player.name] then player.teleport({0,0}, "surface") end
|
||||
end
|
||||
@ -593,7 +593,7 @@ end
|
||||
|
||||
local function spy_fish(player)
|
||||
local duration_per_unit = 1800
|
||||
local i2 = player.get_inventory(defines.inventory.player_main)
|
||||
local i2 = player.get_inventory(defines.inventory.character_main)
|
||||
local owned_fishes = i2.get_item_count("raw-fish")
|
||||
owned_fishes = owned_fishes + i2.get_item_count("raw-fish")
|
||||
if owned_fishes == 0 then
|
||||
|
@ -153,7 +153,7 @@ local function on_player_joined_game(event)
|
||||
|
||||
if player.online_time == 0 then
|
||||
if surface.is_chunk_generated({0,0}) then
|
||||
player.teleport(surface.find_non_colliding_position("player", {0,0}, 3, 0.5), surface)
|
||||
player.teleport(surface.find_non_colliding_position("character", {0,0}, 3, 0.5), surface)
|
||||
else
|
||||
player.teleport({0,0}, surface)
|
||||
end
|
||||
|
@ -71,7 +71,7 @@ end
|
||||
local function annihilate_base(center_pos, surface, force_name)
|
||||
local entities = {}
|
||||
for _, e in pairs(surface.find_entities_filtered({force = force_name, area = {{center_pos.x - 64, center_pos.y - 64},{center_pos.x + 64, center_pos.y + 64}}})) do
|
||||
if e.name ~= "player" then
|
||||
if e.name ~= "character" then
|
||||
if e.valid then
|
||||
local distance_to_center = math.ceil(math.sqrt((e.position.x - center_pos.x)^2 + (e.position.y - center_pos.y)^2))
|
||||
if not entities[distance_to_center] then entities[distance_to_center] = {} end
|
||||
|
@ -239,7 +239,7 @@ local function join_team(player, force_name)
|
||||
)
|
||||
return
|
||||
end
|
||||
local p = surface.find_non_colliding_position("player", game.forces[force_name].get_spawn_position(surface), 8, 0.5)
|
||||
local p = surface.find_non_colliding_position("character", game.forces[force_name].get_spawn_position(surface), 8, 0.5)
|
||||
player.teleport(p, surface)
|
||||
player.force = game.forces[force_name]
|
||||
player.character.destructible = true
|
||||
@ -248,14 +248,14 @@ local function join_team(player, force_name)
|
||||
game.print("Team " .. player.force.name .. " player " .. player.name .. " is no longer spectating.", {r = 0.98, g = 0.66, b = 0.22})
|
||||
return
|
||||
end
|
||||
local pos = surface.find_non_colliding_position("player", game.forces[force_name].get_spawn_position(surface), 3, 1)
|
||||
local pos = surface.find_non_colliding_position("character", game.forces[force_name].get_spawn_position(surface), 3, 1)
|
||||
if not pos then pos = game.forces[force_name].get_spawn_position(surface) end
|
||||
player.teleport(pos)
|
||||
player.force = game.forces[force_name]
|
||||
player.character.destructible = true
|
||||
game.permissions.get_group("Default").add_player(player)
|
||||
game.print(player.name .. " has joined team " .. player.force.name .. "!", {r = 0.98, g = 0.66, b = 0.22})
|
||||
local i = player.get_inventory(defines.inventory.player_main)
|
||||
local i = player.get_inventory(defines.inventory.character_main)
|
||||
i.clear()
|
||||
player.insert {name = 'pistol', count = 1}
|
||||
player.insert {name = 'raw-fish', count = 3}
|
||||
@ -268,7 +268,7 @@ end
|
||||
|
||||
local function spectate(player)
|
||||
if not player.character then return end
|
||||
player.teleport(player.surface.find_non_colliding_position("player", {0,0}, 4, 1))
|
||||
player.teleport(player.surface.find_non_colliding_position("character", {0,0}, 4, 1))
|
||||
player.force = game.forces.spectator
|
||||
player.character.destructible = false
|
||||
game.print(player.name .. " is spectating.", {r = 0.98, g = 0.66, b = 0.22})
|
||||
|
@ -76,7 +76,7 @@ local function process_entity(surface, entity)
|
||||
entity.clone({position=new_pos, surface=surface, force="south"})
|
||||
return
|
||||
end
|
||||
if entity.name == "player" then
|
||||
if entity.name == "character" then
|
||||
return
|
||||
end
|
||||
if entity.name == "fish" then
|
||||
@ -98,7 +98,7 @@ local function clear_chunk(surface, area)
|
||||
else
|
||||
for _, e in pairs(surface.find_entities_filtered({area = area})) do
|
||||
if e.valid then
|
||||
if e.name ~= "player" then
|
||||
if e.name ~= "character" then
|
||||
e.destroy()
|
||||
end
|
||||
end
|
||||
|
@ -20,7 +20,7 @@ end
|
||||
local function spy_fish(player)
|
||||
if not player.character then return end
|
||||
local duration_per_unit = 1800
|
||||
local i2 = player.get_inventory(defines.inventory.player_main)
|
||||
local i2 = player.get_inventory(defines.inventory.character_main)
|
||||
if not i2 then return end
|
||||
local owned_fishes = i2.get_item_count("raw-fish")
|
||||
owned_fishes = owned_fishes + i2.get_item_count("raw-fish")
|
||||
|
@ -237,7 +237,7 @@ local function on_chunk_generated(event)
|
||||
if event.area.left_top.y == -320 and event.area.left_top.x == -320 then
|
||||
local area = {{-10,-10},{10,10}}
|
||||
for _, e in pairs(surface.find_entities_filtered({area = area})) do
|
||||
if e.name ~= "player" then e.destroy() end
|
||||
if e.name ~= "character" then e.destroy() end
|
||||
end
|
||||
surface.destroy_decoratives({area = area})
|
||||
|
||||
|
@ -839,7 +839,7 @@ local function on_player_joined_game(event)
|
||||
local surface = game.surfaces[1]
|
||||
local player = game.players[event.player_index]
|
||||
if not global.cave_miner_init_done then
|
||||
local p = surface.find_non_colliding_position("player", {0,-40}, 10, 1)
|
||||
local p = surface.find_non_colliding_position("character", {0,-40}, 10, 1)
|
||||
game.forces["player"].set_spawn_position(p,surface)
|
||||
player.teleport(p)
|
||||
surface.daytime = 0.5
|
||||
|
@ -15,7 +15,7 @@ local function on_player_joined_game(event)
|
||||
player.insert({name = "firearm-magazine", count = 16})
|
||||
player.insert({name = "iron-plate", count = 32})
|
||||
|
||||
pos = player.character.surface.find_non_colliding_position("player",{0, -40}, 50, 1)
|
||||
pos = player.character.surface.find_non_colliding_position("character",{0, -40}, 50, 1)
|
||||
game.forces.player.set_spawn_position(pos, player.character.surface)
|
||||
player.teleport(pos, player.character.surface)
|
||||
|
||||
|
@ -332,7 +332,7 @@ local function on_player_joined_game(event)
|
||||
end
|
||||
local surface = game.surfaces["deep_jungle"]
|
||||
if player.online_time < 5 and surface.is_chunk_generated({0,0}) then
|
||||
player.teleport(surface.find_non_colliding_position("player", {0,0}, 2, 1), "deep_jungle")
|
||||
player.teleport(surface.find_non_colliding_position("character", {0,0}, 2, 1), "deep_jungle")
|
||||
else
|
||||
if player.online_time < 5 then
|
||||
player.teleport({0,0}, "deep_jungle")
|
||||
|
@ -357,7 +357,7 @@ local function on_player_joined_game(event)
|
||||
end
|
||||
local surface = game.surfaces["deep_jungle"]
|
||||
if player.online_time < 5 and surface.is_chunk_generated({0,0}) then
|
||||
player.teleport(surface.find_non_colliding_position("player", {0,0}, 2, 1), "deep_jungle")
|
||||
player.teleport(surface.find_non_colliding_position("character", {0,0}, 2, 1), "deep_jungle")
|
||||
else
|
||||
if player.online_time < 5 then
|
||||
player.teleport({0,0}, "deep_jungle")
|
||||
|
@ -17,7 +17,7 @@ function dump_boom_layout()
|
||||
|
||||
local str = "{"
|
||||
for i = 1, #entities, 1 do
|
||||
if entities[i].name ~= "player" then
|
||||
if entities[i].name ~= "character" then
|
||||
str = str .. "{x = " .. math.floor(entities[i].position.x, 0)
|
||||
str = str .. ", y = "
|
||||
str = str .. math.floor(entities[i].position.y, 0)
|
||||
@ -45,7 +45,7 @@ local function on_chunk_generated(event)
|
||||
local entities = surface.find_entities(area)
|
||||
for _, e in pairs(entities) do
|
||||
if e.valid then
|
||||
if e.name ~= "player" then
|
||||
if e.name ~= "character" then
|
||||
e.destroy()
|
||||
end
|
||||
end
|
||||
@ -136,7 +136,7 @@ local function on_player_joined_game(event)
|
||||
end
|
||||
local surface = game.surfaces["empty_map"]
|
||||
if player.online_time < 5 and surface.is_chunk_generated({0,0}) then
|
||||
player.teleport(surface.find_non_colliding_position("player", {0,0}, 2, 1), "empty_map")
|
||||
player.teleport(surface.find_non_colliding_position("character", {0,0}, 2, 1), "empty_map")
|
||||
else
|
||||
if player.online_time < 5 then
|
||||
player.teleport({0,0}, "empty_map")
|
||||
|
@ -23,7 +23,7 @@ local function bounce(surface, position, ammo)
|
||||
local valid_entities = {}
|
||||
for _, e in pairs(surface.find_entities_filtered({area = {{position.x - radius, position.y - radius},{position.x + radius, position.y + radius}}})) do
|
||||
if e.health then
|
||||
if e.force.name ~= "player" then
|
||||
if e.force.name ~= "character" then
|
||||
local distance_from_center = math_sqrt((e.position.x - position.x) ^ 2 + (e.position.y - position.y) ^ 2)
|
||||
if distance_from_center <= radius then
|
||||
valid_entities[#valid_entities + 1] = e
|
||||
@ -43,10 +43,10 @@ local function bouncy_shells(event)
|
||||
if event.damage_type.name ~= "physical" then return false end
|
||||
local player = event.cause
|
||||
if player.shooting_state.state == defines.shooting.not_shooting then return false end
|
||||
local selected_weapon = player.get_inventory(defines.inventory.player_guns)[player.selected_gun_index]
|
||||
local selected_weapon = player.get_inventory(defines.inventory.character_guns)[player.selected_gun_index]
|
||||
if selected_weapon.name ~= "combat-shotgun" and selected_weapon.name ~= "shotgun" then return false end
|
||||
|
||||
local selected_ammo = player.get_inventory(defines.inventory.player_ammo)[player.selected_gun_index]
|
||||
local selected_ammo = player.get_inventory(defines.inventory.character_ammo)[player.selected_gun_index]
|
||||
if not selected_ammo then return end
|
||||
if not ammo_to_projectile_translation[selected_ammo.name] then return end
|
||||
|
||||
|
@ -21,7 +21,7 @@ local function explosive_bullets(event)
|
||||
if event.damage_type.name ~= "physical" then return false end
|
||||
local player = event.cause
|
||||
if player.shooting_state.state == defines.shooting.not_shooting then return false end
|
||||
local selected_weapon = player.get_inventory(defines.inventory.player_guns)[player.selected_gun_index]
|
||||
local selected_weapon = player.get_inventory(defines.inventory.character_guns)[player.selected_gun_index]
|
||||
if selected_weapon.name ~= "submachine-gun" and selected_weapon.name ~= "pistol" then return false end
|
||||
|
||||
player.surface.create_entity({name = "explosion", position = event.entity.position})
|
||||
|
@ -766,7 +766,7 @@ local function damage_entities_in_radius(surface, position, radius, damage)
|
||||
for _, entity in pairs(entities_to_damage) do
|
||||
if entity.health and entity.name ~= "land-mine" then
|
||||
if entity.force.name ~= "enemy" then
|
||||
if entity.name == "player" then
|
||||
if entity.name == "character" then
|
||||
entity.damage(damage, "enemy")
|
||||
else
|
||||
entity.health = entity.health - damage
|
||||
@ -913,7 +913,7 @@ local function on_player_joined_game(event)
|
||||
|
||||
local surface = game.surfaces["fish_defender"]
|
||||
if player.online_time < 2 and surface.is_chunk_generated({0,0}) then
|
||||
player.teleport(surface.find_non_colliding_position("player", {-75, 4}, 50, 1), "fish_defender")
|
||||
player.teleport(surface.find_non_colliding_position("character", {-75, 4}, 50, 1), "fish_defender")
|
||||
else
|
||||
if player.online_time < 2 then
|
||||
player.teleport({-50, 0}, "fish_defender")
|
||||
@ -1077,10 +1077,10 @@ local function on_chunk_generated(event)
|
||||
end
|
||||
end
|
||||
|
||||
local pos = surface.find_non_colliding_position("player",{spawn_position_x + 1, 4}, 50, 1)
|
||||
local pos = surface.find_non_colliding_position("character",{spawn_position_x + 1, 4}, 50, 1)
|
||||
game.forces["player"].set_spawn_position(pos, surface)
|
||||
for _, player in pairs(game.connected_players) do
|
||||
local pos = surface.find_non_colliding_position("player",{spawn_position_x + 1, 4}, 50, 1)
|
||||
local pos = surface.find_non_colliding_position("character",{spawn_position_x + 1, 4}, 50, 1)
|
||||
player.teleport(pos, surface)
|
||||
end
|
||||
|
||||
|
@ -20,7 +20,7 @@ local function on_entity_damaged(event)
|
||||
if protect_market(event) then return end
|
||||
|
||||
if not event.cause then return end
|
||||
if event.cause.name ~= "player" then return end
|
||||
if event.cause.name ~= "character" then return end
|
||||
|
||||
if enhance_railgun(event) then return end
|
||||
if global.explosive_bullets_unlocked then
|
||||
|
@ -80,7 +80,7 @@ local function enhance(event)
|
||||
|
||||
local player = event.cause
|
||||
if player.shooting_state.state == defines.shooting.not_shooting then return end
|
||||
local selected_weapon = player.get_inventory(defines.inventory.player_guns)[player.selected_gun_index]
|
||||
local selected_weapon = player.get_inventory(defines.inventory.character_guns)[player.selected_gun_index]
|
||||
if selected_weapon.name ~= "railgun" then return end
|
||||
|
||||
create_visuals(event.cause, event.entity)
|
||||
|
@ -4,7 +4,7 @@ local radius = 8
|
||||
local function damage_entities_around_target(entity, damage)
|
||||
for _, e in pairs(entity.surface.find_entities_filtered({area = {{entity.position.x - radius, entity.position.y - radius},{entity.position.x + radius, entity.position.y + radius}}})) do
|
||||
if e.health then
|
||||
if e.force.name ~= "player" then
|
||||
if e.force.name ~= "character" then
|
||||
local distance_from_center = math.sqrt((e.position.x - entity.position.x) ^ 2 + (e.position.y - entity.position.y) ^ 2)
|
||||
if distance_from_center <= radius then
|
||||
e.damage(damage, "player", "explosion")
|
||||
|
@ -260,7 +260,7 @@ local function on_chunk_generated(event)
|
||||
local entities = surface.find_entities(area)
|
||||
for _, e in pairs(entities) do
|
||||
if e.valid then
|
||||
if e.name ~= "player" then
|
||||
if e.name ~= "character" then
|
||||
e.destroy()
|
||||
end
|
||||
end
|
||||
@ -468,7 +468,7 @@ local function on_player_joined_game(event)
|
||||
end
|
||||
local surface = game.surfaces["forest_maze"]
|
||||
if player.online_time < 5 and surface.is_chunk_generated({0,0}) then
|
||||
player.teleport(surface.find_non_colliding_position("player", {0,0}, 2, 1), "forest_maze")
|
||||
player.teleport(surface.find_non_colliding_position("character", {0,0}, 2, 1), "forest_maze")
|
||||
else
|
||||
if player.online_time < 5 then
|
||||
player.teleport({0,0}, "forest_maze")
|
||||
|
@ -923,7 +923,7 @@ local function on_player_joined_game(event)
|
||||
end
|
||||
local surface = game.surfaces["labyrinth"]
|
||||
if player.online_time < 5 and surface.is_chunk_generated({0,0}) then
|
||||
player.teleport(surface.find_non_colliding_position("player", {16, 0}, 2, 1), "labyrinth")
|
||||
player.teleport(surface.find_non_colliding_position("character", {16, 0}, 2, 1), "labyrinth")
|
||||
else
|
||||
if player.online_time < 5 then
|
||||
player.teleport({16, 0}, "labyrinth")
|
||||
|
@ -90,7 +90,7 @@ local function on_chunk_generated(event)
|
||||
local entities = {}
|
||||
|
||||
for _, e in pairs(surface.find_entities_filtered({area = event.area})) do
|
||||
if e.name ~= "player" then
|
||||
if e.name ~= "character" then
|
||||
e.destroy()
|
||||
end
|
||||
end
|
||||
@ -133,7 +133,7 @@ local function on_player_joined_game(event)
|
||||
|
||||
local player = game.players[event.player_index]
|
||||
if player.online_time == 0 then
|
||||
player.teleport(game.surfaces["lost"].find_non_colliding_position("player", {0, 2}, 50, 0.5), "lost")
|
||||
player.teleport(game.surfaces["lost"].find_non_colliding_position("character", {0, 2}, 50, 0.5), "lost")
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -306,7 +306,7 @@ local function on_player_joined_game(event)
|
||||
end
|
||||
local surface = game.surfaces["lost_desert"]
|
||||
if player.online_time < 5 and surface.is_chunk_generated({0,0}) then
|
||||
player.teleport(surface.find_non_colliding_position("player", {0,0}, 2, 1), "lost_desert")
|
||||
player.teleport(surface.find_non_colliding_position("character", {0,0}, 2, 1), "lost_desert")
|
||||
else
|
||||
if player.online_time < 5 then
|
||||
player.teleport({0,0}, "lost_desert")
|
||||
|
@ -160,7 +160,7 @@ local function on_player_joined_game(event)
|
||||
|
||||
local surface = game.surfaces["mountain_fortress"]
|
||||
if player.online_time < 2 and surface.is_chunk_generated({0,0}) then
|
||||
player.teleport(surface.find_non_colliding_position("player", spawn_point, 50, 1), "mountain_fortress")
|
||||
player.teleport(surface.find_non_colliding_position("character", spawn_point, 50, 1), "mountain_fortress")
|
||||
else
|
||||
if player.online_time < 2 then
|
||||
player.teleport(spawn_point, "mountain_fortress")
|
||||
@ -414,7 +414,7 @@ local function on_chunk_generated(event)
|
||||
if left_top.y ~= 0 then return end
|
||||
if left_top.x ~= 96 then return end
|
||||
for _, e in pairs(surface.find_entities_filtered({area = {{spawn_point.x - 0.5, spawn_point.y - 0.5},{spawn_point.x + 0.5, spawn_point.y + 0.5}}})) do
|
||||
if e.force.name ~= "player" then
|
||||
if e.force.name ~= "character" then
|
||||
e.destroy()
|
||||
end
|
||||
end
|
||||
|
@ -390,7 +390,7 @@ local function generate_spawn_area(surface)
|
||||
end
|
||||
|
||||
for _, entity in pairs(surface.find_entities_filtered({area = {{pos.x, pos.y}, {pos.x + 0.99, pos.y + 0.99}}})) do
|
||||
if entity.name ~= "player" then
|
||||
if entity.name ~= "character" then
|
||||
entity.destroy()
|
||||
end
|
||||
end
|
||||
@ -600,7 +600,7 @@ local function on_player_joined_game(event)
|
||||
|
||||
local surface = game.surfaces["nightfall"]
|
||||
if player.online_time < 2 and surface.is_chunk_generated({0,0}) then
|
||||
player.teleport(surface.find_non_colliding_position("player", {0, 16}, 50, 1), "nightfall")
|
||||
player.teleport(surface.find_non_colliding_position("character", {0, 16}, 50, 1), "nightfall")
|
||||
else
|
||||
if player.online_time < 2 then
|
||||
player.teleport({0, 16}, "nightfall")
|
||||
|
@ -183,7 +183,7 @@ local function on_player_joined_game(event)
|
||||
if player.online_time == 0 then
|
||||
player.insert({name = "iron-plate", count = 32})
|
||||
player.insert({name = "iron-gear-wheel", count = 16})
|
||||
player.teleport(game.surfaces["rivers"].find_non_colliding_position("player", {0, 2}, 50, 0.5), "rivers")
|
||||
player.teleport(game.surfaces["rivers"].find_non_colliding_position("character", {0, 2}, 50, 0.5), "rivers")
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -34,7 +34,7 @@ local function on_player_joined_game(event)
|
||||
end
|
||||
local surface = game.surfaces["spaghettorio"]
|
||||
if player.online_time < 5 and surface.is_chunk_generated({0,0}) then
|
||||
player.teleport(surface.find_non_colliding_position("player", {0,0}, 2, 1), "spaghettorio")
|
||||
player.teleport(surface.find_non_colliding_position("character", {0,0}, 2, 1), "spaghettorio")
|
||||
else
|
||||
if player.online_time < 5 then
|
||||
player.teleport({0,0}, "spaghettorio")
|
||||
|
@ -485,7 +485,7 @@ local function on_player_joined_game(event)
|
||||
end
|
||||
local surface = game.surfaces["spiral_troopers"]
|
||||
if player.online_time < 5 and surface.is_chunk_generated({0,0}) then
|
||||
player.teleport(surface.find_non_colliding_position("player", {0,0}, 2, 1), "spiral_troopers")
|
||||
player.teleport(surface.find_non_colliding_position("character", {0,0}, 2, 1), "spiral_troopers")
|
||||
else
|
||||
if player.online_time < 5 then
|
||||
player.teleport({0,0}, "spiral_troopers")
|
||||
|
@ -468,7 +468,7 @@ local function on_player_joined_game(event)
|
||||
|
||||
local surface = game.surfaces["spooky_forest"]
|
||||
if player.online_time < 2 and surface.is_chunk_generated({0,0}) then
|
||||
player.teleport(surface.find_non_colliding_position("player", {0, 0}, 50, 1), "spooky_forest")
|
||||
player.teleport(surface.find_non_colliding_position("character", {0, 0}, 50, 1), "spooky_forest")
|
||||
else
|
||||
if player.online_time < 2 then
|
||||
player.teleport({0, 0}, "spooky_forest")
|
||||
|
@ -156,7 +156,7 @@ local function on_player_joined_game(event)
|
||||
|
||||
local surface = game.surfaces["stoneblock"]
|
||||
if player.online_time < 2 and surface.is_chunk_generated({0,0}) then
|
||||
player.teleport(surface.find_non_colliding_position("player", spawn_point, 50, 1), "stoneblock")
|
||||
player.teleport(surface.find_non_colliding_position("character", spawn_point, 50, 1), "stoneblock")
|
||||
else
|
||||
if player.online_time < 2 then
|
||||
player.teleport(spawn_point, "stoneblock")
|
||||
|
@ -396,7 +396,7 @@ local function render_arena_chunk(event)
|
||||
|
||||
for _, entity in pairs(surface.find_entities_filtered({area = event.area})) do
|
||||
if entity.valid then
|
||||
if entity.name ~= "player" then
|
||||
if entity.name ~= "character" then
|
||||
entity.destroy()
|
||||
end
|
||||
end
|
||||
@ -610,7 +610,7 @@ local function on_player_died(event)
|
||||
local str = " "
|
||||
if event.cause then
|
||||
if event.cause.name ~= nil then str = " by " .. event.cause.name end
|
||||
if event.cause.name == "player" then str = " by " .. event.cause.player.name end
|
||||
if event.cause.name == "character" then str = " by " .. event.cause.player.name end
|
||||
if event.cause.name == "tank" then
|
||||
local driver = event.cause.get_driver()
|
||||
if driver.player then
|
||||
|
@ -380,7 +380,7 @@ local function render_spawn_chunk(event)
|
||||
local left_top = event.area.left_top
|
||||
|
||||
for _, entity in pairs(surface.find_entities_filtered({area = event.area})) do
|
||||
if entity.name ~= "player" then
|
||||
if entity.name ~= "character" then
|
||||
entity.destroy()
|
||||
end
|
||||
end
|
||||
@ -485,7 +485,7 @@ local function lobby()
|
||||
permissions_group.add_player(player.name)
|
||||
if not player.character and player.ticks_to_respawn == nil then
|
||||
player.create_character()
|
||||
local pos = player.surface.find_non_colliding_position("player", {0,0}, 16, 3)
|
||||
local pos = player.surface.find_non_colliding_position("character", {0,0}, 16, 3)
|
||||
player.insert({name = "concrete", count = 500})
|
||||
player.insert({name = "hazard-concrete", count = 500})
|
||||
player.insert({name = "stone-brick", count = 500})
|
||||
@ -543,7 +543,7 @@ local function on_player_died(event)
|
||||
local str = " "
|
||||
if event.cause then
|
||||
if event.cause.name ~= nil then str = " by " .. event.cause.name end
|
||||
if event.cause.name == "player" then str = " by " .. event.cause.player.name end
|
||||
if event.cause.name == "character" then str = " by " .. event.cause.player.name end
|
||||
if event.cause.name == "tank" then
|
||||
local driver = event.cause.get_driver()
|
||||
if driver.player then
|
||||
|
@ -36,7 +36,7 @@ local function on_entity_died(event)
|
||||
|
||||
if event.cause then
|
||||
if event.cause.valid then
|
||||
if event.cause.name == "player" then
|
||||
if event.cause.name == "character" then
|
||||
insert(players_to_reward, event.cause)
|
||||
reward_has_been_given = true
|
||||
end
|
||||
|
@ -1,6 +1,6 @@
|
||||
local event = require 'utils.event'
|
||||
local function compute_fullness(player)
|
||||
local inv = player.get_inventory(defines.inventory.player_main)
|
||||
local inv = player.get_inventory(defines.inventory.character_main)
|
||||
local max_stacks = #inv
|
||||
local num_stacks = 0
|
||||
|
||||
|
@ -41,7 +41,7 @@ local function on_player_died(event)
|
||||
return
|
||||
end
|
||||
|
||||
if cause.name == "player" then
|
||||
if cause.name == "character" then
|
||||
if not player.name then return end
|
||||
if not cause.player.name then return end
|
||||
game.print(player.name .. tag .. " was killed by " .. cause.player.name " " .. cause.player.tag .. ".", message_color)
|
||||
|
@ -13,7 +13,7 @@ local function damage_entities_in_radius(surface, position, radius, damage)
|
||||
for _, entity in pairs(entities_to_damage) do
|
||||
if entity.health and entity.name ~= "land-mine" then
|
||||
if entity.force.name ~= "enemy" then
|
||||
if entity.name == "player" then
|
||||
if entity.name == "character" then
|
||||
entity.damage(damage, "enemy")
|
||||
else
|
||||
entity.health = entity.health - damage
|
||||
|
@ -62,7 +62,7 @@ local function process_explosion_tile(pos, explosion_index, current_radius)
|
||||
explosion_animation = "big-explosion"
|
||||
if entity.health > 500 then explosion_animation = "big-artillery-explosion" end
|
||||
global.explosion_schedule[explosion_index].damage_remaining = global.explosion_schedule[explosion_index].damage_remaining - entity.health
|
||||
if entity.name ~= "player" then
|
||||
if entity.name ~= "character" then
|
||||
entity.damage(2097152, "player", "explosion")
|
||||
else
|
||||
entity.die("player")
|
||||
|
@ -84,7 +84,7 @@ local function process_explosion_tile(pos, explosion_index, current_radius)
|
||||
explosion_animation = "big-explosion"
|
||||
if entity.health > 500 then explosion_animation = "big-artillery-explosion" end
|
||||
global.fluid_explosion_schedule[explosion_index].damage_remaining = global.fluid_explosion_schedule[explosion_index].damage_remaining - entity.health
|
||||
if entity.name ~= "player" then
|
||||
if entity.name ~= "character" then
|
||||
entity.damage(2097152, "player", "explosion")
|
||||
else
|
||||
entity.die("player")
|
||||
|
@ -206,7 +206,7 @@ local function refresh_alliances()
|
||||
|
||||
for _, player in pairs(game.players) do
|
||||
if players_to_process[player.index] then
|
||||
if player.force.name ~= "player" then
|
||||
if player.force.name ~= "character" then
|
||||
player.gui.top["anarchy_group_button"].caption = "[Group]"
|
||||
player.tag = ""
|
||||
player.force = game.forces.spectator
|
||||
|
@ -64,7 +64,7 @@ local function place_entity(surface, entity)
|
||||
surface.create_entity(new_e)
|
||||
return
|
||||
end
|
||||
if entity.name == "player" then
|
||||
if entity.name == "character" then
|
||||
return
|
||||
end
|
||||
if entity.name == "fish" then
|
||||
|
@ -79,7 +79,7 @@ local function on_entity_damaged(event)
|
||||
|
||||
local player = event.cause
|
||||
if player.shooting_state.state == defines.shooting.not_shooting then return end
|
||||
local selected_weapon = player.get_inventory(defines.inventory.player_guns)[player.selected_gun_index]
|
||||
local selected_weapon = player.get_inventory(defines.inventory.character_guns)[player.selected_gun_index]
|
||||
if selected_weapon.name ~= "railgun" then return end
|
||||
|
||||
create_visuals(event.cause, event.entity)
|
||||
|
@ -1,7 +1,7 @@
|
||||
local event = require 'utils.event'
|
||||
local game = require 'utils.game'
|
||||
event.add(defines.events.on_entity_damaged, function(event)
|
||||
if event.entity.name ~= 'player' then return end
|
||||
if event.entity.name ~= 'character' then return end
|
||||
local player = game.get_player(event.entity.player)
|
||||
if player.character then
|
||||
if player.character.health == nil then return end
|
||||
|
@ -57,7 +57,7 @@ end
|
||||
|
||||
local function teleport(source_player, target_player)
|
||||
source_player.teleport({x = math.floor(source_player.position.x), y = math.floor(source_player.position.y)})
|
||||
local target_position = target_player.surface.find_non_colliding_position("player", target_player.position, 128, 1)
|
||||
local target_position = target_player.surface.find_non_colliding_position("character", target_player.position, 128, 1)
|
||||
if not target_position then target_position = {x = target_player.position.x, y = target_player.position.y} end
|
||||
local materializing_character = target_player.surface.create_entity({name = "player", position = target_position, force = "neutral", direction = source_player.character.direction})
|
||||
materializing_character.destructible = false
|
||||
|
@ -225,7 +225,7 @@ local function on_gui_click(event)
|
||||
end
|
||||
surface.create_entity({name = "water-splash", position = player.position})
|
||||
surface.create_entity({name = "blood-explosion-big", position = player.position})
|
||||
local p = surface.find_non_colliding_position("player",global.teleporters[index].position, 2,0.5)
|
||||
local p = surface.find_non_colliding_position("character",global.teleporters[index].position, 2,0.5)
|
||||
if p then
|
||||
player.teleport(p, global.teleporters[index].surface)
|
||||
else
|
||||
|
@ -351,7 +351,7 @@ local function on_entity_died(event)
|
||||
if event.entity.type == "unit" or event.entity.type == "unit-spawner" then
|
||||
if event.cause then
|
||||
|
||||
if event.cause.name == "player" then player = event.cause.player end
|
||||
if event.cause.name == "character" then player = event.cause.player end
|
||||
|
||||
--Check for passengers
|
||||
if event.cause.type == "car" then
|
||||
|
Loading…
x
Reference in New Issue
Block a user