Raox2 / sunrust-issues

A place for bugs and the like.
2 stars 0 forks source link

[ZS] info_player_redeemed #60

Closed ritzbits closed 5 years ago

ritzbits commented 5 years ago

On zs_obj_gauntlet_reborn_v25 players should spawn with weapons upon redeeming, but the new system that spawns them on humans without weapons.

If info_player_redeemed exists on a map then players should spawn at that specified entity rather than on a group of humans. Objective maps that have the info_player_redeemed entity should have them set up properly.

Raox2 commented 5 years ago

I sort of forcefully overrided this because I know maps were never going to be able to do it perfectly.

ritzbits commented 5 years ago

For zs_obj_gauntlet_reborn_v25 this can be solved with setting a redeem loadout on logic_startingloadout.

This update means that info_player_redeemed is obsolete if players never spawn on it. Redeemed players spawning directly on humans works well for linear objective maps. The downside is that mappers won't be able to specify redeem spawn locations. For non-objective maps, the mapper may want to specify redeem location to be away from groups of humans/zombies.

Would it be possible to add a logic value enabling players spawning on info_player_redeemed, with the default being players spawning on humans? This should enable functionality of info_player_redeemed for use by mappers. It should also ensuring that the current system spawns players correctly, even on objective maps that have a legacy info_player_redeemed system.

e.g. redeemoverride - default 0, if set to 1 redeemed players will spawn on info_player_redeemed entities rather than on groups of humans. Use only if players should spawn on info_player_redeemed rather than near the humans.

Examples of use: zs_its_high_noon_v9d (not on maplist) - Redeem location is in a shooting range with a selection of weapons zs_serious_sam_arena_v13a - Redeem location is in separate area before teleporting them to the arena zs_obj_enervation_v20 - Players spawn in a black room with G-Man speaking to them before they are teleported to the map

List of maps that use the entity:

zs_glacier_v2
zs_gups_abandoned_mall_v2
zs_island_v4a
zs_its_high_noon_v9d
zs_krusty_krab_v3
zs_last_mansion_v3
zs_lighthouse_v2b2
zs_limansk_v2
zs_meat_v3
zs_nastiesthouse_v4
zs_natalyas_cottage_v2
zs_new_hope_hospital_v2
zs_noxbeached
zs_obj_6_nights_v15
zs_obj_agonize_jms_v40
zs_obj_battleball_v2_old
zs_obj_day_zero_v15
zs_obj_day_zero_v16
zs_obj_dr_zombie_survival_v1
zs_obj_dump_v14
zs_obj_enervation_v20
zs_obj_evac_v15
zs_obj_e_girl_e_quest
zs_obj_filth_v17
zs_obj_gauntlet_reborn_v25
zs_obj_hell_ride_deluxe2
zs_obj_lambdacore_v21
zs_obj_mine_v8n
zs_obj_npst_v5
zs_obj_pharmacy_v24
zs_obj_rampage_v8
zs_obj_rescape_v16
zs_obj_rooftops
zs_obj_rooftops_v1
zs_obj_site66_lc1
zs_obj_traverse_v8
zs_office
zs_off_zone0_v8
zs_onett_v6
zs_overran_city_reborn_v2
zs_passage_v3b
zs_pathogen_v2
zs_plane_factory_v2
zs_power_cliff_v3
zs_preppertown_v7
zs_rampage_v5
zs_randomfactory_v2
zs_reconstruction_v2
zs_rescape_v5
zs_retrodiner_final
zs_retrodiner_v4
zs_rip_club_v4k
zs_ruraldepartment_v2
zs_scrapmetal_v2_fixed
zs_serious_sam_arena_v13a
zs_silence_v3
zs_smiley_camp_v5
zs_stadium_v8a
zs_tag_sealed
zs_termites_v5
zs_uglyfort_v7
zs_vault_106_v9
zs_xccr_v13
zs_zhighschool_v2
Raox2 commented 5 years ago

Makes sense, alright

ritzbits commented 5 years ago

The redeemloadout code in sv_playerlogic.lua (lines 304-307) is non-functional. There is a startingloadout keyvalue and a redeemloadout keyvalue in entities/logic_startingloadout/init.lua. These were probably written a long time ago: startingloadout is in the FGD but redeemloadout was not in the FGD, so redeemloadout likely wasn't tested at all.

                if self.RedeemLoadout then
                    for _, class in pairs(self.RedeemLoadout) do
                        pl:Give(class)
                    end
                else
                    local wave = self:GetWave()
                    pl:Give(
                        wave >= 3 and self:GetWeaponClassOfQuality("weapon_zs_redeemers", wave-2) or 
                        "weapon_zs_redeemers"
                    )
                    pl:Give("weapon_zs_swissarmyknife")

                    local random_ammo = table.Random({
                        "ar2", "smg1", "buckshot", "pulse"
                    })
                    pl:GiveAmmo(self.AmmoCache[random_ammo] * 5, random_ammo)
                end

image

Raox2 commented 5 years ago

That should be:

for class, amount in pairs(self.RedeemLoadout) do
  for i=1, amount do
    pl:Give(class)
  end
end