Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[COC] Support usage of multiple spawn_loadout sections in character descriptions. #1590

Open
wants to merge 10 commits into
base: dev
Choose a base branch
from

Conversation

Neloreck
Copy link
Contributor

@Neloreck Neloreck commented Jan 17, 2024

Allows addition of sections spawn_loadout, spawn_loadout2 ... spawn_loadoutN for stalkers items randomization.
Definition of rifle + pistol character description becomes simpler and more readable.

Related

#1529

Changes

@Neloreck Neloreck marked this pull request as ready for review January 17, 2024 23:40

loadout_index += 1;
string32 buf;
loadout_section = strconcat(sizeof(buf), buf, "spawn_loadout", std::to_string(loadout_index).c_str());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xr_sprintf(loadout_section, "spawn_loadout%d", loadout_index);

@Xottab-DUTY Xottab-DUTY added the Modmaker Experience Modmaker experience with OpenXRay label Jan 28, 2024
OneMorePseudoCoder added a commit to OneMorePseudoCoder/OXR_CoC_New that referenced this pull request Feb 21, 2024
-Support usage of multiple spawn_loadout sections in character descriptions (OpenXRay#1590)
-Support for linear space rendering in R4 renderer (OpenXRay#1576)
-Fixed "Naruto run"
-Fog affects npc vision
-Smopth peak
-Landscape render phase (IXRAY)
-Volumetric light optimization (fixed light flickering by Graff46)
-Fixed visual memory manager formula
-Optimazed light renderer (https://github.com/OpenXRay/xray-16/pull/1600/files)
-Fixed HOM cache (dsh2dsh)
-Fixed CKinematics::LL_SetBoneVisible (Anomaly)
OneMorePseudoCoder added a commit to OneMorePseudoCoder/OXR_CoC_New that referenced this pull request Feb 22, 2024
-Support usage of multiple spawn_loadout sections in character descriptions (OpenXRay#1590)
-Support for linear space rendering in R4 renderer (OpenXRay#1576)
-Fixed "Naruto run"
-Fog affects npc vision
-Smopth peak
-Landscape render phase (IXRAY)
-Volumetric light optimization (fixed light flickering by Graff46)
-Fixed visual memory manager formula
-Optimazed light renderer (https://github.com/OpenXRay/xray-16/pull/1600/files)
-Fixed HOM cache (dsh2dsh)
-Fixed CKinematics::LL_SetBoneVisible (Anomaly)
@Xottab-DUTY Xottab-DUTY force-pushed the dev branch 2 times, most recently from 5b2ec76 to 6fffce9 Compare May 4, 2024 03:27
@Xottab-DUTY Xottab-DUTY force-pushed the dev branch 2 times, most recently from e89fcc8 to f6fd5cc Compare October 24, 2024 02:36
@Xottab-DUTY
Copy link
Member

Can it be updated? Or it has been already merged as a part of #1751 (or it does add new feature)?

@Neloreck
Copy link
Contributor Author

Will take a look later.
Seems like in latest changes str was updated to static constexpr cpcstr and it will need some tweaks to resolve conflicts and allow reading of incremental loadout sections.

@Neloreck Neloreck force-pushed the dev-coc-ammo-loadouts branch from 29536f2 to 88bc4eb Compare January 3, 2025 18:07
@Neloreck
Copy link
Contributor Author

Neloreck commented Jan 3, 2025

@Xottab-DUTY
Since CoC part is merged, I can also copy-paste this part from CoC source:

luabind::functor<bool>	funct;
	if (ai().script_engine().functor("ai_stalker.CSE_ALifeObject_spawn_supplies", funct))
	{
		if (funct(this, ID, ini_string))
			return;
	}

(https://github.com/revolucas/CoC-Xray/blob/master/src/xrGame/alife_object.cpp#L29)

@Neloreck
Copy link
Contributor Author

Neloreck commented Jan 3, 2025

Anomaly just leaves commented out spawn loadouts and handles spawn on se_object spawning


function on_creation(se_npc)
	if not (se_npc) then
		return
	end
	
	if skip_npc[se_npc:section_name()] then
		print_debug("NPC Loadouts | SKIP | %s", se_npc:section_name())
		return
	end
	
	-- Get NPC info
	local squad = se_npc.group_id and se_npc.group_id ~= 65535 and alife_object(se_npc.group_id)
	local player_id = squad and squad.player_id
	local squad_name = squad and squad:section_name() or "na"
	local comm = se_npc:community()
	local rank = ranks.get_obj_rank_name(se_npc)
	local data = utils_stpk.get_stalker_data(se_npc)
	local visual = data.visual_name or "na"
	
	create_item_on_npc(se_npc, squad_name, comm, rank, visual, player_id, "primary")
	create_item_on_npc(se_npc, squad_name, comm, rank, visual, player_id, "secondary")
	create_item_on_npc(se_npc, squad_name, comm, rank, visual, player_id, "extra")
end

…ilencer/launcer. Replace yoda styled null comparators.
@Neloreck
Copy link
Contributor Author

Neloreck commented Jan 3, 2025

  • Added CoC callback for custom lua generation of loadouts
  • Added util to check probability of flags (like scope=0.25, silencer=true, launher) and used it for all 6 places
  • Changed variables/comparison to use same style, can change to snake_case if needed

In theory it should work with original, CoC and anomaly scripts/ltx loadout variants

Got this result from spawning 6 NPCs with wpn_lr300=1, scope=0.5, silencer=0.5, launcher=0.5\n
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Modmaker Experience Modmaker experience with OpenXRay
Projects
Status: To do
Development

Successfully merging this pull request may close these issues.

3 participants