游戏精英
![Rank: 8](static/image/common/star_level3.gif) ![Rank: 8](static/image/common/star_level3.gif)
- 贡献度
- 706
- 金元
- 14368
- 积分
- 4311
- 精华
- 5
- 注册时间
- 2012-10-6
|
本帖最后由 一只双眼皮 于 2020-4-24 23:26 编辑
小键盘+ 时间前进
小键盘- 时间倒退
小键盘9 随时存档
左Ctrl+小键盘0 无敌模式
左Ctrl+小键盘1 刷1个水壶
左Ctrl+小键盘2 刷1口锅
左Ctrl+小键盘3 刷1把铁斧
左Ctrl+小键盘7 建筑大师
以上内容的控制,在MainLevel.UpdateInputsDebug
void UpdateInputsDebug()
{
if (Input.GetKey(KeyCode.LeftControl))
{
if (Input.GetKeyDown(KeyCode.Keypad0))
{
Cheats.m_GodMode = !Cheats.m_GodMode;
}
else if (Input.GetKeyUp(KeyCode.Keypad7))
{
Cheats.m_NoSpawn = !Cheats.m_NoSpawn;
}
else if (Input.GetKeyUp(KeyCode.Keypad3))
{
this.AddItemToInventory("Axe_professional");//勘误:因为我是直接编译的IL 所以显示了 this.Add ,实际应该为 Player.Get().AddItemToInventory(" ");
//这里的正确代码改为:Player.Get().AddItemToInventory("Axe_professional"); //其他以此类推
}
else if (Input.GetKeyUp(KeyCode.Keypad1))
{
this.AddItemToInventory("Bidon");
}
else if (Input.GetKeyUp(KeyCode.Keypad2))
{
this.AddItemToInventory("Pot");
}
}
if (Input.GetKeyDown(KeyCode.KeypadPlus))
{
this.m_TODTime.AddHoursDebug(1f);
ReflectionProbeUpdater[] array = UnityEngine.Object.FindObjectsOfType<ReflectionProbeUpdater>();
for (int i = 0; i < array.Length; i++)
{
array[i.RenderProbe();
}
}
else if (Input.GetKeyDown(KeyCode.KeypadMinus))
{
this.m_TODTime.AddHoursDebug(-1f);
ReflectionProbeUpdater[] array2 = UnityEngine.Object.FindObjectsOfType<ReflectionProbeUpdater>();
for (int j = 0; j < array2.Length; j++)
{
array2[j.RenderProbe();
}
}
else if (Input.GetKeyDown(KeyCode.Keypad9))
{
SaveGame.Save();
}
}
除了+ - 9 是借用的原版代码,其他是圣火令自己改的。大家可以利用这个格式,来修改实现 《给与物品》、修改控制段以达到更多目的。为什么要用 if - elseif :因为这样占用资源少。
毕竟 Update是始终在运行的检测。如果用多个 if 来实现,游戏会变卡,某些内存释放不掉容易出现灵异bug。
m_GodMode原版自带,m_NoSpawn是我另外加的一个“静态字段”,用以实现精细控制。
ItemsManager.UpdateDebug 左Ctrl+U 开启所有图纸
ConstructionGhostManager.Update F8直接放建筑
这两项功能有其他人发布过修改方法,我就不再赘述。 一般我比较喜欢用IL指令加 br 这样保留原版代码,万一有问题会容易修复。
OnSkillAction 技能秒满
关键段 this.m_Value = Mathf.Clamp(this.m_Value, Skill.s_MaxValue, Skill.s_MaxValue); 这样改的好处是避免溢出,直接让它 MaxValue;
TorchInfo 火炬燃料时间100倍
Torch.Update 火炬雨中不熄
Torch.UpdateLightNoise 火炬照亮范围4倍
这些都非常容易改,大概就是删除些代码,*4 等等。
Firecamp.ConstantUpdate 营火雨中不熄
Firecamp.UpdateBuriningDuration 营火燃料时间提高
Firecamp.UpdateLightNoise 营火4倍照亮范围
Firecamp.UpdateLightIntensity 营火2倍亮度
营火类同上,因为太容易改,就不放代码了。
UpdateProhibitionType 部分碰撞物红光改白光(允许临山建房、遇水搭桥)
这部分代码因为太长,也不放了。可以对照着原版和我的改版来看。
大概就是:不能让鱼笼一类的物品红光变白光,否则抓鱼啥的不容易生效。但因为soft hard 地上植被等总是红光也难受,所以就把部分 Hard改为了None
10倍超重,我改的比较麻烦。是改的下面三个方法
InventoryBackpack.IsCriticalOverload
InventoryBackpack.IsMaxOverload
InventoryBackpack.IsOverload
把验证时的 m_CurrentWeight *0.1来实现。这样的好处是 50kg负重上限不用动它(因为我不确定会不会有连带影响),只修改超重的验证过程。
ItemInfo.LoadParams 其中字段 AddForgeBurningTime 和其上一项,增加*10 添柴火力10倍 这个也有其实人实现,就不多讲了。简单的一个 *10
Liquidcontainer.UpdateSlotsActivity 水壶椰子壶允许装汤,修改原理为去掉验证水类。在1.3的代码中为原 br.s 47 改为 br 69 绕过这些验证。
建筑大师:
m_NoSpawm 新建字段于 Cheats.下,用于控制杀死物品不出现材料。控制它的开关在最上面 和 刷物品等快键放在一起。
Construction.TakeDamage 秒拆建筑与拆建筑不出垃圾
if (this.m_CurrentHitsCount > this.m_ConstructionInfo.m_HitsCountToDestroy || Cheats.m_GodMode)
{
if (Cheats.m_NoSpawn)
{
UnityEngine.Object.Destroy(base.gameObject);
}
else
{
this.DestroyMe(true);
}
}
原版的if 没有 || god(加上这个就实现秒拆)、也没有下一行的 if NoSpawn(直接Destroy不再调用DestroyMe以避免产生材料垃圾)至于为什么这么改后允许砍掉部分地基实现大屋,懂代码的琢磨一下就明白了
DestroyableObject.DestroyMe 实现砍草不出现小草叶
if (!Cheats.m_NoSpawn)
{
for (int i = 0; i < this.m_Item.m_Info.m_ItemsToBackpackOnDestroy.Count; i++)
在for 循环前,原版没有NoSpawn验证。
if (text.Length > 0 && !Cheats.m_NoSpawn)
原版只有text.Length>0 没有NoSpawn
DestroyablePlant.OnDestroyPlant 删除棕榈树等大叶子垃圾
if (!Cheats.m_NoSpawn)
{
new Dictionary<ItemReplacer, ItemReplacer>();
原版生成字典这一行前,加入NoSpawn验证。另外:弓箭、等很多不晃是搜索GetProportionalClamp
然后分析这个方法的被调用。就可以实现很多很多很多功能。(我没改)
仅弓箭瞄准时不晃 搜索 GetAimShakeMul 把返回值改小。如
return this.m_AimShakeMul.Evaluate(this.m_Value) * 0.01f;
控制抛射物和近战武器耐久的是Item.TakeDamage
把 this.m_Info.m_Health -= damage_info.m_Damage; 改为
if (!this.Equals(Player.Get().GetCurrentItem(Hand.Right)) && !this.Equals(Player.Get().GetCurrentItem(Hand.Left)) && !this.Equals(Player.Get().GetCurrentItem(Hand.Count)))
{
this.m_Info.m_Health -= damage_info.m_Damage;
}
也可以连用 else if 或 else 但不建议这个位置锁定耐久(可能牵扯到其他物品)。
BowController.Shot 改-为+ 控制弓耐久
WeaponSpearController.Shot 同上改,控制飞矛耐久
火炬耐久改 Torch.UpdateBurning
this.m_Info.m_Health -= ((TorchInfo)this.m_Info).m_DamageWhenBurning; 改-为+
或直接锁定
this.m_Info.m_Health =100f;
关于刷所有物品
在ItemsManager.UpdateDebug 也就是解锁图纸那个 方法 的前半段。
首先需要在ItemsManager. 下新建一个 字段 类型为 UIList,然后把代码复制进去
//注释:
if (Input.GetKeyDown(KeyCode.LeftAlt) && Input.GetKey(KeyCode.LeftControl))//注释:按住左CTRL 和 左Alt
{
MenuInGameManager.Get().ShowScreen(typeof(MenuDebugItem));//注释:显示菜单
string selectedElementText = this.m_List.GetSelectedElementText();//注释:等待用户选择物品名称(点击列表和OK按钮 )
if (selectedElementText != string.Empty)
{
ItemsManager.Get().m_DebugSpawnID = (ItemID)Enum.Parse(typeof(ItemID), selectedElementText);
}
}
if (this.m_DebugSpawnID != ItemID.None && Input.GetKeyDown(KeyCode.I) && Input.GetKey(KeyCode.LeftControl)) //注释:按住左CTRL 和 I 刷物品到鼠标指向的位置(以下为原版代码)
{
Vector3 forward = Player.Get().GetHeadTransform().forward;
Vector3 vector = Player.Get().GetHeadTransform().position + 0.5f * forward;
RaycastHit raycastHit;
vector = (Physics.Raycast(vector, forward, out raycastHit, 3f) ? raycastHit.point : (vector + forward * 2f));
this.CreateItem(this.m_DebugSpawnID, true, vector - forward * 0.2f, Player.Get().transform.rotation; }
关于采收的限制-因为圣火令觉得一只乌龟采3个壳实在不科学,所以尝试了限制采收数量的方法。(这与论坛上普遍增加采收量正好相反)DeadBody.Harvest
for (int i = 0; i < (int)Math.Ceiling((double)Skill.Get<HarvestingAnimalsSkill>().GetItemsCountMul() / 3.0); i++)
{
Item item = ItemsManager.Get().CreateItem(itemID, false, base.transform);
item.Take();
}
可以直接限制for的中值达到目的。摩天大楼:
删除 ConstructionGhost.UpdateAttachingToSlot 中的
if (construction != null && construction.m_Level >= 2 && constructionSlot.m_UpperLevelSlot)
{
return false;
}
这几行,重新编译即可。
| 1.5.3版因某些代码消失,F8实现起来变得比较麻烦
需要在 ConstructionGhost 这个类中修改 UpdateState 为下面的格式
public void UpdateState()
{
if (this.IsReady() || Input.GetKeyDown(KeyCode.F8))
{
this.SetState(ConstructionGhost.GhostState.Ready);
}
ConstructionGhost.GhostState state = this.m_State;
if (state == ConstructionGhost.GhostState.Dragging)
{
this.UpdateRotation();
this.UpdateTransform();
this.UpdateColor();
this.UpdateShaderProps();
return;
}
if (state != ConstructionGhost.GhostState.Building)
{
return;
}
this.UpdateShaderProps();
}
|
评分
-
1
查看全部评分
-
|