Compare commits
3 commits
64f1ad7808
...
641c971f95
Author | SHA1 | Date | |
---|---|---|---|
Lilian Jónsdóttir | 641c971f95 | ||
Lilian Jónsdóttir | 7f92ebb169 | ||
Lilian Jónsdóttir | 4d6351f7a8 |
4
.readme_generator.py
Normal file → Executable file
|
@ -21,8 +21,8 @@ def main():
|
|||
doc += f"## {mod['Title']}\n"
|
||||
doc += str(
|
||||
f'<img src="{dir.name}{sep}{mod["ImagePath"]}" '
|
||||
+ 'alt="mod preview"'
|
||||
+ ' width="48" height="48" /><br/>\n\n',
|
||||
+ 'alt="mod preview" '
|
||||
+ 'width="48" height="48" /><br/>\n\n',
|
||||
)
|
||||
doc += f"{mod['Description']}\n\n"
|
||||
doc += "[Link to the Steam Workshop page]"
|
||||
|
|
0
AutoDropBedding/AutoDropBeddingMenu.cs
Executable file → Normal file
0
AutoDropBedding/Config.cs
Executable file → Normal file
0
AutoDropBedding/Extensions.cs
Executable file → Normal file
0
AutoDropBedding/HarmonyPatches/Patch_Survival_Camp.cs
Executable file → Normal file
0
AutoDropBedding/Helpers.cs
Executable file → Normal file
0
AutoDropBedding/ObjectBlueprints.xml
Executable file → Normal file
0
AutoDropBedding/Options.xml
Executable file → Normal file
0
AutoDropBedding/manifest.json
Executable file → Normal file
0
AutoDropBedding/preview.png
Executable file → Normal file
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
0
AutoDropBedding/screenshot_campfire.png
Executable file → Normal file
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
0
AutoDropBedding/screenshot_menu.png
Executable file → Normal file
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 45 KiB |
0
AutoDropBedding/workshop.json
Executable file → Normal file
284
CyberneticHearingAid/CyberneticHeightenedHearingEffect.cs
Executable file → Normal file
|
@ -1,157 +1,127 @@
|
|||
using System;
|
||||
using XRL.UI;
|
||||
using XRL.World.Capabilities;
|
||||
using XRL.World.Parts;
|
||||
|
||||
// this is 95% copy/pasted from decompiled vanilla HeightenedHearingEffect
|
||||
// only thing added was a reference to the implant because it has the part rather than the implantee
|
||||
namespace XRL.World.Effects
|
||||
{
|
||||
[Serializable]
|
||||
public class CyberneticHeightenedHearingEffect : Effect
|
||||
{
|
||||
public bool bIdentified;
|
||||
public int Level = 1;
|
||||
public GameObject Listener;
|
||||
public GameObject Implant;
|
||||
public CyberneticHeightenedHearingEffect() => Duration = 1;
|
||||
|
||||
public CyberneticHeightenedHearingEffect(int Level, GameObject Listener)
|
||||
: this()
|
||||
{
|
||||
this.Level = Level;
|
||||
this.Listener = Listener;
|
||||
}
|
||||
|
||||
public CyberneticHeightenedHearingEffect(int Level, GameObject Listener, GameObject Implant)
|
||||
: this()
|
||||
{
|
||||
this.Level = Level;
|
||||
this.Listener = Listener;
|
||||
this.Implant = Implant;
|
||||
}
|
||||
|
||||
public override int GetEffectType() => 2048;
|
||||
|
||||
public override bool SameAs(Effect e) => false;
|
||||
|
||||
public override string GetDescription() => (string)null;
|
||||
|
||||
private bool BadListener()
|
||||
{
|
||||
Listener = null;
|
||||
Object.RemoveEffect(this);
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool CheckListen()
|
||||
{
|
||||
if (!GameObject.validate(ref Listener) || !Listener.IsPlayer())
|
||||
{
|
||||
return BadListener();
|
||||
}
|
||||
|
||||
if (!(Implant.GetPart("CyberneticsHearingAid") is CyberneticsHearingAid part))
|
||||
{
|
||||
return BadListener();
|
||||
}
|
||||
|
||||
int num = Object.DistanceTo(Listener);
|
||||
if (num > part.Radius)
|
||||
{
|
||||
return BadListener();
|
||||
}
|
||||
|
||||
if (bIdentified)
|
||||
{
|
||||
CheckInterruptAutoExplore();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Object.CurrentCell == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (((int)((100 + (10 * Level)) / Math.Pow(num + 9, 2.0) * 100.0)).in100())
|
||||
{
|
||||
bIdentified = true;
|
||||
CheckInterruptAutoExplore();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void CheckInterruptAutoExplore()
|
||||
{
|
||||
if (!bIdentified || !GameObject.validate(ref Listener) || !Listener.IsPlayer() || !AutoAct.IsInterruptable() || AutoAct.IsGathering() || !Listener.IsRelevantHostile(Object))
|
||||
return;
|
||||
AddPlayerMessage(Listener.GenerateSpotMessage(Object, verb: "hear"));
|
||||
AutoAct.Interrupt(null, null, Object);
|
||||
}
|
||||
|
||||
public override bool Apply(GameObject Object)
|
||||
{
|
||||
if (Object.pBrain != null)
|
||||
Object.pBrain.Hibernating = false;
|
||||
CheckListen();
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void Register(GameObject Object)
|
||||
{
|
||||
Object.RegisterEffectEvent(this, "EndTurn");
|
||||
base.Register(Object);
|
||||
}
|
||||
|
||||
public override void Unregister(GameObject Object)
|
||||
{
|
||||
Object.UnregisterEffectEvent(this, "EndTurn");
|
||||
base.Unregister(Object);
|
||||
}
|
||||
|
||||
public bool HeardAndNotSeen(GameObject obj)
|
||||
{
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (!obj.IsVisible())
|
||||
return true;
|
||||
Cell currentCell = obj.CurrentCell;
|
||||
return currentCell != null && (!currentCell.IsLit() || !currentCell.IsExplored());
|
||||
}
|
||||
|
||||
public override bool FinalRender(RenderEvent E, bool bAlt)
|
||||
{
|
||||
if (!HeardAndNotSeen(Object) || !Object.CanHypersensesDetect())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (bIdentified)
|
||||
{
|
||||
E.HighestLayer = 0;
|
||||
Object.Render(E);
|
||||
E.ColorString = "&K";
|
||||
E.DetailColor = "K";
|
||||
E.RenderString = Object.pRender.RenderString;
|
||||
E.Tile = !Options.UseTiles ? null : Object.pRender.Tile;
|
||||
E.CustomDraw = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
E.RenderString = "&K?";
|
||||
E.Tile = null;
|
||||
E.CustomDraw = true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool FireEvent(Event E)
|
||||
{
|
||||
if (E.ID == "EndTurn" && Object != null)
|
||||
CheckListen();
|
||||
return base.FireEvent(E);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
using System;
|
||||
using XRL.UI;
|
||||
using XRL.World.Capabilities;
|
||||
using XRL.World.Parts;
|
||||
using XRL.World.Parts.Mutation;
|
||||
|
||||
// this is 95% copy/pasted from decompiled vanilla HeightenedHearingEffect
|
||||
// only thing added was a reference to the implant because it has the part rather than the implantee
|
||||
namespace XRL.World.Effects
|
||||
{
|
||||
[Serializable]
|
||||
public class CyberneticHeightenedHearingEffect : Effect
|
||||
{
|
||||
public bool Identified;
|
||||
public int Level = 1;
|
||||
public GameObject Listener;
|
||||
public GameObject Implant;
|
||||
|
||||
public CyberneticHeightenedHearingEffect() => this.Duration = 1;
|
||||
|
||||
public CyberneticHeightenedHearingEffect(int Level, GameObject Listener, GameObject Implant)
|
||||
: this()
|
||||
{
|
||||
this.Level = Level;
|
||||
this.Listener = Listener;
|
||||
this.Implant = Implant;
|
||||
}
|
||||
|
||||
public override int GetEffectType() => 2048;
|
||||
|
||||
public override bool SameAs(Effect e) => false;
|
||||
|
||||
public override string GetDescription() => (string)null;
|
||||
|
||||
public override bool WantEvent(int ID, int cascade) => base.WantEvent(ID, cascade) || ID == SingletonEvent<EndTurnEvent>.ID || ID == EnteringCellEvent.ID;
|
||||
|
||||
public override bool HandleEvent(AfterPlayerBodyChangeEvent E)
|
||||
{
|
||||
this.CheckListen();
|
||||
return base.HandleEvent(E);
|
||||
}
|
||||
|
||||
public override bool HandleEvent(EndTurnEvent E)
|
||||
{
|
||||
this.CheckListen();
|
||||
return base.HandleEvent(E);
|
||||
}
|
||||
|
||||
public override bool HandleEvent(EnteringCellEvent E)
|
||||
{
|
||||
this.CheckListen();
|
||||
return base.HandleEvent(E);
|
||||
}
|
||||
|
||||
private bool BadListener()
|
||||
{
|
||||
this.Listener = (GameObject)null;
|
||||
this.Object?.RemoveEffect((Effect)this);
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool CheckListen()
|
||||
{
|
||||
if (!GameObject.Validate(this.Object))
|
||||
return true;
|
||||
if (!GameObject.Validate(ref this.Listener) || !this.Listener.IsPlayer())
|
||||
return this.BadListener();
|
||||
CyberneticsHearingAid part = this.Listener.GetPart<CyberneticsHearingAid>();
|
||||
if (part == null || part.Level <= 0)
|
||||
return this.BadListener();
|
||||
if (!(Implant.GetPart("CyberneticsHearingAid") is CyberneticsHearingAid otherpart))
|
||||
return this.BadListener();
|
||||
int num = this.Object.DistanceTo(this.Listener);
|
||||
if (num > part.GetRadius())
|
||||
return this.BadListener();
|
||||
if (this.Identified || this.Object.CurrentCell == null)
|
||||
return true;
|
||||
if (((int)((double)(100 + 10 * this.Level) / Math.Pow((double)(num + 9), 2.0) * 100.0)).in100())
|
||||
{
|
||||
this.Identified = true;
|
||||
if (this.Listener.IsPlayer())
|
||||
AutoAct.CheckHostileInterrupt();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool Apply(GameObject Object)
|
||||
{
|
||||
this.CheckListen();
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void RegisterActive(GameObject Object, IEventRegistrar Registrar) => Registrar.Register((IEventSource)The.Game, (IEventHandler)this, PooledEvent<AfterPlayerBodyChangeEvent>.ID);
|
||||
|
||||
public bool HeardAndNotSeen(GameObject obj)
|
||||
{
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (!obj.IsVisible())
|
||||
return true;
|
||||
Cell currentCell = obj.CurrentCell;
|
||||
return currentCell != null && (!currentCell.IsLit() || !currentCell.IsExplored());
|
||||
}
|
||||
|
||||
public override bool FinalRender(RenderEvent E, bool bAlt)
|
||||
{
|
||||
if (!this.HeardAndNotSeen(this.Object) || !this.Object.CanHypersensesDetect())
|
||||
return true;
|
||||
E.Tile = (string)null;
|
||||
if (this.Identified)
|
||||
{
|
||||
E.HighestLayer = 0;
|
||||
E.NoWake = true;
|
||||
this.Object.ComponentRender(E);
|
||||
E.RenderString = this.Object.Render.RenderString;
|
||||
if (Options.UseTiles)
|
||||
E.Tile = this.Object.Render.Tile;
|
||||
}
|
||||
else
|
||||
E.RenderString = "?";
|
||||
E.ColorString = "&K";
|
||||
E.DetailColor = "K";
|
||||
E.CustomDraw = true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
4
CyberneticHearingAid/CyberneticsHearingAid.cs
Executable file → Normal file
|
@ -16,7 +16,9 @@ namespace XRL.World.Parts
|
|||
get { return GetAvailableComputePowerEvent.GetFor(ParentObject.Implantee) + 1; }
|
||||
}
|
||||
|
||||
public override bool SameAs(IPart p) => false;
|
||||
public static int GetRadius(int Level) => Level < 10 ? 3 + Level * 2 : 40;
|
||||
|
||||
public int GetRadius() => CyberneticsHearingAid.GetRadius(this.Level);
|
||||
|
||||
public override bool WantEvent(int ID, int cascade) => base.WantEvent(ID, cascade) || ID == EndTurnEvent.ID || ID == GetShortDescriptionEvent.ID;
|
||||
|
||||
|
|
0
CyberneticHearingAid/ObjectBlueprints.xml
Executable file → Normal file
0
CyberneticHearingAid/Textures/Items/hearingaid.png
Executable file → Normal file
Before Width: | Height: | Size: 726 B After Width: | Height: | Size: 726 B |
6
CyberneticHearingAid/manifest.json
Executable file → Normal file
|
@ -2,7 +2,7 @@
|
|||
"id": "CyberneticHearingAid",
|
||||
"title": "{{cybernetic hearing aid|Cybernetic Hearing Aid}}",
|
||||
"description": "Enhanced hearing mutation but in cybernetics form.",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"author": "{{paisley|Celediel}}",
|
||||
"previewImage": "preview.png"
|
||||
}
|
||||
"previewImage": "preview.png"
|
||||
}
|
0
CyberneticHearingAid/preview.png
Executable file → Normal file
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
14
CyberneticHearingAid/workshop.json
Executable file → Normal file
|
@ -1,8 +1,8 @@
|
|||
{
|
||||
"WorkshopId": 2721172552,
|
||||
"Title": "Cybernetic Hearing Aid",
|
||||
"Description": "Like the Enhanced Hearing mutation, but a cybernetic.",
|
||||
"Tags": "Script,Cybernetic",
|
||||
"Visibility": "0",
|
||||
"ImagePath": "preview.png"
|
||||
{
|
||||
"WorkshopId": 2721172552,
|
||||
"Title": "Cybernetic Hearing Aid",
|
||||
"Description": "Like the Enhanced Hearing mutation, but a cybernetic.",
|
||||
"Tags": "Script,Cybernetic",
|
||||
"Visibility": "2",
|
||||
"ImagePath": "preview.png"
|
||||
}
|