have tether visual exist when host is notplayer

This commit is contained in:
bgkillas 2024-08-18 00:48:47 -04:00
parent b464490639
commit a9de876274
2 changed files with 20 additions and 1 deletions

View file

@ -63,9 +63,28 @@ local function player_died()
perk_fns.update_perks_for_entity(perk_data, ctx.my_player.entity, allow_notplayer_perk)
util.set_ent_health(ctx.my_player.entity, {max_hp, max_hp})
send_player_cosmetics(ctx.my_id)
if ctx.host_id == ctx.my_id and ctx.proxy_opt.player_tether then
rpc.spawn_tether()
end
end)
end
rpc.opts_reliable()
rpc.opts_everywhere()
function rpc.spawn_tether()
GamePrint("test1")
for id, data in pairs(ctx.players) do
if id == ctx.host_id then
local entity = data.entity
local tether_length = ctx.proxy_opt.tether_length
local zone_ent = EntityLoad("mods/quant.ew/files/system/player_tether/zone_entity.xml")
EntityAddChild(entity, zone_ent)
local particle_component = EntityGetFirstComponentIncludingDisabled(zone_ent, "ParticleEmitterComponent")
ComponentSetValue2(particle_component, "area_circle_radius", tether_length, tether_length + 2)
end
end
end
local function do_game_over(message)
net.proxy_notify_game_over()
ctx.run_ended = true

View file

@ -257,7 +257,7 @@ local function set_camera_pos()
local cam_target = nil
for _, potential_target in pairs(ctx.players) do
local entity = potential_target.entity
if is_suitable_target(entity) then
if is_suitable_target(entity) or potential_target.peer_id == ctx.my_id then
i = i + 1
if i == camera_player then
cam_target = entity